goldmedal commented on code in PR #12490:
URL: https://github.com/apache/datafusion/pull/12490#discussion_r1761372361


##########
datafusion/sqllogictest/test_files/case.slt:
##########
@@ -108,3 +108,54 @@ SELECT CASE WHEN false THEN 1 ELSE 0 END FROM foo
 0
 0
 0
+
+# List(Utf8) will be casted to List(Int64)
+query ?
+SELECT CASE 1 WHEN 1 THEN ['1', '2', '3'] WHEN 2 THEN [1, 2, 3] ELSE null END;
+----
+[1, 2, 3]
+
+query ?
+SELECT CASE 1 WHEN 1 THEN [[1,2], [2,4]] WHEN 2 THEN [['1','2'], ['2','4']] 
ELSE null END;
+----
+[[1, 2], [2, 4]]
+
+query ?
+SELECT CASE 1 WHEN 1 THEN [1,2,3] WHEN 2 THEN arrow_cast([1,2,3], 
'LargeList(Int64)') ELSE null END;
+----
+[1, 2, 3]
+
+query ?
+SELECT CASE 1 WHEN 1 THEN [[1,2], [2,4]] WHEN 2 THEN arrow_cast([[1,2], 
[2,4]], 'LargeList(LargeList(Int64))') ELSE null END;
+----
+[[1, 2], [2, 4]]
+
+query ?
+SELECT CASE 1 WHEN 1 THEN [1,2,3] WHEN 2 THEN arrow_cast(['1','2','3'], 
'LargeList(Utf8)') ELSE null END;
+----
+[1, 2, 3]
+
+query ?
+SELECT CASE 1 WHEN 1 THEN [[1,2], [2,4]] WHEN 2 THEN arrow_cast([['1','2'], 
['2','4']], 'LargeList(LargeList(Utf8))') ELSE null END;
+----
+[[1, 2], [2, 4]]
+
+query ?
+SELECT CASE 1 WHEN 1 THEN arrow_cast([1,2,3], 'LargeList(Int64)') WHEN 2 THEN 
arrow_cast(['1','2','3'], 'LargeList(Utf8)') ELSE null END;
+----
+[1, 2, 3]
+
+
+# TODO: got arrow nested comparison error. Enable this test after the issue is 
fixed
+# External error: query failed: DataFusion error: Arrow error: Invalid 
argument error: Nested comparison: LargeList(Field { name: "item", data_type: 
Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }) == 
LargeList(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }) (hint: use make_comparator instead)

Review Comment:
   I'm not sure why the comparison fails. It seems a nested comparison issue of 
Arrow. 🤔



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