sunchao commented on code in PR #5603:
URL: https://github.com/apache/datafusion-comet/pull/5603#discussion_r4010904794


##########
spark/src/test/resources/sql-tests/expressions/struct/create_named_struct.sql:
##########
@@ -33,3 +33,36 @@ SELECT named_struct('x', 1, 'y', 'hello', 'z', 3.14)
 
 query
 SELECT named_struct('x', a, 'y', 'fixed_val', 'z', c) FROM test_named_struct
+
+-- duplicate names preserve ordinal values through native struct construction
+query
+SELECT named_struct('x', a, 'x', b) FROM test_named_struct
+
+query
+SELECT named_struct('x', a, 'x', 42) FROM test_named_struct
+
+-- struct() lowers to CreateNamedStruct and derives duplicate names from 
repeated children
+query
+SELECT struct(a, a) FROM test_named_struct
+
+-- nested duplicate-name structs exercise list and map roots during Arrow 
import
+query
+SELECT array(named_struct('x', a, 'x', b)) FROM test_named_struct
+
+query
+SELECT map('row', named_struct('x', a, 'x', b)) FROM test_named_struct

Review Comment:
   ### Correctness
   
   [P2] Reconcile the dispatcher guard brought in from main
   
   Could you reconcile the duplicate-name gate in 
`CometBatchKernelCodegen.isSupportedDataType` with this PR's repaired Arrow 
allocation before merging? 
[#5766](https://github.com/apache/datafusion-comet/commit/0d1348f353ac54897bc523fe3a9c5b5b14afc1a3)
 added a recursive `names.distinct.length == names.length` check. It is absent 
from this head and the assigned base, but present in [the merge CI 
executed](https://github.com/apache/datafusion-comet/blob/71ca59d440b82454c3da98c45e404f5edac2b17f/spark/src/main/scala/org/apache/comet/codegen/CometBatchKernelCodegen.scala#L100).
   
   Consequently this map query falls back with `unsupported output type`, the 
retained-producer `to_json` test falls back with `unsupported input type`, and 
the direct kernel test throws from `generateSource` before evaluating the 
struct. All three fail in [Spark 
4.1](https://github.com/apache/datafusion-comet/actions/runs/34565738711/job/103843948490)
 and the other five expression jobs. The test bodies and duplicate-safe 
allocator match this head exactly. Please retain their intended execution 
assertions and rerun all three after resolving the admission rule. Merely 
accepting fallback in this SQL fixture would leave the JSON and kernel failures 
and the intended dispatcher support unresolved.



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