dharanad commented on code in PR #12259:
URL: https://github.com/apache/datafusion/pull/12259#discussion_r1739888485


##########
datafusion/sqllogictest/test_files/map.slt:
##########
@@ -482,23 +482,56 @@ SELECT MAP { 'a': 1, 2: 3 };
 ----
 {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
+
+query T
+SELECT MAP { 1: 'a', 2: 'b', 3: 'c' }[1];
+----
+a
 
 # TODO(https://github.com/apache/datafusion/issues/11785): fix accessing map 
with non-string key
 # query ?
 # SELECT MAP { MAP {1:'a', 2:'b'}:1, MAP {1:'c', 2:'d'}:2 }[MAP {1:'a', 
2:'b'}];
 # ----
 # 1
 
-# TODO(https://github.com/apache/datafusion/issues/11785): fix accessing map 
with non-string key
-# query ?
-# SELECT MAKE_MAP(1, null, 2, 33, 3, null)[2];
-# ----
-# 33
+query I
+SELECT MAKE_MAP(1, null, 2, 33, 3, null)[2];
+----
+33
+
+query T
+SELECT MAP { 1.0: 'a', 2.0: 'b', 3.0: 'c' }[2.0];
+----
+b
+
+query T
+SELECT MAP { 1.0: 'a', 2.0: 'b', 3.0: 'c' }['2.0'];
+----
+b
+
+query T
+SELECT MAP { 1.0: 'a', 2.0: 'b', 3.0: 'c' }[2];
+----
+b
+
+query T
+SELECT MAP { 1.0: 'a', 2.0: 'b', 3.0: 'c' }['2'];
+----
+b
+
+query T
+SELECT MAP { 1: 'a', 2: 'b', 3: 'c' }[3];
+----
+c
+
+query T
+SELECT MAP { 1: 'a', 2: 'b', 3: 'c' }['3'];
+----
+c
+
+# FIXME: DuckDB handles this case

Review Comment:
   Oh i found out why.
   
   > Utf8 to numeric: strings that can’t be parsed to numbers return null, 
float strings in integer casts return null
   
   Ref: 
https://docs.rs/arrow/latest/arrow/compute/kernels/cast/fn.cast_with_options.html
   



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

Reply via email to