drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject drill git commit: DRILL-4328: Fix backward compatibility regression caused by DRILL-4198
Date Sat, 30 Jan 2016 03:30:05 GMT
Repository: drill
Updated Branches:
  refs/heads/master 576271d52 -> 03197d0f2


DRILL-4328: Fix backward compatibility regression caused by DRILL-4198


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

Branch: refs/heads/master
Commit: 03197d0f2c665b7671b366332e1b4ebc2f271bd9
Parents: 576271d
Author: vkorukanti <venki.korukanti@gmail.com>
Authored: Thu Jan 28 14:54:05 2016 -0800
Committer: vkorukanti <venki.korukanti@gmail.com>
Committed: Fri Jan 29 10:26:51 2016 -0800

----------------------------------------------------------------------
 .../drill/exec/store/AbstractStoragePlugin.java | 25 ++++++++++++++++++--
 .../apache/drill/exec/store/StoragePlugin.java  |  8 +------
 .../exec/store/StoragePluginRegistryImpl.java   | 22 +++++++++++------
 3 files changed, 39 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/03197d0f/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java
index 4c428e1..d99c712 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java
@@ -48,14 +48,35 @@ public abstract class AbstractStoragePlugin implements StoragePlugin{
     return false;
   }
 
+  /**
+   * @deprecated Marking for deprecation in next major version release.
+   * Use {@link #getPhysicalOptimizerRules(org.apache.drill.exec.ops.OptimizerRulesContext)}
+   */
   @Override
+  @Deprecated
+  public Set<? extends RelOptRule> getOptimizerRules(OptimizerRulesContext optimizerContext)
{
+    return ImmutableSet.of();
+  }
+
+  /** An implementation of this method will return one or more specialized rules that Drill
query
+   *  optimizer can leverage in <i>logical</i> space. Otherwise, it should return
an empty set.
+   * @return an empty set or a set of plugin specific logical optimizer rules.
+   *
+   * Note: Move this method to {@link StoragePlugin} interface in next major version release.
+   */
   public Set<? extends RelOptRule> getLogicalOptimizerRules(OptimizerRulesContext optimizerContext)
{
     return ImmutableSet.of();
   }
 
-  @Override
+  /** An implementation of this method will return one or more specialized rules that Drill
query
+   *  optimizer can leverage in <i>physical</i> space. Otherwise, it should return
an empty set.
+   * @return an empty set or a set of plugin specific physical optimizer rules.
+   *
+   * Note: Move this method to {@link StoragePlugin} interface in next major version release.
+   */
   public Set<? extends RelOptRule> getPhysicalOptimizerRules(OptimizerRulesContext
optimizerRulesContext) {
-    return ImmutableSet.of();
+    // To be backward compatible, by default call the getOptimizerRules() method.
+    return getOptimizerRules(optimizerRulesContext);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/03197d0f/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java
index d0fbb34..574ae8c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java
@@ -43,16 +43,10 @@ public interface StoragePlugin extends SchemaFactory, AutoCloseable {
   public boolean supportsWrite();
 
   /** An implementation of this method will return one or more specialized rules that Drill
query
-   *  optimizer can leverage in <i>logical</i> space. Otherwise, it should return
an empty set.
-   * @return an empty set or a set of plugin specific logical optimizer rules.
-   */
-  public Set<? extends RelOptRule> getLogicalOptimizerRules(OptimizerRulesContext optimizerContext);
-
-  /** An implementation of this method will return one or more specialized rules that Drill
query
    *  optimizer can leverage in <i>physical</i> space. Otherwise, it should return
an empty set.
    * @return an empty set or a set of plugin specific physical optimizer rules.
    */
-  public Set<? extends RelOptRule> getPhysicalOptimizerRules(OptimizerRulesContext
optimizerContext);
+  public Set<? extends RelOptRule> getOptimizerRules(OptimizerRulesContext optimizerContext);
 
   /**
    * Get the physical scan operator for the particular GroupScan (read) node.

http://git-wip-us.apache.org/repos/asf/drill/blob/03197d0f/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
index a8628c7..aa9bf48 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
@@ -348,13 +348,21 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
     Builder<RelOptRule> logicalRulesBuilder = ImmutableSet.builder();
     Builder<RelOptRule> physicalRulesBuilder = ImmutableSet.builder();
     for (StoragePlugin plugin : this.plugins.plugins()) {
-      Set<? extends RelOptRule> rules = plugin.getLogicalOptimizerRules(optimizerRulesContext);
-      if (rules != null && rules.size() > 0) {
-        logicalRulesBuilder.addAll(rules);
-      }
-      rules = plugin.getPhysicalOptimizerRules(optimizerRulesContext);
-      if (rules != null && rules.size() > 0) {
-        physicalRulesBuilder.addAll(rules);
+      if (plugin instanceof AbstractStoragePlugin) {
+        final AbstractStoragePlugin abstractPlugin = (AbstractStoragePlugin) plugin;
+        Set<? extends RelOptRule> rules = abstractPlugin.getLogicalOptimizerRules(optimizerRulesContext);
+        if (rules != null && rules.size() > 0) {
+          logicalRulesBuilder.addAll(rules);
+        }
+        rules = abstractPlugin.getPhysicalOptimizerRules(optimizerRulesContext);
+        if (rules != null && rules.size() > 0) {
+          physicalRulesBuilder.addAll(rules);
+        }
+      } else {
+        final Set<? extends RelOptRule> rules = plugin.getOptimizerRules(optimizerRulesContext);
+        if (rules != null && rules.size() > 0) {
+          physicalRulesBuilder.addAll(rules);
+        }
       }
     }
 


Mime
View raw message