Repository navigation
fix(parquet): import DECIMAL columns as Vortex decimals - #632
Merged
Merged
Conversation
A Parquet DECIMAL annotates INT32, INT64, FIXED_LEN_BYTE_ARRAY or BYTE_ARRAY. ParquetImporter mapped the integer forms to plain I32/I64, dropping the scale (17.00 imported as 1700), and threw on the byte-array forms. Every form now maps to DType.Decimal with the annotation's precision and scale, read through hardwood's getDecimal. A DECIMAL nested in a LIST/STRUCT, which was truncated through Number, now fails at the import's start until the nested builders carry BigDecimal. Found by the Raincloud corpus: duckdb-tpch-sf1-lineitem (DECIMAL(15,2) as a 7-byte FIXED_LEN_BYTE_ARRAY) now imports with the dtypes the vortex-jni file has, and its CSV export is byte-identical. Closes #628 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #628.
A Parquet
DECIMALannotatesINT32,INT64,FIXED_LEN_BYTE_ARRAYorBYTE_ARRAY.ParquetImportermapped the integer forms to plainI32/I64, dropping the scale (17.00imported as1700), and threw on the byte-array forms. Every form now maps toDType.Decimalwith the annotation's precision and scale, read through hardwood'sgetDecimal.A
DECIMALnested in aLIST/STRUCT, which was silently truncated throughNumber, now fails at the import's start until the nested builders carryBigDecimal(documented indocs/reference.md).Tests
ParquetImporterTest$Decimals: all four physical encodings, nullable, negative and fractional values.ColumnBuilderTest#nestedDecimal_throwsAtConstructionParquetImportInteropIntegrationTest#decimalWithNulls_jniReadsImportedFile: vortex-jni reads the imported file with Arrow's decimal type at the same precision/scale (full, filtered, row-range), including precision 50 (i256); fails without the fix.Real data (Raincloud):
duckdb-tpch-sf1-lineitem(DECIMAL(15,2)as a 7-byteFIXED_LEN_BYTE_ARRAY) now imports with the dtypes the vortex-jni file has; its CSV export is byte-identical.🤖 Generated with Claude Code