yym1995 commented on a change in pull request #35038:
URL: https://github.com/apache/spark/pull/35038#discussion_r777804429
##########
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:
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])` is
false in that case. Therefore, I removed `assert(vectorizationEnabled)`.
--
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]