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-2633: The visitors PreProcessLogicalRel and UnsupportedOperatorsVisitor are made as instances (non-static)
Date Tue, 31 Mar 2015 22:48:34 GMT
Repository: drill
Updated Branches:
  refs/heads/master 417ad38f7 -> 064fc0265


DRILL-2633: The visitors PreProcessLogicalRel and UnsupportedOperatorsVisitor are made as
instances (non-static)


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

Branch: refs/heads/master
Commit: 064fc026561716f76f3548d35df602bac7a2d67c
Parents: 417ad38
Author: Hsuan-Yi Chu <hsuanyi@usc.edu>
Authored: Tue Mar 31 12:57:22 2015 -0700
Committer: Hsuan-Yi Chu <hsuanyi@usc.edu>
Committed: Tue Mar 31 14:47:52 2015 -0700

----------------------------------------------------------------------
 .../exec/planner/logical/PreProcessLogicalRel.java   | 15 ++-------------
 .../exec/planner/sql/handlers/DefaultSqlHandler.java |  5 ++---
 .../sql/parser/UnsupportedOperatorsVisitor.java      |  6 ++----
 3 files changed, 6 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/064fc026/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/PreProcessLogicalRel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/PreProcessLogicalRel.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/PreProcessLogicalRel.java
index 9e76611..60aa1da 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/PreProcessLogicalRel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/PreProcessLogicalRel.java
@@ -54,20 +54,9 @@ public class PreProcessLogicalRel extends RelShuttleImpl {
   private RelDataTypeFactory factory;
   private DrillOperatorTable table;
   private UnsupportedOperatorCollector unsupportedOperatorCollector;
-  private static PreProcessLogicalRel INSTANCE = null;
 
-  public static void initialize(RelDataTypeFactory factory, DrillOperatorTable table) {
-    if(INSTANCE == null) {
-      INSTANCE = new PreProcessLogicalRel(factory, table);
-    }
-  }
-
-  public static PreProcessLogicalRel getVisitor() {
-    if(INSTANCE == null) {
-      throw new IllegalStateException("PreProcessLogicalRel is not initialized properly");
-    }
-
-    return INSTANCE;
+  public static PreProcessLogicalRel createVisitor(RelDataTypeFactory factory, DrillOperatorTable
table) {
+    return new PreProcessLogicalRel(factory, table);
   }
 
   private PreProcessLogicalRel(RelDataTypeFactory factory, DrillOperatorTable table) {

http://git-wip-us.apache.org/repos/asf/drill/blob/064fc026/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
index e908538..37003f1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
@@ -157,7 +157,7 @@ public class DefaultSqlHandler extends AbstractSqlHandler {
     SqlNode sqlNodeValidated = planner.validate(sqlNode);
 
     // Check if the unsupported functionality is used
-    UnsupportedOperatorsVisitor visitor = UnsupportedOperatorsVisitor.getVisitor();
+    UnsupportedOperatorsVisitor visitor = UnsupportedOperatorsVisitor.createVisitor();
     try {
       sqlNodeValidated.accept(visitor);
     } catch (UnsupportedOperationException ex) {
@@ -189,8 +189,7 @@ public class DefaultSqlHandler extends AbstractSqlHandler {
      * throw SqlUnsupportedException if there is
      */
 
-     PreProcessLogicalRel.initialize(planner.getTypeFactory(), context.getDrillOperatorTable());
-     PreProcessLogicalRel visitor =  PreProcessLogicalRel.getVisitor();
+     PreProcessLogicalRel visitor = PreProcessLogicalRel.createVisitor(planner.getTypeFactory(),
context.getDrillOperatorTable());
      try {
         rel = rel.accept(visitor);
      } catch(UnsupportedOperationException ex) {

http://git-wip-us.apache.org/repos/asf/drill/blob/064fc026/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
index 46fb925..81734dc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
@@ -46,16 +46,14 @@ public class UnsupportedOperatorsVisitor extends SqlShuttle {
     disabledOperators.add("CARDINALITY");
   }
 
-  private static UnsupportedOperatorsVisitor visitor = new UnsupportedOperatorsVisitor();
-
   private UnsupportedOperatorCollector unsupportedOperatorCollector;
 
   private UnsupportedOperatorsVisitor() {
     unsupportedOperatorCollector = new UnsupportedOperatorCollector();
   }
 
-  public static UnsupportedOperatorsVisitor getVisitor() {
-    return visitor;
+  public static UnsupportedOperatorsVisitor createVisitor() {
+    return new UnsupportedOperatorsVisitor();
   }
 
   public void convertException() throws SqlUnsupportedException {


Mime
View raw message