关于 sql:BigQuery 加载作业失败并出现”无法将”文本”解析为布尔值”

BigQuery load job failing with "Could not parse 'Text' as bool"

使用自动检测架构在 Big Query 中从 CSV 文件创建表。

加载作业失败并出现错误:

Error while reading data, error message: Could not parse 'good' as bool for field order_Flag (position 26) starting at location 1689438

即使该列有一些带有文本/字符串的行,为什么 BigQuery 将其解析为布尔值?


Even though the column has some rows with text/string, why is BigQuery parsing it as a bool?

启用自动检测后,BigQuery 会通过扫描文件中多达 100 行的数据来启动推理过程,以用作代表性样本。 BigQuery 然后检查每个字段并尝试根据示例中的值为该字段分配数据类型。

因此,看起来那些"带有文本/字符串的某些行"超过了 100 行用于自动检测,前 100 行将该字段"定义"为布尔值

您可以阅读有关架构自动检测的更多信息

为避免这种情况 - 您可以为加载定义自己的架构 - 请参阅将 CSV 数据加载到表中的详细信息