Google bigquery 如何在BigQuery java客户端加载作业中将'ignoreUnknownValues'选项设置为'true'

Google bigquery 如何在BigQuery java客户端加载作业中将'ignoreUnknownValues'选项设置为'true',google-bigquery,Google Bigquery,我有一个java程序,它使用BigQuery java客户端库将JSON数据从Google云存储导入BigQuery。我正在使用Table.load方法启动加载作业。如何为此加载作业将ignoreUnknownValues选项设置为true 你可以看到这一点 我认为您不能在加载时使用此标志,因为没有标志忽略未知值: 但您可以尝试插入选项,而不是加载: public InsertAllResponse insert(Iterable<InsertAllRequest.RowToInsert&

我有一个java程序,它使用BigQuery java客户端库将JSON数据从Google云存储导入BigQuery。我正在使用Table.load方法启动加载作业。如何为此加载作业将ignoreUnknownValues选项设置为true

你可以看到这一点

我认为您不能在加载时使用此标志,因为没有标志忽略未知值:

但您可以尝试插入选项,而不是加载:

public InsertAllResponse insert(Iterable<InsertAllRequest.RowToInsert> rows,
                            boolean skipInvalidRows,
                            boolean ignoreUnknownValues)
                     throws BigQueryException

好的,这里是你怎么做的

val jobConf = LoadJobConfiguration
  .newBuilder(table.getTableId, path)
  .setIgnoreUnknownValues(true)
  .setFormatOptions(FormatOptions.json())
  .build()
val loadJob = bigQuery.create(JobInfo.newBuilder(jobConf).build())

谢谢你的回复。由于我正在从JSON文件导入数据,因此table.insert对我不起作用。我没有将数据加载到内存中。在这种情况下,您可以使用,但我的问题是关于java客户端库的。
response = table.insert(rows, true, true);
val jobConf = LoadJobConfiguration
  .newBuilder(table.getTableId, path)
  .setIgnoreUnknownValues(true)
  .setFormatOptions(FormatOptions.json())
  .build()
val loadJob = bigQuery.create(JobInfo.newBuilder(jobConf).build())