dharanad commented on code in PR #12259:
URL: https://github.com/apache/datafusion/pull/12259#discussion_r1739718763
##########
datafusion/functions/src/core/getfield.rs:
##########
@@ -184,9 +185,29 @@ impl ScalarUDFImpl for GetFieldFunc {
};
match (array.data_type(), name) {
- (DataType::Map(_, _), ScalarValue::Utf8(Some(k))) => {
+ (DataType::Map(_, _), name) => {
let map_array = as_map_array(array.as_ref())?;
- let key_scalar:
Scalar<arrow::array::GenericByteArray<arrow::datatypes::GenericStringType<i32>>>
= Scalar::new(StringArray::from(vec![k.clone()]));
+ if !matches!(name, ScalarValue::Utf8(_) |
ScalarValue::Int64(_) | ScalarValue::Float64(_)) {
+ return exec_err!(
+ "get indexed field is only possible on map with utf8, int64
and float64 indexes. \
+ Tried with {name:?} index")
+ }
+ let key_array: ArrayRef = match name {
Review Comment:
Nice idea. Thanks again
--
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]