【问题标题】:How to identify errors when loading data into BigQuery将数据加载到 BigQuery 时如何识别错误
【发布时间】:2014-02-28 18:21:06
【问题描述】:

在将具有约 4100 万行的约 5 GB 文件导入 BigQuery 时,我收到以下错误消息:

Errors:
File: 0 / Offset:4026531933 / Line:604836 / Field:39, Value cannot be converted to expected type.

我的问题:我将如何使用上面错误消息中的 Offset / Line 信息来确定违规记录的行号?

【问题讨论】:

    标签: bigdata google-bigquery


    【解决方案1】:

    对于大文件,BigQuery 将它们分成大块并并行加载。这意味着 BigQuery 不知道在特定片段之前有多少行,因为该文件是按字节范围分块的。提到的偏移量是从文件开头开始的块的开始,以字节为单位。所以错误应该出现在第 4026531933 个字节之后的 604836 行。

    您可以在 Unix 上隔离具有错误值的行:

    tail -c +4026531933 <input file> | head -n $((604836 + 1)) | tail -1
    

    或使用 sed:

    尾 -c + | sed -n $(( + 1))p

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-02
      • 1970-01-01
      • 2020-06-18
      • 1970-01-01
      • 2021-03-01
      • 1970-01-01
      • 2013-11-10
      • 2020-03-24
      相关资源
      最近更新 更多