comphead commented on code in PR #1632:
URL: https://github.com/apache/datafusion-comet/pull/1632#discussion_r2036308245


##########
spark/src/test/scala/org/apache/comet/exec/CometNativeReaderSuite.scala:
##########
@@ -143,4 +143,96 @@ class CometNativeReaderSuite extends CometTestBase with 
AdaptiveSparkPlanHelper
         |""".stripMargin,
       "select c0 from tbl")
   }
+
+  test("native reader - read MAP of value ARRAY fields") {
+    testSingleLineQuery(
+      """
+        |select map('a', array(1), 'c', array(3)) as c0 union all
+        |select map('b', array(2))
+        |""".stripMargin,
+      "select c0 from tbl")
+  }
+
+  test("native reader - read MAP of value STRUCT fields") {
+    testSingleLineQuery(
+      """
+        |select map('a', named_struct('f0', 0, 'f1', 'foo'), 'b', 
named_struct('f0', 1, 'f1', 'bar')) as c0 union all
+        |select map('c', named_struct('f2', 0, 'f1', 'baz')) as c0
+        |""".stripMargin,
+      "select c0 from tbl")
+  }
+
+  test("native reader - read MAP of value MAP fields") {
+    testSingleLineQuery(
+      """
+        |select map('a', map('a1', 1, 'b1', 2), 'b', map('a2', 2, 'b2', 3)) as 
c0 union all
+        |select map('c', map('a3', 3, 'b3', 4))
+        |""".stripMargin,
+      "select c0 from tbl")
+  }
+
+  /*
+    org.apache.spark.SparkException: Job aborted due to stage failure: Task 1 
in stage 171.0 failed 1 times, most recent failure:
+    Lost task 1.0 in stage 171.0 (TID 179) (knode0099.cngya03.pie.silu.net 
executor driver): org.apache.comet.CometNativeException: called 
`Result::unwrap()`
+    on an `Err` value: InvalidArgumentError("Incorrect datatype for 
StructArray field \"m0\", expected Map(Field { name: \"entries\",
+    data_type: Struct([Field { name: \"key\", data_type: Utf8, nullable: 
false, dict_id: 0, dict_is_ordered: false, metadata: {} },
+    Field { name: \"value\", data_type: Int32, nullable: false, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]),
+    nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, 
false) got Map(Field { name: \"entries\", d
+    ata_type: Struct([Field { name: \"key\", data_type: Utf8, nullable: false, 
dict_id: 0, dict_is_ordered: false, metadata: {} },
+    Field { name: \"value\", data_type: Int32, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, 
dict_is_ordered: false, metadata: {} }, false)")
+
+   */
+  ignore("native reader - read STRUCT of MAP fields") {

Review Comment:
   The test `native reader - read STRUCT of MAP fields` fails with  schema 
issue below
   ```
       org.apache.spark.SparkException: Job aborted due to stage failure: Task 
1 in stage 171.0 failed 1 times, most recent failure:
       Lost task 1.0 in stage 171.0 (TID 179) (knode0099.cngya03.pie.silu.net 
executor driver): org.apache.comet.CometNativeException: called 
`Result::unwrap()`
       on an `Err` value: InvalidArgumentError("Incorrect datatype for 
StructArray field \"m0\", expected Map(Field { name: \"entries\",
       data_type: Struct([Field { name: \"key\", data_type: Utf8, nullable: 
false, dict_id: 0, dict_is_ordered: false, metadata: {} },
       Field { name: \"value\", data_type: Int32, nullable: false, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]),
       nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, 
false) got Map(Field { name: \"entries\", d
       ata_type: Struct([Field { name: \"key\", data_type: Utf8, nullable: 
false, dict_id: 0, dict_is_ordered: false, metadata: {} },
       Field { name: \"value\", data_type: Int32, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, 
dict_is_ordered: false, metadata: {} }, false)")
   
   ```
   
   Surprisingly that test `native reader - read STRUCT of MAP of STRUCT value 
fields` passes 🤔 



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to