当前位置: 首页>>代码示例>>Java>>正文


Java TableRow.set方法代码示例

本文整理汇总了Java中com.google.api.services.bigquery.model.TableRow.set方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.set方法的具体用法?Java TableRow.set怎么用?Java TableRow.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.services.bigquery.model.TableRow的用法示例。


在下文中一共展示了TableRow.set方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processElement

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@Override
public void processElement(ProcessContext c) {
  Double dollars = c.element();
  TableRow r = new TableRow();
  r.set("dollar_turnover", dollars);
  // the timing can be:
  // EARLY: the dollar amount is not yet final
  // ON_TIME: dataflow thinks the dollar amount is final but late data are still possible
  // LATE: late data has arrived
  r.set("dollar_timing", c.pane().getTiming()); // EARLY, ON_TIME or LATE
  r.set("dollar_window", ((IntervalWindow) c.window()).start().getMillis() / 1000.0 / 60.0); // timestamp in fractional minutes

  LOG.info("Outputting $ value {}} at {} with marker {} for window {}",
    dollars.toString(), new Date().getTime(), c.pane().getTiming().toString(), c.window().hashCode());
  c.output(r);
}
 
开发者ID:googlecodelabs,项目名称:cloud-dataflow-nyc-taxi-tycoon,代码行数:17,代码来源:ExactDollarRides.java

示例2: convertGenericRecordToTableRow

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
private static TableRow convertGenericRecordToTableRow(
    GenericRecord record, List<TableFieldSchema> fields) {
  TableRow row = new TableRow();
  for (TableFieldSchema subSchema : fields) {
    // Per https://cloud.google.com/bigquery/docs/reference/v2/tables#schema, the name field
    // is required, so it may not be null.
    Field field = record.getSchema().getField(subSchema.getName());
    Object convertedValue =
        getTypedCellValue(field.schema(), subSchema, record.get(field.name()));
    if (convertedValue != null) {
      // To match the JSON files exported by BigQuery, do not include null values in the output.
      row.set(field.name(), convertedValue);
    }
  }
  return row;
}
 
开发者ID:apache,项目名称:beam,代码行数:17,代码来源:BigQueryAvroUtils.java

示例3: processElement

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@ProcessElement
public void processElement(ProcessContext c) throws Exception {
    String[] split = c.element().split(",");
    TableRow row = new TableRow();
    for (int i = 0; i < split.length; i++) {
        TableFieldSchema col = getTableSchema().getFields().get(i);
        row.set(col.getName(), split[i]);
    }
    c.output(row);
}
 
开发者ID:shinesolutions,项目名称:devfest-melbourne-2017-demo,代码行数:11,代码来源:TemplatePipeline.java

示例4: processElement

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@ProcessElement
public void processElement(ProcessContext c) throws Exception {
    TableRow row = new TableRow();
    row.set("sales_date", (c.element().getSalesDate().getTime()/1000));
    row.set("store_code", c.element().getStoreCode());
    row.set("register_id", c.element().getRegisterID());
    row.set("receipt_number", c.element().getReceiptNumber());
    row.set("receipt_branch_number", c.element().getReceiptBranchNumber());
    row.set("product_code", c.element().getProductCode());
    row.set("quantity", c.element().getQuantity());
    row.set("price", c.element().getPrice());
    c.output(row);
}
 
开发者ID:topgate,项目名称:retail-demo,代码行数:14,代码来源:ConvertReceiptToBQTableDoFn.java

示例5: apply

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@Override
public TableRow apply(KV<LatLon, Long> ridegrp) {
  TableRow result = new TableRow();
  result.set("latitude", ridegrp.getKey().lat);
  result.set("longitude", ridegrp.getKey().lon);
  result.set("ntaxis", ridegrp.getValue());

  return result;
}
 
开发者ID:googlecodelabs,项目名称:cloud-dataflow-nyc-taxi-tycoon,代码行数:10,代码来源:CountRides.java

