Jefffrey commented on code in PR #18371:
URL: https://github.com/apache/datafusion/pull/18371#discussion_r2476609245
##########
datafusion/sqllogictest/test_files/map.slt:
##########
@@ -526,23 +526,23 @@ SELECT MAP { 'a': 1, 'b': 3 };
query error DataFusion error: Arrow error: Cast error: Cannot cast string 'a'
to value of Int64 type
SELECT MAP { 'a': 1, 2: 3 };
-# TODO(https://github.com/apache/datafusion/issues/11785): fix accessing map
with non-string key
-# query ?
-# SELECT MAP { 1: 'a', 2: 'b', 3: 'c' }[1];
-# ----
-# a
+# accessing map with non-string key
Review Comment:
Would be good to have some test cases where key is string
##########
datafusion/functions-nested/src/planner.rs:
##########
@@ -177,9 +176,7 @@ impl ExprPlanner for FieldAccessPlanner {
)),
)),
// special case for map access with
- Expr::Column(ref c)
- if matches!(schema.data_type(c)?, DataType::Map(_, _))
=>
- {
+ _ if matches!(expr.get_type(schema)?, DataType::Map(_, _))
=> {
Review Comment:
Can we add a test case for when it's neither column nor literal?
--
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]