geruh opened a new pull request, #14702:
URL: https://github.com/apache/iceberg/pull/14702

   ## Summary
   
   This PR aligns the `ContentFile` partition field JSON serialization in 
`ContentFileParser` with the REST spec, that specifies partition data as an 
ordered array of values.
   
   The REST spec uses an array of primitives to represent partitions, and that 
was discussed here in 
https://github.com/apache/iceberg/pull/9717#discussion_r1495010775 when the 
spec was designed. However, while testing it looks like  `ContentFileParser` 
hasn't had the updates to reflect this yet and was using `SingleValueParser`, 
which produces a field ID map like `{"1000": 1}` instead of an array `[1]`.
   
   ## Testing
   
   **Serialize a partitioned data file:**
   ```
   > ContentFileParser.toJson(dataFile, spec)
   
   {"spec-id":0,"content":"DATA","file-path":"data.parquet", 
"file-format":"PARQUET","partition":[1],"file-size-in-bytes":10, 
"record-count":1,"sort-order-id":0....}
   ```
   
   **Unpartitioned table**
   ```
   {"partition":[]}
   ```
   
   **non array:**
   ```
   > ContentFileParser.partitionFromJson({"partition": {"1000": 1}}, specs)
   
     java.lang.IllegalArgumentException: Invalid partition data for content 
file: non-array...
   ```
   cc: @singhpk234 @amogh-jahagirdar 
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to