[WIP] fix: read Dict(FixedSizeBinary) from parquet without dict encoding - #10232
[WIP] fix: read Dict(FixedSizeBinary) from parquet without dict encoding#10232Jefffrey wants to merge 1 commit into
Dict(FixedSizeBinary) from parquet without dict encoding#10232Conversation
| let data = DictionaryArray::<K>::new(keys, Arc::new(values)); | ||
| let batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(data)]).unwrap(); | ||
| let data = Arc::new(DictionaryArray::<K>::new(keys, Arc::new(values))) as ArrayRef; | ||
| one_column_roundtrip(Arc::clone(&data), true); |
There was a problem hiding this comment.
From the reproduction, added one_column_roundtrip() usage here to test roundtrip where one of the cases is disabling dictionary encoding entirely
Rest of test changes is just restructuring
| ArrowType::Dictionary(k, v) => (k, v.as_ref().clone()), | ||
| _ => unreachable!(), | ||
| }; | ||
| let array = if let ArrowType::FixedSizeBinary(size) = value_type { |
There was a problem hiding this comment.
Matching what was done above in the Self::Dict path:
arrow-rs/parquet/src/arrow/buffer/dictionary_buffer.rs
Lines 159 to 168 in 7616e10
- as introduced originally by feat: Support round trip reading/writing Arrow type
Dictionary(_, FixedSizeBinary(_))to Parquet #7446
This is because values.into_array() assumed a generic byte offset array:
arrow-rs/parquet/src/arrow/buffer/offset_buffer.rs
Lines 132 to 146 in 7616e10
Which is the wrong structure for a fixedsizebinary array (we don't have offsets buffer, etc.)
Dict(FixedSizeBinary) from parquet without dict encodingDict(FixedSizeBinary) from parquet without dict encoding
|
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
Which issue does this PR close?
Rationale for this change
If a column
Dictionary(FixedSizeBinary)was written to a parquet file, but with dictionary encoding turned off (so encoded only asPLAIN), then reading that file back into aDictionary(FixedSizeBinary)lead to an unavoidable panic so roundtrip was not possible. Fixing this bug.What changes are included in this PR?
Coerce the binary values to fixedsizebinary when reading from non-dictionary encoded values to ensure array construction is respected.
Are these changes tested?
Yes, added new tests.
Are there any user-facing changes?
No.