patrickswedish opened a new pull request, #26096: URL: https://github.com/apache/datafusion/pull/26096
## Which issue does this PR close? Closes #26012. ## Rationale for this change In \LiteralLookupTable\, evaluation of \CASE <expr> WHEN <literal> ...\ with byte-like literals delegates to \BytesLikeIndexMap\. In \ ry_get_bytes_iterator\, the \DataType::FixedSizeBinary(_)\ match arm erroneously attempted to downcast the array via \s_binary::<i64>()\ (inherited from \DataType::LargeBinary\), rather than handling \FixedSizeBinaryArray\. When a query contained 2 or more \FixedSizeBinary\ WHEN literals, \LiteralLookupTable\ was constructed and panicked during evaluation when downcasting to \GenericBinaryArray<i64>\: \\\ ext thread 'main' panicked at arrow-array-60.0.0/src/cast.rs:938:29: binary array \\\ ## What changes are included in this PR? 1. **Fix Downcast in Lookup Table**: Updated \DataType::FixedSizeBinary(_)\ arm in \ ry_get_bytes_iterator\ (\ytes_like_lookup_table.rs\) to downcast via \rray.as_fixed_size_binary().iter()\, matching the dictionary downcasting path and returning byte slices correctly. 2. **Unit Test**: Added \ est_case_when_literal_lookup_fixed_size_binary_to_int32\ in \datafusion/physical-expr/src/expressions/case.rs\ testing \LiteralLookupTable\ evaluation with \FixedSizeBinary\ literals with and without ELSE, with and without NULLs. 3. **Sqllogictest**: Added regression tests in \datafusion/sqllogictest/test_files/case.slt\ verifying \FixedSizeBinary\ \CASE\ evaluation against branch 1, branch 2, fallback, NULL inputs, and multiple rows. ## Are these changes tested? Yes: - Unit test in \datafusion/physical-expr/src/expressions/case.rs\ (\ est_case_when_literal_lookup_fixed_size_binary_to_int32\) - Sqllogictest in \datafusion/sqllogictest/test_files/case.slt\ - Validated locally with \cargo test\ and \cargo clippy\. ## Are there any user-facing changes? Bug fix: queries with \CASE\ expressions containing multiple \FixedSizeBinary\ literals now evaluate correctly instead of panicking. -- 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]
