fix: support INT32/INT64 physical types for decimal columns #686
+235
−41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Parquet decimals can be stored using multiple physical types depending on precision:
INT32for precision <= 9INT64for precision <= 18FIXED_LEN_BYTE_ARRAYfor any precisionBYTE_ARRAYfor any precisionThe previous implementation only accepted
FIXED_LEN_BYTE_ARRAYfor all decimals and rejected valid parquet files with error:This caused
AddFilesto fail when importing datasets (like TPC-DS) that use INT32/INT64 for small precision decimals, which is valid per the Parquet specification.Changes
createStatsAggto switch on Iceberg logical type first, then handle physical representations (matches iceberg-java'sParquetConversions.javaapproach)DecimalType, accepts all valid parquet physical typesDataFileStatsFromMetato handle INT32/INT64 decimal statisticswrappedDecByteArrayStatsfor BYTE_ARRAY encoded decimalsTest plan