LuciferYang commented on a change in pull request #34659:
URL: https://github.com/apache/spark/pull/34659#discussion_r840639102
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetUtils.scala
##########
@@ -187,6 +188,30 @@ object ParquetUtils {
}
}
+ /**
+ * Whether columnar read is supported for the input `schema`.
+ */
+ def isBatchReadSupportedForSchema(sqlConf: SQLConf, schema: StructType):
Boolean =
+ sqlConf.parquetVectorizedReaderEnabled &&
+ schema.forall(f => isBatchReadSupported(sqlConf, f.dataType))
+
+ def isBatchReadSupported(sqlConf: SQLConf, dt: DataType): Boolean = dt match
{
+ case _: AtomicType =>
+ true
+ case at: ArrayType =>
+ sqlConf.parquetVectorizedReaderNestedColumnEnabled &&
+ isBatchReadSupported(sqlConf, at.elementType)
+ case mt: MapType =>
+ sqlConf.parquetVectorizedReaderNestedColumnEnabled &&
+ isBatchReadSupported(sqlConf, mt.keyType) &&
+ isBatchReadSupported(sqlConf, mt.valueType)
+ case st: StructType =>
+ sqlConf.parquetVectorizedReaderNestedColumnEnabled &&
+ st.fields.forall(f => isBatchReadSupported(sqlConf, f.dataType))
Review comment:
nit: should be 2 spaces here
--
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]