vboo123 commented on code in PR #59125:
URL: https://github.com/apache/spark/pull/59125#discussion_r4135485677


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetUtils.scala:
##########
@@ -361,16 +362,18 @@ object ParquetUtils extends Logging {
           case count: Count if 
V2ColumnUtils.extractV2Column(count.column).isDefined =>
             val colName = V2ColumnUtils.extractV2Column(count.column).get
             schemaName = "count(" + colName + ")"
-            rowCount += block.getRowCount
-            var isPartitionCol = false
-            if (partitionSchema.getFieldIndex(colName).isDefined) {
-              isPartitionCol = true
-            }
             isCount = true
-            if (!isPartitionCol) {
+            val partitionColIndex = partitionSchema.getFieldIndex(colName)
+            if (partitionColIndex.isEmpty) {
+              rowCount += block.getRowCount
               index = dataSchema.getFieldIndex(colName).getOrElse(-1)
               // Count(*) includes the null values, but Count(colName) doesn't.
               rowCount -= getNumNulls(filePath, blockMetaData, index)
+            } else if (!partitionValues.isNullAt(partitionColIndex.get)) {

Review Comment:
   Oh interesting! Thanks for the feedback. Making the change



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