discord9 commented on code in PR #23966:
URL: https://github.com/apache/datafusion/pull/23966#discussion_r3680214704
##########
datafusion/physical-expr/src/expressions/binary/kernels.rs:
##########
@@ -280,12 +280,15 @@ pub(crate) fn regex_match_dyn_scalar(
"Data type {} not supported as a dictionary value type for
operation 'regex_match_dyn_scalar' on string array",
other
),
- }.map(
+ }.and_then(
// downcast_dictionary_array duplicates code per possible key
type, so we aim to do all prep work before
|evaluated_values| downcast_dictionary_array! {
left => {
- let unpacked_dict =
evaluated_values.take_iter(left.keys().iter().map(|opt| opt.map(|v| v as
_))).collect::<BooleanArray>();
- Arc::new(unpacked_dict) as ArrayRef
+ Ok(arrow::compute::take(
+ evaluated_values.as_ref(),
+ left.keys(),
+ None,
+ )?)
},
_ => unreachable!(),
Review Comment:
Good catch — removed it. `AnyDictionaryArray::keys()` gives `take` the
type-erased key array directly.
##########
datafusion/physical-expr/src/expressions/binary/kernels.rs:
##########
@@ -280,12 +280,15 @@ pub(crate) fn regex_match_dyn_scalar(
"Data type {} not supported as a dictionary value type for
operation 'regex_match_dyn_scalar' on string array",
other
),
- }.map(
+ }.and_then(
// downcast_dictionary_array duplicates code per possible key
type, so we aim to do all prep work before
|evaluated_values| downcast_dictionary_array! {
left => {
- let unpacked_dict =
evaluated_values.take_iter(left.keys().iter().map(|opt| opt.map(|v| v as
_))).collect::<BooleanArray>();
- Arc::new(unpacked_dict) as ArrayRef
+ Ok(arrow::compute::take(
+ evaluated_values.as_ref(),
Review Comment:
Added. `take` is intentional here because it preserves nulls from both the
dictionary keys and the evaluated values when expanding back to rows.
--
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]