Skip to content

Commit d011bce

Browse files
Tim-53alamb
authored andcommitted
fix: HashJoin panic with dictionary-encoded columns in multi-key joins (apache#20441)
## Which issue does this PR close? - Closes apache#20437 ## Rationale for this change `flatten_dictionary_array` returned only the unique values rather then the full expanded array when being called on a `DictionaryArray`. When building a `StructArray` this caused a length mismatch panic. ## What changes are included in this PR? Replaced `array.values()` with `arrow::compute::cast(array, value_type)` in `flatten_dictionary_array`, which properly expands the dictionary into a full length array matching the row count. ## Are these changes tested? Yes, both a new unit test aswell as a regression test were added. ## Are there any user-facing changes? Nope --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent 9e0e3f8 commit d011bce

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

datafusion/physical-plan/src/joins/hash_join/inlist_builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use std::sync::Arc;
2121

2222
use arrow::array::{ArrayRef, StructArray};
23+
use arrow::compute::cast;
2324
use arrow::datatypes::{Field, FieldRef, Fields};
2425
use arrow_schema::DataType;
2526
use datafusion_common::Result;

0 commit comments

Comments
 (0)