Github user amansinha100 commented on a diff in the pull request:
https://github.com/apache/drill/pull/553#discussion_r72353863
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java
---
@@ -387,16 +378,35 @@ protected void doOnMatch(RelOptRuleCall call, Filter
filterRel, Project projectR
condition = condition.accept(reverseVisitor);
pruneCondition = pruneCondition.accept(reverseVisitor);
- if (checkForSingle && isSinglePartition && !wasAllPartitionsPruned) {
+ if (descriptor.supportsMetadataCachePruning() &&
!wasAllPartitionsPruned) {
// if metadata cache file could potentially be used, then assign a
proper cacheFileRoot
- String path = "";
- for (int j = 0; j <= maxIndex; j++) {
- path += "/" + spInfo[j];
+ int index = -1;
+ if (!matchBitSet.isEmpty()) {
+ String path = "";
+ index = matchBitSet.length() - 1;
+
+ for (int j = 0; j < matchBitSet.length(); j++) {
+ if (!matchBitSet.get(j)) {
+ // stop at the first index with no match and use the
immediate
+ // previous index
+ index = j-1;
+ break;
+ }
+ }
+ for (int j=0; j <= index; j++) {
+ path += "/" + spInfo[j];
+ }
+ cacheFileRoot = descriptor.getBaseTableLocation() + path;
--- End diff --
Actually, cacheFileRoot can be null and ParquetGroupScan will default to
using the selectionRoot as the location of the cache file..here's where it
decides what to use:
https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java#L221
---
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.
---