从 Datastore 加载到 BigQuery 时出错 "Non-repeated field already set."
Error "Non-repeated field already set." when loading from Datastore into BigQuery
[编辑 20160426:这个错误现在似乎已经解决了!]
[编辑 20160219:再次更新了这个问题,以反映不同的错误消息。另请参阅我提交的 bug report。]
我们有一个数据存储区 table,其中包含一个字段 category
,类型为 Category
,这是一个自定义 class。当我们尝试将此 table 加载到 BigQuery(从数据存储备份)时,问题就出现了。结果 table 应包含(简化):
category.subfield1
,category.subfield2
,category.subfield3.subsubfield1
,category.subfield4
,category.subfield5
相反,BigQuery 对类别字段造成严重破坏:
category_1.record.subfield1
,category_1.record.subfield2
,category_1.record.subfield3.subsubfield1
,category_1.entity.subfield1
,category_1.entity.subfield1
,category_1.entity.subfield3.subsubfield1
,category_1.entity.subfield4
,category_1.entity.subfield5
,category_1.provided
(出于说明的原因,省略了十几个 __key__
-子字段。)
20160219之前,category
-字段输出的乱码更严重,但有一个解决方法:通过选项projection_fields
显式列出所有字段,包括category
].现在这不再可能了,因为它会导致不同的错误消息:Field:category [...] Entity was of unexpected kind "__record__"
原始作业 ID:
项目编号:711939958575
没有 projection_fields: job_Qw6-ygtZNFJ-Y7W0uLEqdvOrO_8
projection_fields: job_lzzXo92lud9r5kvW7Z1kuzFLxS4
我们在将备份从数据存储加载到 BigQuery 时遇到了同样的问题。我们有一个 'Order' 实体,其中有一个嵌套实体 'Customer'。自从我们在嵌套实体 'Customer' 的其中一个字段上添加索引后,我们就会从 BigQuery 中收到 "Non-repeated field already set" 错误。
原因是在嵌套实体中的字段上设置索引(例如,Customer 字段 email 上的索引)在名为 customer.email 的订单实体上创建了一个索引。将数据加载到 BigQuery 时,这会导致 两个字段 称为 customer.email,一个来自嵌套实体,一个来自索引。
我们的解决方案是删除嵌套实体上的索引,以避免在将数据存储备份加载到 BigQuery 时发生这些冲突。不幸的是,我们不得不删除数据库中的所有现有记录,这对我们来说不是什么大问题,但您也必须确保正确删除索引。
[编辑 20160426:这个错误现在似乎已经解决了!]
[编辑 20160219:再次更新了这个问题,以反映不同的错误消息。另请参阅我提交的 bug report。]
我们有一个数据存储区 table,其中包含一个字段 category
,类型为 Category
,这是一个自定义 class。当我们尝试将此 table 加载到 BigQuery(从数据存储备份)时,问题就出现了。结果 table 应包含(简化):
category.subfield1
,category.subfield2
,category.subfield3.subsubfield1
,category.subfield4
,category.subfield5
相反,BigQuery 对类别字段造成严重破坏:
category_1.record.subfield1
,category_1.record.subfield2
,category_1.record.subfield3.subsubfield1
,category_1.entity.subfield1
,category_1.entity.subfield1
,category_1.entity.subfield3.subsubfield1
,category_1.entity.subfield4
,category_1.entity.subfield5
,category_1.provided
(出于说明的原因,省略了十几个 __key__
-子字段。)
20160219之前,category
-字段输出的乱码更严重,但有一个解决方法:通过选项projection_fields
显式列出所有字段,包括category
].现在这不再可能了,因为它会导致不同的错误消息:Field:category [...] Entity was of unexpected kind "__record__"
原始作业 ID:
项目编号:711939958575
没有 projection_fields: job_Qw6-ygtZNFJ-Y7W0uLEqdvOrO_8
projection_fields: job_lzzXo92lud9r5kvW7Z1kuzFLxS4
我们在将备份从数据存储加载到 BigQuery 时遇到了同样的问题。我们有一个 'Order' 实体,其中有一个嵌套实体 'Customer'。自从我们在嵌套实体 'Customer' 的其中一个字段上添加索引后,我们就会从 BigQuery 中收到 "Non-repeated field already set" 错误。
原因是在嵌套实体中的字段上设置索引(例如,Customer 字段 email 上的索引)在名为 customer.email 的订单实体上创建了一个索引。将数据加载到 BigQuery 时,这会导致 两个字段 称为 customer.email,一个来自嵌套实体,一个来自索引。
我们的解决方案是删除嵌套实体上的索引,以避免在将数据存储备份加载到 BigQuery 时发生这些冲突。不幸的是,我们不得不删除数据库中的所有现有记录,这对我们来说不是什么大问题,但您也必须确保正确删除索引。