【发布时间】:2018-03-15 11:34:10
【问题描述】:
我们编写了一个谷歌数据流代码,将一个值插入到一个大查询中 其列的类型为 DateTime 的表。 大多数时候逻辑运行良好。 但是突然我们遇到了 Invalid DateTime 问题。
Exception: java.lang.RuntimeException: java.io.IOException: Insert failed: [{"errors":[{"debugInfo":"generic::out_of_range: Invalid datetime string \"2017-09-26T21:16\"
目前尚不清楚上述值如何以及为何无效。 我们看到它遵循https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types中提到的 DateTime 数据类型
此外,目前尚不清楚为什么它只是偶尔抛出此错误。
我们编写了一个扩展 DoFn 的自定义转换代码 ProcessElement 代码是这样的
public void processElement(ProcessContext c) throws Exception {
TableRow tableRow = c.element();
try {
// do some processing then
tableRow.set("PredictedDate",**LocalDateTime.now().toString()**);
c.output(tableRow);
}catch(Exception exc){
LOG.error("Exception while processing and hence not attempting to write to bigquery");
}
}
enter code here
它运行良好,但在夜间(美国中部时区)偶尔会失败。 你能帮我们找到根本原因吗?
【问题讨论】:
-
字符串应该是
2017-09-26T21:16:00,而不是2017-09-26T21:16。
标签: google-bigquery google-cloud-dataflow