drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [1/9] drill git commit: DRILL-5394: Optimize query planning for MapR-DB tables by caching row counts
Date Mon, 03 Apr 2017 05:12:01 GMT
Repository: drill
Updated Branches:
  refs/heads/master 841ead401 -> d3718a62e


DRILL-5394: Optimize query planning for MapR-DB tables by caching row counts

close #802


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/e03d7f9b
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/e03d7f9b
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/e03d7f9b

Branch: refs/heads/master
Commit: e03d7f9b1ac510ccee909b42653ee9b9ca3d69b1
Parents: 841ead4
Author: Padma Penumarthy <ppenumar97@yahoo.com>
Authored: Thu Mar 16 11:40:13 2017 -0700
Committer: Jinfeng Ni <jni@apache.org>
Committed: Fri Mar 31 15:31:40 2017 -0700

----------------------------------------------------------------------
 .../store/mapr/db/MapRDBPushFilterIntoScan.java |  4 +++-
 .../mapr/db/binary/BinaryTableGroupScan.java    | 20 ++++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/e03d7f9b/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/MapRDBPushFilterIntoScan.java
----------------------------------------------------------------------
diff --git a/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/MapRDBPushFilterIntoScan.java
b/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/MapRDBPushFilterIntoScan.java
index 6a286a8..b363262 100644
--- a/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/MapRDBPushFilterIntoScan.java
+++ b/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/MapRDBPushFilterIntoScan.java
@@ -184,8 +184,10 @@ public abstract class MapRDBPushFilterIntoScan extends StoragePluginOptimizerRul
       return; //no filter pushdown ==> No transformation.
     }
 
+    // Pass tableStats from old groupScan so we do not go and fetch stats (an expensive operation)
again from MapR DB client.
     final BinaryTableGroupScan newGroupsScan = new BinaryTableGroupScan(groupScan.getUserName(),
groupScan.getStoragePlugin(),
-                                                              groupScan.getFormatPlugin(),
newScanSpec, groupScan.getColumns());
+                                                                        groupScan.getFormatPlugin(),
newScanSpec, groupScan.getColumns(),
+                                                                        groupScan.getTableStats());
     newGroupsScan.setFilterPushedDown(true);
 
     final ScanPrel newScanPrel = ScanPrel.create(scan, filter.getTraitSet(), newGroupsScan,
scan.getRowType());

http://git-wip-us.apache.org/repos/asf/drill/blob/e03d7f9b/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/binary/BinaryTableGroupScan.java
----------------------------------------------------------------------
diff --git a/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/binary/BinaryTableGroupScan.java
b/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/binary/BinaryTableGroupScan.java
index 4eaeee7..c298456 100644
--- a/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/binary/BinaryTableGroupScan.java
+++ b/contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/binary/BinaryTableGroupScan.java
@@ -89,6 +89,15 @@ public class BinaryTableGroupScan extends MapRDBGroupScan implements DrillHBaseC
     init();
   }
 
+  public BinaryTableGroupScan(String userName, FileSystemPlugin storagePlugin,
+                              MapRDBFormatPlugin formatPlugin, HBaseScanSpec scanSpec,
+                              List<SchemaPath> columns, MapRDBTableStats tableStats)
{
+    super(storagePlugin, formatPlugin, columns, userName);
+    this.hbaseScanSpec = scanSpec;
+    this.tableStats = tableStats;
+    init();
+  }
+
   /**
    * Private constructor, used for cloning.
    * @param that The HBaseGroupScan to clone
@@ -115,8 +124,10 @@ public class BinaryTableGroupScan extends MapRDBGroupScan implements
DrillHBaseC
     try (Admin admin = formatPlugin.getConnection().getAdmin();
          RegionLocator locator = formatPlugin.getConnection().getRegionLocator(tableName))
{
       hTableDesc = admin.getTableDescriptor(tableName);
-      tableStats = new MapRDBTableStats(getHBaseConf(), hbaseScanSpec.getTableName());
-
+      // Fetch tableStats only once and cache it.
+      if (tableStats == null) {
+        tableStats = new MapRDBTableStats(getHBaseConf(), hbaseScanSpec.getTableName());
+      }
       boolean foundStartRegion = false;
       regionsToScan = new TreeMap<TabletFragmentInfo, String>();
       List<HRegionLocation> regionLocations = locator.getAllRegionLocations();
@@ -197,6 +208,11 @@ public class BinaryTableGroupScan extends MapRDBGroupScan implements
DrillHBaseC
     return getHBaseScanSpec().getTableName();
   }
 
+  @JsonIgnore
+  public MapRDBTableStats getTableStats() {
+    return tableStats;
+  }
+
   @Override
   public String toString() {
     return "BinaryTableGroupScan [ScanSpec="


Mime
View raw message