示例6: toTableRow

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
public TableRow toTableRow() {
  TableRow result = new TableRow();
  result.set("latitude", lat);
  result.set("longitude", lon);
  result.set("ride_id", rideId);
  result.set("timestamp", Instant.ofEpochMilli(timestamp).toString());
  result.set("ride_status", status);
  return result;
}
 
开发者ID:googlecodelabs,项目名称:cloud-dataflow-nyc-taxi-tycoon,代码行数:10,代码来源:RidePoint.java

示例7: processElement

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@ProcessElement
public void processElement(ProcessContext c, BoundedWindow window) {

  TableRow row = new TableRow();
  for (Map.Entry<String, FieldInfo<InputT>> entry : fieldInfo.entrySet()) {
      String key = entry.getKey();
      FieldInfo<InputT> fcnInfo = entry.getValue();
      FieldFn<InputT> fcn = fcnInfo.getFieldFn();
      row.set(key, fcn.apply(c, window));
    }
  c.output(row);
}
 
开发者ID:apache,项目名称:beam,代码行数:13,代码来源:WriteToBigQuery.java

示例8: processElement

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@ProcessElement
public void processElement(ProcessContext c, BoundedWindow window) {

  TableRow row = new TableRow();
  for (Map.Entry<String, FieldInfo<T>> entry : fieldInfo.entrySet()) {
      String key = entry.getKey();
      FieldInfo<T> fcnInfo = entry.getValue();
      row.set(key, fcnInfo.getFieldFn().apply(c, window));
    }
  c.output(row);
}
 
开发者ID:apache,项目名称:beam,代码行数:12,代码来源:WriteWindowedToBigQuery.java

示例9: convertStringsToLong

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
List<TableRow> convertStringsToLong(List<TableRow> toConvert) {
  // The numbers come back as String after JSON serialization. Change them back to
  // longs so that we can assert the output.
  List<TableRow> converted = Lists.newArrayList();
  for (TableRow entry : toConvert) {
    TableRow convertedEntry = entry.clone();
    convertedEntry.set("number", Long.parseLong((String) convertedEntry.get("number")));
    converted.add(convertedEntry);
  }
  return converted;
}
 
开发者ID:apache,项目名称:beam,代码行数:12,代码来源:BigQueryIOReadTest.java

示例10: testCoder_nullCell

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
@Test
public void testCoder_nullCell() throws CoderException {
  TableRow row = new TableRow();
  row.set("temperature", Data.nullOf(Object.class));
  row.set("max_temperature", Data.nullOf(Object.class));

  byte[] bytes = CoderUtils.encodeToByteArray(TableRowJsonCoder.of(), row);

  TableRow newRow = CoderUtils.decodeFromByteArray(TableRowJsonCoder.of(), bytes);
  byte[] newBytes = CoderUtils.encodeToByteArray(TableRowJsonCoder.of(), newRow);

  Assert.assertArrayEquals(bytes, newBytes);
}
 
开发者ID:apache,项目名称:beam,代码行数:14,代码来源:BigQueryHelpersTest.java

示例11: entityToRow

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
public TableRow entityToRow(List<ColumnSchema> columnSchemas, Entity e) throws Exception {
  TableRow row = new TableRow();
  Map<String, Value> fields = e.getProperties();
       
  for (ColumnSchema columnSchema : columnSchemas) {
    Value v = fields.get(columnSchema.name);
    if (v != null) {
      Object column = valueToColumn(columnSchema, v);
      row.set(columnSchema.name, column);
    }
  }
  return row;
}
 
开发者ID:cobookman,项目名称:DatastoreToGCS,代码行数:14,代码来源:BQBackup.java

示例12: setTableRowFieldIfNotNull

import com.google.api.services.bigquery.model.TableRow; //导入方法依赖的package包/类
public static void setTableRowFieldIfNotNull(TableRow r, String field, Object value) {
	if (value != null)
		r.set(field, value);
}
 
开发者ID:GoogleCloudPlatform,项目名称:dataflow-opinion-analysis,代码行数:5,代码来源:IndexerPipelineUtils.java


注:本文中的com.google.api.services.bigquery.model.TableRow.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。