You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/09/03 07:11:57 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #33888: [SPARK-36634][SQL] Support access and read parquet file by column ordinal

cloud-fan commented on a change in pull request #33888:
URL: https://github.com/apache/spark/pull/33888#discussion_r701638958



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetReadSupport.scala
##########
@@ -323,9 +327,20 @@ object ParquetReadSupport {
    * @return A list of clipped [[GroupType]] fields, which can be empty.
    */
   private def clipParquetGroupFields(
-      parquetRecord: GroupType, structType: StructType, caseSensitive: Boolean): Seq[Type] = {
+      parquetRecord: GroupType,
+      structType: StructType,
+      caseSensitive: Boolean,
+      columnIndexAccess: Boolean): Seq[Type] = {
     val toParquet = new SparkToParquetSchemaConverter(writeLegacyParquetFormat = false)
-    if (caseSensitive) {
+    if (columnIndexAccess) {
+      structType.zipWithIndex.map { case (f, i) =>
+        if (i >= parquetRecord.getFieldCount) {
+          toParquet.convertField(f)

Review comment:
       shouldn't we call `clipParquetType`?




-- 
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: reviews-unsubscribe@spark.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org