Skip to content

Commit

Permalink
Add separate interface method to create scan using a cacheFileRoot.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman Sinha committed Jul 7, 2016
1 parent fa4d3cf commit 5ab5157
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Expand Up @@ -152,7 +152,7 @@ protected void createPartitionSublists() {
}

@Override
public TableScan createTableScan(List<PartitionLocation> newPartitions, String cacheFileRoot) throws Exception {
public TableScan createTableScan(List<PartitionLocation> newPartitions) throws Exception {
GroupScan newGroupScan = createNewGroupScan(newPartitions);
return new DrillScanRel(scanRel.getCluster(),
scanRel.getTraitSet().plus(DrillRel.DRILL_LOGICAL),
Expand Down
Expand Up @@ -20,6 +20,8 @@
import java.util.Iterator;
import java.util.List;

import org.apache.calcite.rel.core.TableScan;

/**
* Abstract base class for file system based partition descriptors and Hive partition descriptors.
*
Expand Down Expand Up @@ -60,4 +62,14 @@ public boolean supportsSinglePartOptimization() {
return false;
}

@Override
public TableScan createTableScan(List<PartitionLocation> newPartitions) throws Exception {
throw new UnsupportedOperationException();
}

@Override
public TableScan createTableScan(List<PartitionLocation> newPartitions, String cacheFileRoot) throws Exception {
throw new UnsupportedOperationException();
}

}
Expand Up @@ -77,7 +77,16 @@ void populatePartitionVectors(ValueVector[] vectors, List<PartitionLocation> par
/**
* Methods create a new TableScan rel node, given the lists of new partitions or new files to SCAN.
* @param newPartitions
* @param cacheFileRoot - optional (can be null)
* @return
* @throws Exception
*/
public TableScan createTableScan(List<PartitionLocation> newPartitions) throws Exception;

/**
* Create a new TableScan rel node, given the lists of new partitions or new files to scan and a path
* to a metadata cache file
* @param newPartitions
* @param cacheFileRoot
* @return
* @throws Exception
*/
Expand Down
Expand Up @@ -392,7 +392,8 @@ protected void doOnMatch(RelOptRuleCall call, Filter filterRel, Project projectR
cacheFileRoot = descriptor.getBaseTableLocation() + path;
}

RelNode inputRel = descriptor.createTableScan(newPartitions, cacheFileRoot);
RelNode inputRel = descriptor.supportsSinglePartOptimization() ?
descriptor.createTableScan(newPartitions, cacheFileRoot) : descriptor.createTableScan(newPartitions);

if (projectRel != null) {
inputRel = projectRel.copy(projectRel.getTraitSet(), Collections.singletonList(inputRel));
Expand Down

0 comments on commit 5ab5157

Please sign in to comment.