Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2841#discussion_r19383949
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetTableOperations.scala
 ---
    @@ -460,27 +481,43 @@ private[parquet] class FilteringParquetRowInputFormat
           val status = fileStatuses.getOrElse(file, fs.getFileStatus(file))
           val parquetMetaData = footer.getParquetMetadata
           val blocks = parquetMetaData.getBlocks
    -      var blockLocations: Array[BlockLocation] = null
    -      if (!cacheMetadata) {
    -        blockLocations = fs.getFileBlockLocations(status, 0, status.getLen)
    -      } else {
    -        blockLocations = blockLocationCache.get(status, new 
Callable[Array[BlockLocation]] {
    -          def call(): Array[BlockLocation] = 
fs.getFileBlockLocations(status, 0, status.getLen)
    -        })
    -      }
    -      splits.addAll(
    -        generateSplits.invoke(
    -          null,
    -          blocks,
    -          blockLocations,
    -          status,
    -          parquetMetaData.getFileMetaData,
    -          readContext.getRequestedSchema.toString,
    -          readContext.getReadSupportMetadata,
    -          minSplitSize,
    -          maxSplitSize).asInstanceOf[JList[ParquetInputSplit]])
    +      totalRowGroups = totalRowGroups + blocks.size
    +      val filteredBlocks = RowGroupFilter.filterRowGroups(
    +        filter,
    +        blocks,
    +        parquetMetaData.getFileMetaData.getSchema)
    +      rowGroupsDropped = rowGroupsDropped + (blocks.size - 
filteredBlocks.size)
    +      
    +      if(!filteredBlocks.isEmpty){
    +          var blockLocations: Array[BlockLocation] = null
    +          if (!cacheMetadata) {
    +            blockLocations = fs.getFileBlockLocations(status, 0, 
status.getLen)
    +          } else {
    +            blockLocations = blockLocationCache.get(status, new 
Callable[Array[BlockLocation]] {
    +              def call(): Array[BlockLocation] = 
fs.getFileBlockLocations(status, 0, status.getLen)
    +            })
    +          }
    +          splits.addAll(
    +            generateSplits.invoke(
    +              null,
    +              filteredBlocks,
    +              blockLocations,
    +              status,
    +              readContext.getRequestedSchema.toString,
    +              readContext.getReadSupportMetadata,
    +              minSplitSize,
    +              maxSplitSize).asInstanceOf[JList[ParquetInputSplit]])
    +        }
         }
     
    +    if(rowGroupsDropped > 0 && totalRowGroups > 0){
    +      val percentDropped = ((rowGroupsDropped/totalRowGroups.toDouble) * 
100).toInt
    +      logInfo("Dropping " + rowGroupsDropped + " row groups that do not 
pass filter predicate! ("
    --- End diff --
    
    Use interpolation:
    
    `s"Dropping $rowGroupsDropped row groups that do not pass filter predicate! 
..."`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to