Github user amansinha100 commented on a diff in the pull request: https://github.com/apache/drill/pull/519#discussion_r70002787 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java --- @@ -269,13 +283,54 @@ protected void doOnMatch(RelOptRuleCall call, Filter filterRel, Project projectR int recordCount = 0; int qualifiedCount = 0; - // Inner loop: within each batch iterate over the PartitionLocations - for(PartitionLocation part: partitions){ - if(!output.getAccessor().isNull(recordCount) && output.getAccessor().get(recordCount) == 1){ - newPartitions.add(part); - qualifiedCount++; + if (checkForSingle && + partitions.get(0).isCompositePartition() /* apply single partition check only for composite partitions */) { + // Inner loop: within each batch iterate over the PartitionLocations + for (PartitionLocation part : partitions) { --- End diff -- @jinfengni I started doing the refactoring to move this particular optimization into a partition descriptor specific class. However, I was having to propagate several internal states to the doSinglePartOpt() method...such as partition map, the referenced dirs bitset , the value vector array and others. Also, since this optimization occurs inside an outer loop, it is not straightforward without doing a broader restructuring of the PruneScanRule.doOnMatch() method. Would you be ok to defer this refactoring to an enhancement JIRA ?
--- 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. ---