erenavsarogullari commented on code in PR #1271:
URL: https://github.com/apache/datafusion-comet/pull/1271#discussion_r1914195082


##########
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala:
##########
@@ -2545,4 +2545,20 @@ class CometExpressionSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
       }
     }
   }
+
+  test("array_intersect") {
+    Seq(true, false).foreach { dictionaryEnabled =>
+      withTempDir { dir =>
+        val path = new Path(dir.toURI.toString, "test.parquet")
+        makeParquetFileAllTypes(path, dictionaryEnabled, 10000)
+        spark.read.parquet(path.toString).createOrReplaceTempView("t1")
+        checkSparkAnswerAndOperator(
+          sql("SELECT array_intersect(array(_2, _3, _4), array(_9, _10)) from 
t1"))

Review Comment:
   Thanks for the review. Updated unit test case. Spark and Comet Physical 
Plans are as follows:
   Spark Physical Plan:
   ```
   *(1) Project [array_intersect(array(cast(_2#1 as int), cast(_3#2 as int), 
_4#3), array(cast(_3#2 as int), _4#3)) AS array_intersect(array(_2, _3, _4), 
array(_3, _4))#44]
   +- *(1) ColumnarToRow
      +- FileScan parquet [_2#1,_3#2,_4#3] Batched: true, DataFilters: [], 
Format: Parquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/jq/jhn012m16zzg7dc9lcgbdvjc0000gp/T/spark-97...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: 
struct<_2:tinyint,_3:smallint,_4:int>
   ```
   Comet Physical Plan:
   ```
   *(1) CometColumnarToRow
   +- CometProject [array_intersect(array(_2, _3, _4), array(_3, _4))#49], 
[array_intersect(array(cast(_2#1 as int), cast(_3#2 as int), _4#3), 
array(cast(_3#2 as int), _4#3)) AS array_intersect(array(_2, _3, _4), array(_3, 
_4))#49]
      +- CometScan parquet [_2#1,_3#2,_4#3] Batched: true, DataFilters: [], 
Format: CometParquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/jq/jhn012m16zzg7dc9lcgbdvjc0000gp/T/spark-97...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: 
struct<_2:tinyint,_3:smallint,_4:int>
   ```
   Also, the execution result is as follows:
   <img width="535" alt="Query Result" 
src="https://github.com/user-attachments/assets/2520df45-78c5-47d1-8b0d-77b2780333a0";
 />



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