hemanthboyina commented on code in PR #58945:
URL: https://github.com/apache/spark/pull/58945#discussion_r4068884033


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetUtils.scala:
##########
@@ -323,54 +326,62 @@ object ParquetUtils extends Logging {
   private[sql] def getPushedDownAggResult(
       footer: ParquetMetadata,
       filePath: String,
-      dataSchema: StructType,
       partitionSchema: StructType,
-      aggregation: Aggregation)
+      aggregation: Aggregation,
+      aggSchema: StructType)
   : (Array[PrimitiveType], Array[Any]) = {
     val footerFileMetaData = footer.getFileMetaData
-    val fields = footerFileMetaData.getSchema.getFields
+    // Resolve by name in the file's own schema; a positional lookup breaks 
under mergeSchema.
+    val fileSchema = footerFileMetaData.getSchema
+    def fileFieldIndex(colName: String): Int =
+      if (fileSchema.containsField(colName)) fileSchema.getFieldIndex(colName) 
else -1

Review Comment:
   done, fixed it now



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