从 Dataproc 写入 BigQuery 时在哪里可以找到错误?
Where to find errors when writing to BigQuery from Dataproc?
我正在使用 BigQuery 连接器将数据集从 Dataproc 作业写入 Bigquery。我正在使用 JSON 写作,但有时会出现此错误:
Caused by: java.io.IOException: Error during BigQuery job execution:
{"location":"{tempOutputLocation}",
"message":"Error while reading data, error message: JSON table encountered too many errors,"
"giving up. Rows: 3; errors: 1. Please look into the errors[] collection for"
"more details.",
"reason":"invalid"}
我确实明白这条消息的意思,大多数时候我什至能够修复它,但找不到他们正在谈论的 errors[] collection
让我很困扰。这是令人沮丧的,因为在没有它的情况下解决问题的唯一方法是查看生成的 json,猜测错误并尝试修复它。这个集合可能会让事情变得更容易!
我查看了我的 dataproc 存储桶,但找不到任何错误集合。
任何关于如何获得它的想法将不胜感激!
编辑:有关错误的更多详细信息
我正在这样写 BigQuery(经典方法):
// Prepare Configuration
BigQueryOutputConfiguration.configure(
conf,
path,
schema,
tempBucket,
BigQueryFileFormat.NEWLINE_DELIMITED_JSON,
classOf[TextOutputFormat[_, _]]
)
// Create Json from case class value using Gson and save to BigQuery
output.rdd.map(value => (null, new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.create()
.toJsonTree(value)
)).saveAsNewAPIHadoopDataset(conf)
现在,Json 值有时会出现一些错误,BigQuery 不满意。例如:
// With a schema like that
val schema: BigQueryTableSchema = new BigQueryTableSchema().setFields(List(
new BigQueryTableFieldSchema().setName("field").setType("STRING").setMode("NULLABLE")
).asJava
// Error will be raised if I try to write a Json like :
case class MyClass(field: Double)
val json = new Gson().toJson(MyClass(3.14))
在这里,我的 Dataproc 作业将失败,返回上述错误。有道理,因为我提供的是 Double 而不是 String。但有时它更棘手,比如太多的小数。
无论如何,错误消息清楚地提到了 Please look into the errors[] collection for more details.
,我希望某个地方有比 JSON table encountered too many errors
更详细的关于所犯错误的集合。但是我找不到。
我重现了这个问题,BigQuery API 返回的 errors
被 BigQuery 连接器丢弃了。我为 BQ 连接器提交了 issue。我们将在下一个版本中修复。
我正在使用 BigQuery 连接器将数据集从 Dataproc 作业写入 Bigquery。我正在使用 JSON 写作,但有时会出现此错误:
Caused by: java.io.IOException: Error during BigQuery job execution:
{"location":"{tempOutputLocation}",
"message":"Error while reading data, error message: JSON table encountered too many errors,"
"giving up. Rows: 3; errors: 1. Please look into the errors[] collection for"
"more details.",
"reason":"invalid"}
我确实明白这条消息的意思,大多数时候我什至能够修复它,但找不到他们正在谈论的 errors[] collection
让我很困扰。这是令人沮丧的,因为在没有它的情况下解决问题的唯一方法是查看生成的 json,猜测错误并尝试修复它。这个集合可能会让事情变得更容易!
我查看了我的 dataproc 存储桶,但找不到任何错误集合。
任何关于如何获得它的想法将不胜感激!
编辑:有关错误的更多详细信息
我正在这样写 BigQuery(经典方法):
// Prepare Configuration
BigQueryOutputConfiguration.configure(
conf,
path,
schema,
tempBucket,
BigQueryFileFormat.NEWLINE_DELIMITED_JSON,
classOf[TextOutputFormat[_, _]]
)
// Create Json from case class value using Gson and save to BigQuery
output.rdd.map(value => (null, new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.create()
.toJsonTree(value)
)).saveAsNewAPIHadoopDataset(conf)
现在,Json 值有时会出现一些错误,BigQuery 不满意。例如:
// With a schema like that
val schema: BigQueryTableSchema = new BigQueryTableSchema().setFields(List(
new BigQueryTableFieldSchema().setName("field").setType("STRING").setMode("NULLABLE")
).asJava
// Error will be raised if I try to write a Json like :
case class MyClass(field: Double)
val json = new Gson().toJson(MyClass(3.14))
在这里,我的 Dataproc 作业将失败,返回上述错误。有道理,因为我提供的是 Double 而不是 String。但有时它更棘手,比如太多的小数。
无论如何,错误消息清楚地提到了 Please look into the errors[] collection for more details.
,我希望某个地方有比 JSON table encountered too many errors
更详细的关于所犯错误的集合。但是我找不到。
我重现了这个问题,BigQuery API 返回的 errors
被 BigQuery 连接器丢弃了。我为 BQ 连接器提交了 issue。我们将在下一个版本中修复。