Github user amansinha100 commented on a diff in the pull request: https://github.com/apache/drill/pull/519#discussion_r71059510 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java --- @@ -143,6 +144,11 @@ public static final RelOptRule getDirFilterOnScan(OptimizerRulesContext optimize } protected void doOnMatch(RelOptRuleCall call, Filter filterRel, Project projectRel, TableScan scanRel) { + if (wasAllPartitionsPruned) { --- End diff -- Pls see commit #ce509af for the changes. Since the 'all partitions pruned' is a special case, I had to keep track of this state and propagate it during the new FileSelection creation after partition pruning. Thus, if the first phase directory pruning eliminated all partitions and we re-added 1 for schema purposes, this directory selection will be eventually seen by the ParquetGroupScan which will examine a flag 'wasAllPartitionsPruned' and decide to retrieve only 1 file from this directory.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---