alamb commented on code in PR #7825:
URL: https://github.com/apache/arrow-datafusion/pull/7825#discussion_r1359846961


##########
datafusion/physical-expr/src/expressions/get_indexed_field.rs:
##########
@@ -183,6 +186,14 @@ impl PhysicalExpr for GetIndexedFieldExpr {
         let array = self.arg.evaluate(batch)?.into_array(batch.num_rows());
         match &self.field {
             GetFieldAccessExpr::NamedStructField{name} => match 
(array.data_type(), name) {
+                (DataType::Map(_, _), ScalarValue::Utf8(Some(k))) => {
+                    let map_array = as_map_array(array.as_ref())?;
+                    let key_scalar = 
Scalar::new(StringArray::from(vec![k.clone()]));
+                    let keys = arrow_ord::cmp::eq(&key_scalar, 
map_array.keys())?;

Review Comment:
   I think 
[`arrow::compute::eq`](https://docs.rs/arrow/latest/arrow/compute/kernels/cmp/fn.eq.html)
 is probably the more standard way to compare two arrays (though they call the 
same underlying kernels). That would let you avoid having to add the (newly 
explict) `arrow-ord` dependency.
   



##########
datafusion/expr/src/field_util.rs:
##########
@@ -45,6 +45,19 @@ impl GetFieldAccessSchema {
         match self {
             Self::NamedStructField{ name } => {
                 match (data_type, name) {
+                    (DataType::Map(fields, _), _) => {
+                        match fields.data_type() {
+                            DataType::Struct(fields) if fields.len() == 2 => {
+                                // Arrow's MapArray is essentially a ListArray 
of structs with two columns. They are

Review Comment:
   👍 



##########
datafusion/expr/src/field_util.rs:
##########
@@ -45,6 +45,19 @@ impl GetFieldAccessSchema {
         match self {
             Self::NamedStructField{ name } => {
                 match (data_type, name) {
+                    (DataType::Map(fields, _), _) => {
+                        match fields.data_type() {
+                            DataType::Struct(fields) if fields.len() == 2 => {
+                                // Arrow's MapArray is essentially a ListArray 
of structs with two columns. They are

Review Comment:
   👍 



-- 
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]

Reply via email to