rdblue commented on a change in pull request #845: Add persistent IDs to
partition fields
URL: https://github.com/apache/incubator-iceberg/pull/845#discussion_r406886278
##########
File path: core/src/main/java/org/apache/iceberg/PartitionSpecParser.java
##########
@@ -147,7 +150,17 @@ private static void
buildFromJsonFields(PartitionSpec.Builder builder, JsonNode
String transform = JsonUtil.getString(TRANSFORM, element);
int sourceId = JsonUtil.getInt(SOURCE_ID, element);
- builder.add(sourceId, name, transform);
+ // partition field ids are missing in old PartitionSpec, they always
auto-increment from PARTITION_DATA_ID_START
+ if (element.has(FIELD_ID)) {
+ builder.add(sourceId, JsonUtil.getInt(FIELD_ID, element), name,
transform);
+ fieldIdCnt++;
+ } else {
+ builder.add(sourceId, name, transform);
+ }
}
+
+ Preconditions.checkArgument(fieldIdCnt == 0 || fieldIdCnt == json.size(),
+ "Parsed an invalid PartitionSpec Json. Some of its fields (%s/%s) miss
field IDs.",
Review comment:
How about "Cannot parse spec with missing field IDs: %s missing of %s
fields"?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]