本文整理汇总了Java中org.embulk.spi.PageBuilder.setNull方法的典型用法代码示例。如果您正苦于以下问题:Java PageBuilder.setNull方法的具体用法?Java PageBuilder.setNull怎么用?Java PageBuilder.setNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.embulk.spi.PageBuilder
的用法示例。
在下文中一共展示了PageBuilder.setNull方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
/**
* @param builder
*/
private void setValue(PageBuilder builder) {
for (Column inputColumn: inputColumns) {
if (reader.isNull(inputColumn)) {
builder.setNull(inputColumn);
continue;
}
if (Types.STRING.equals(inputColumn.getType())) {
builder.setString(inputColumn, reader.getString(inputColumn));
} else if (Types.BOOLEAN.equals(inputColumn.getType())) {
builder.setBoolean(inputColumn, reader.getBoolean(inputColumn));
} else if (Types.DOUBLE.equals(inputColumn.getType())) {
builder.setDouble(inputColumn, reader.getDouble(inputColumn));
} else if (Types.LONG.equals(inputColumn.getType())) {
builder.setLong(inputColumn, reader.getLong(inputColumn));
} else if (Types.TIMESTAMP.equals(inputColumn.getType())) {
builder.setTimestamp(inputColumn, reader.getTimestamp(inputColumn));
} else if (Types.JSON.equals(inputColumn.getType())) {
builder.setJson(inputColumn, reader.getJson(inputColumn));
}
}
}
开发者ID:toyama0919,项目名称:embulk-filter-google_translate_api,代码行数:25,代码来源:GoogleTranslateApiPageOutput.java
示例2: setInputValues
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
private void setInputValues(PageBuilder pageBuilder) {
for (Column inputColumn: pageReader.getSchema().getColumns()) {
if (pageReader.isNull(inputColumn)) {
pageBuilder.setNull(inputColumn);
continue;
}
if (Types.STRING.equals(inputColumn.getType())) {
pageBuilder.setString(inputColumn, pageReader.getString(inputColumn));
}
else if (Types.BOOLEAN.equals(inputColumn.getType())) {
pageBuilder.setBoolean(inputColumn, pageReader.getBoolean(inputColumn));
}
else if (Types.DOUBLE.equals(inputColumn.getType())) {
pageBuilder.setDouble(inputColumn, pageReader.getDouble(inputColumn));
}
else if (Types.LONG.equals(inputColumn.getType())) {
pageBuilder.setLong(inputColumn, pageReader.getLong(inputColumn));
}
else if (Types.TIMESTAMP.equals(inputColumn.getType())) {
pageBuilder.setTimestamp(inputColumn, pageReader.getTimestamp(inputColumn));
}
}
}
示例3: setPageBuilderToValue
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
protected void setPageBuilderToValue(PageBuilder builder, Object value, int columnIndex) {
if(value == null) {
builder.setNull(columnIndex);
} else {
setter.setValue(builder, value, columnIndex);
}
}
示例4: setValue
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
/**
* @param builder
*/
private void setValue(PageBuilder builder, Map<String, String> ua) {
if (task.getMergeAgentInfo()) {
builder.setString(wootheeColumnMap.get(task.getOutKeyOs()), ua.get("os"));
builder.setString(wootheeColumnMap.get(task.getOutKeyName()), ua.get("name"));
builder.setString(wootheeColumnMap.get(task.getOutKeyCategory()), ua.get("category"));
builder.setString(wootheeColumnMap.get(task.getOutKeyVersion()), ua.get("version"));
builder.setString(wootheeColumnMap.get(task.getOutKeyVendor()), ua.get("vendor"));
}
for (Column inputColumn: inputColumns) {
if (reader.isNull(inputColumn)) {
builder.setNull(inputColumn);
continue;
}
if (Types.STRING.equals(inputColumn.getType())) {
builder.setString(inputColumn, reader.getString(inputColumn));
} else if (Types.BOOLEAN.equals(inputColumn.getType())) {
builder.setBoolean(inputColumn, reader.getBoolean(inputColumn));
} else if (Types.DOUBLE.equals(inputColumn.getType())) {
builder.setDouble(inputColumn, reader.getDouble(inputColumn));
} else if (Types.LONG.equals(inputColumn.getType())) {
builder.setLong(inputColumn, reader.getLong(inputColumn));
} else if (Types.TIMESTAMP.equals(inputColumn.getType())) {
builder.setTimestamp(inputColumn, reader.getTimestamp(inputColumn));
} else if (Types.JSON.equals(inputColumn.getType())) {
builder.setJson(inputColumn, reader.getJson(inputColumn));
}
}
}
示例5: visitCellColor
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
public void visitCellColor(Column column, Color color, CellVisitor visitor) {
int rgb = getRGB(color);
if (rgb < 0) {
PageBuilder pageBuilder = visitorValue.getPageBuilder();
pageBuilder.setNull(column);
return;
}
if (column.getType() instanceof StringType) {
String s = String.format("%06x", rgb);
visitor.visitCellValueString(column, color, s);
} else {
visitor.visitValueLong(column, color, rgb);
}
}
示例6: setJoinedValues
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
private void setJoinedValues(PageBuilder pageBuilder) {
for (Column column: joinColumns) {
// get value from Table
String rowKey = getCurrentJoinBaseColumnValue(pageReader, joinBaseColumn);
if (!table.containsKey(rowKey) || !table.get(rowKey).containsKey(column.getName())) {
pageBuilder.setNull(column);
continue;
}
String value = table.get(rowKey).get(column.getName());
if (value == null) {
pageBuilder.setNull(column);
continue;
}
if (Types.STRING.equals(column.getType())) {
pageBuilder.setString(column, value);
}
else if (Types.BOOLEAN.equals(column.getType())) {
pageBuilder.setBoolean(column, Boolean.parseBoolean(value));
}
else if (Types.DOUBLE.equals(column.getType())) {
pageBuilder.setDouble(column, Double.parseDouble(value));
}
else if (Types.LONG.equals(column.getType())) {
pageBuilder.setLong(column, Long.parseLong(value));
}
else if (Types.TIMESTAMP.equals(column.getType())) {
TimestampParser parser = timestampParserMap.get(column.getName());
pageBuilder.setTimestamp(column, parser.parse(value));
}
}
}
示例7: setValue
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
/**
* @param builder
*/
private void setValue(PageBuilder builder)
{
if (task.getKeepInput()) {
for (Column inputColumn : inputSchema.getColumns()) {
if (reader.isNull(inputColumn)) {
builder.setNull(inputColumn);
continue;
}
if (Types.STRING.equals(inputColumn.getType())) {
builder.setString(inputColumn, reader.getString(inputColumn));
}
else if (Types.BOOLEAN.equals(inputColumn.getType())) {
builder.setBoolean(inputColumn, reader.getBoolean(inputColumn));
}
else if (Types.DOUBLE.equals(inputColumn.getType())) {
builder.setDouble(inputColumn, reader.getDouble(inputColumn));
}
else if (Types.LONG.equals(inputColumn.getType())) {
builder.setLong(inputColumn, reader.getLong(inputColumn));
}
else if (Types.TIMESTAMP.equals(inputColumn.getType())) {
builder.setTimestamp(inputColumn, reader.getTimestamp(inputColumn));
}
else if (Types.JSON.equals(inputColumn.getType())) {
builder.setJson(inputColumn, reader.getJson(inputColumn));
}
}
}
for (Column column : keyNameColumns) {
final String source = reader.getString(column);
List<Token> tokens = tokenize(new StringReader(source));
for (Map<String, String> setting : task.getSettings()) {
String suffix = setting.get("suffix");
String method = setting.get("method");
Column outputColumn = outputSchema.lookupColumn(column.getName() + MoreObjects.firstNonNull(suffix, ""));
List<Value> outputs = Lists.newArrayList();
for (Token token : tokens) {
String word = null;
if ("base_form".equals(method)) {
word = token.getBaseForm();
}
else if ("reading".equals(method)) {
word = token.getReading();
}
else if ("surface_form".equals(method)) {
word = token.getCharTerm();
}
if (word != null) {
outputs.add(ValueFactory.newString(word));
}
}
if (outputColumn.getType().equals(Types.STRING)) {
Joiner joiner = Joiner.on(MoreObjects.firstNonNull(setting.get("delimiter"), ",")).skipNulls();
builder.setString(outputColumn, joiner.join(outputs));
}
else if (outputColumn.getType().equals(Types.JSON)) {
builder.setJson(outputColumn, ValueFactory.newArray(outputs));
}
}
}
}
示例8: setValue
import org.embulk.spi.PageBuilder; //导入方法依赖的package包/类
/**
* @param builder
*/
private void setValue(PageBuilder builder)
{
if (task.getKeepInput()) {
for (Column inputColumn : inputSchema.getColumns()) {
if (reader.isNull(inputColumn)) {
builder.setNull(inputColumn);
continue;
}
if (Types.STRING.equals(inputColumn.getType())) {
builder.setString(inputColumn, reader.getString(inputColumn));
}
else if (Types.BOOLEAN.equals(inputColumn.getType())) {
builder.setBoolean(inputColumn, reader.getBoolean(inputColumn));
}
else if (Types.DOUBLE.equals(inputColumn.getType())) {
builder.setDouble(inputColumn, reader.getDouble(inputColumn));
}
else if (Types.LONG.equals(inputColumn.getType())) {
builder.setLong(inputColumn, reader.getLong(inputColumn));
}
else if (Types.TIMESTAMP.equals(inputColumn.getType())) {
builder.setTimestamp(inputColumn, reader.getTimestamp(inputColumn));
}
else if (Types.JSON.equals(inputColumn.getType())) {
builder.setJson(inputColumn, reader.getJson(inputColumn));
}
}
}
for (Column column : keyNameColumns) {
final String source = reader.getString(column);
List<Token> tokens = tokenizer.tokenize(source);
logger.debug("{} => {}", source, tokens);
for (Map<String, String> setting : task.getSettings()) {
String suffix = setting.get("suffix");
String method = setting.get("method");
Column outputColumn = outputSchema.lookupColumn(column.getName() + MoreObjects.firstNonNull(suffix, ""));
List<Value> outputs = Lists.newArrayList();
for (Token token : tokens) {
logger.debug("token => {}, {}", token, token.getAllFeatures());
if (!isOkPartsOfSpeech(token)) {
continue;
}
String word = null;
if ("base_form".equals(method)) {
word = MoreObjects.firstNonNull(token.getBaseForm(), token.getSurface());
}
else if ("reading".equals(method)) {
word = MoreObjects.firstNonNull(token.getReading(), token.getSurface());
}
else if ("surface_form".equals(method)) {
word = token.getSurface();
}
outputs.add(ValueFactory.newString(word));
}
if (outputColumn.getType().equals(Types.STRING)) {
Joiner joiner = Joiner.on(MoreObjects.firstNonNull(setting.get("delimiter"), ",")).skipNulls();
builder.setString(outputColumn, joiner.join(outputs));
}
else if (outputColumn.getType().equals(Types.JSON)) {
builder.setJson(outputColumn, ValueFactory.newArray(outputs));
}
}
}
}