yym1995 commented on a change in pull request #35038:
URL: https://github.com/apache/spark/pull/35038#discussion_r777804859



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/orc/OrcQuerySuite.scala
##########
@@ -713,6 +715,27 @@ abstract class OrcQuerySuite extends OrcQueryTest with 
SharedSparkSession {
       }
     }
   }
+
+  test("SPARK-37728: Reading nested columns with ORC vectorized reader should 
not " +
+    "cause ArrayIndexOutOfBoundsException") {
+    withTempPath { dir =>
+      val path = dir.getCanonicalPath
+      val df = spark.range(100).map { _ =>
+        val arrayColumn = (0 until 50).map(_ => (0 until 1000).map(k => 
k.toString))
+        arrayColumn
+      }.toDF("record").repartition(1)
+      df.write.format("orc").save(path)
+
+      withSQLConf(SQLConf.ORC_VECTORIZED_READER_NESTED_COLUMN_ENABLED.key -> 
"true") {
+        val readDf = spark.read.orc(path)
+        val vectorizationEnabled = readDf.queryExecution.executedPlan.find {
+          case scan @ (_: FileSourceScanExec | _: BatchScanExec) => 
scan.supportsColumnar
+          case _ => false
+        }.isDefined

Review comment:
       > Why did you remove, `assert(vectorizationEnabled)`, here, which is 
differently from the master branch? It looks like a removal of important test 
coverage again.
   > 
   > Since this test case is about `Reading nested columns with ORC vectorized 
reader ...`, you should not remove it. Did I miss something here?
   
   Because when testing with OrcV2QuerySuite, method `supportColumnarReads` in
   
https://github.com/apache/spark/blob/branch-3.2/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/orc/OrcPartitionReaderFactory.scala
 will be called. `resultSchema.forall(_.dataType.isInstanceOf[AtomicType])` 
will return false in that case. Therefore, I removed 
`assert(vectorizationEnabled)`.
   
   To fix this issue, I think https://github.com/apache/spark/pull/33626 should 
also be backported to branch-3.2.




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