You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by amansinha100 <gi...@git.apache.org> on 2016/07/07 22:56:32 UTC

[GitHub] drill pull request #519: DRILL-4530: Optimize partition pruning with metadat...

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

    https://github.com/apache/drill/pull/519#discussion_r70002215
  
    --- 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) {
    +            assert part.isCompositePartition();
    +            if(!output.getAccessor().isNull(recordCount) && output.getAccessor().get(recordCount) == 1) {
    +              newPartitions.add(part);
    +              if (isSinglePartition) { // only need to do this if we are already single partition
    +                // compose the array of partition values for the directories that are referenced by filter:
    +                // e.g suppose the dir hierarchy is year/quarter/month and the query is:
    +                //     SELECT * FROM T WHERE dir0=2015 AND dir1 = 'Q1',
    +                // then for 2015/Q1/Feb, this will have ['2015', 'Q1', null]
    --- End diff --
    
    I have fixed this case and updated the pull request with a separate commit (not squashed yet so you can review it separately). 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---