rich7420 commented on code in PR #6589:
URL: https://github.com/apache/datafusion-comet/pull/6589#discussion_r4711839609


##########
native/core/src/execution/jni_api.rs:
##########
@@ -1665,20 +1665,19 @@ fn log_plan_metrics(exec_context: &ExecutionContext, 
stage_id: jint, partition:
     }
 }
 
-fn convert_datatype_arrays(
+fn convert_field_arrays(

Review Comment:
   #7505 removed the native columnar-to-row converter on `main`. Could Variant 
support move to `CometColumnarToRowExec` so this `jni_api.rs` change can be 
dropped?



##########
spark/src/test/resources/sql-tests/expressions/misc/variant.sql:
##########
@@ -143,3 +145,43 @@ INSERT INTO test_plain_variant_shape VALUES
 -- An ordinary binary struct with Variant-like field names is not a logical 
Variant.
 query
 SELECT payload FROM test_plain_variant_shape ORDER BY id
+
+-- Arrow Variant storage must reach Spark UnsafeRow through native C2R.
+statement
+SET spark.sql.variant.allowReadingShredded=true
+
+statement
+SET spark.comet.exec.columnarToRow.native.enabled=true
+
+statement
+INSERT INTO test_variant VALUES
+  (5, parse_json('[1,"text",false]'), 'array'),
+  (6, parse_json('42'), 'scalar'),
+  (7, parse_json('{}'), 'empty-object'),
+  (8, parse_json('[]'), 'empty-array')
+
+-- Selecting only Variant or placing siblings on either side previously used 
Spark C2R.
+query expect_operator(CometNativeColumnarToRowExec)
+SELECT v FROM test_variant
+
+query expect_operator(CometNativeColumnarToRowExec)
+SELECT id, v, tail FROM test_variant
+
+query expect_operator(CometNativeColumnarToRowExec)
+SELECT v, tail, id FROM test_variant
+
+statement
+SET spark.sql.variant.writeShredding.enabled=true
+
+statement
+CREATE TABLE test_variant_c2r_shredded USING parquet AS SELECT * FROM 
test_variant
+
+query expect_operator(CometNativeColumnarToRowExec)
+SELECT id, v, tail FROM test_variant_c2r_shredded
+
+-- Disabling native conversion still produces the same rows through Spark C2R.
+statement
+SET spark.comet.exec.columnarToRow.native.enabled=false
+
+query expect_operator(ColumnarToRowExec)

Review Comment:
   Tried `spark.comet.scan.enabled=false`: this still passes for me with a 
Spark scan under `ColumnarToRow`. A plain `query` fails there.



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