beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amaliu...@apache.org
Subject [beam] branch master updated: [SQL] Use reflection to instantiate planner.
Date Thu, 01 Aug 2019 22:56:47 GMT
This is an automated email from the ASF dual-hosted git repository.

amaliujia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new dd79f79  [SQL] Use reflection to instantiate planner.
     new 20bb131  Merge pull request #9221 from apilloud/sql-reflection
dd79f79 is described below

commit dd79f79ea37301167cdcbc3489fc33204cc80f56
Author: Andrew Pilloud <apilloud@google.com>
AuthorDate: Thu Aug 1 13:04:51 2019 -0700

    [SQL] Use reflection to instantiate planner.
---
 .../java/org/apache/beam/sdk/extensions/sql/impl/BeamSqlEnv.java | 9 ++-------
 .../apache/beam/sdk/extensions/sql/impl/CalciteQueryPlanner.java | 2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/BeamSqlEnv.java
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/BeamSqlEnv.java
index bcfeaf7..2da3f52 100644
--- a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/BeamSqlEnv.java
+++ b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/BeamSqlEnv.java
@@ -304,16 +304,11 @@ public class BeamSqlEnv {
     }
 
     private QueryPlanner instantiatePlanner(JdbcConnection jdbcConnection, RuleSet[] ruleSets)
{
-
-      if (queryPlannerClassName.equals(CALCITE_PLANNER)) {
-        return new CalciteQueryPlanner(jdbcConnection, ruleSets);
-      }
-
       try {
         return (QueryPlanner)
             Class.forName(queryPlannerClassName)
-                .getConstructor(JdbcConnection.class)
-                .newInstance(jdbcConnection);
+                .getConstructor(JdbcConnection.class, RuleSet[].class)
+                .newInstance(jdbcConnection, ruleSets);
       } catch (Exception e) {
         throw new RuntimeException(
             String.format("Cannot construct query planner %s", queryPlannerClassName), e);
diff --git a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/CalciteQueryPlanner.java
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/CalciteQueryPlanner.java
index 3d4e6ca..43428cf 100644
--- a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/CalciteQueryPlanner.java
+++ b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/CalciteQueryPlanner.java
@@ -67,7 +67,7 @@ class CalciteQueryPlanner implements QueryPlanner {
 
   private final Planner planner;
 
-  CalciteQueryPlanner(JdbcConnection connection, RuleSet[] ruleSets) {
+  public CalciteQueryPlanner(JdbcConnection connection, RuleSet[] ruleSets) {
     planner = Frameworks.getPlanner(defaultConfig(connection, ruleSets));
   }
 


Mime
View raw message