You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2017/02/15 20:47:19 UTC

[07/50] lucene-solr:master: Upgrade Avatica and Calcite. Fix NPE bug

Upgrade Avatica and Calcite. Fix NPE bug


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/28fb5855
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/28fb5855
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/28fb5855

Branch: refs/heads/master
Commit: 28fb5855f4529589ab2a9a19f8ba53ca4d9ac120
Parents: 3856ce4
Author: Kevin Risden <kr...@apache.org>
Authored: Mon Oct 31 10:14:09 2016 -0500
Committer: Kevin Risden <kr...@apache.org>
Committed: Tue Nov 1 11:19:48 2016 -0500

----------------------------------------------------------------------
 lucene/ivy-versions.properties                  |   4 +-
 .../config/CalciteConnectionProperty.java       | 182 -------------------
 .../org/apache/solr/handler/SQLHandler.java     |   2 +-
 .../solr/handler/sql/CalciteSolrDriver.java     |   4 +
 .../avatica-core-1.9.0-SNAPSHOT.jar.sha1        |   1 -
 solr/licenses/avatica-core-1.9.0.jar.sha1       |   1 +
 solr/licenses/calcite-core-1.10.0.jar.sha1      |   1 -
 .../calcite-core-1.11.0-SNAPSHOT.jar.sha1       |   1 +
 solr/licenses/calcite-linq4j-1.10.0.jar.sha1    |   1 -
 .../calcite-linq4j-1.11.0-SNAPSHOT.jar.sha1     |   1 +
 10 files changed, 10 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/lucene/ivy-versions.properties
----------------------------------------------------------------------
diff --git a/lucene/ivy-versions.properties b/lucene/ivy-versions.properties
index cf930ac..f42e701 100644
--- a/lucene/ivy-versions.properties
+++ b/lucene/ivy-versions.properties
@@ -99,8 +99,8 @@ io.netty.netty-all.version = 4.0.36.Final
 /org.apache.ant/ant = 1.8.2
 /org.apache.avro/avro = 1.7.5
 
-org.apache.calcite.version = 1.10.0
-org.apache.calcite.avatica.version = 1.9.0-SNAPSHOT
+org.apache.calcite.version = 1.11.0-SNAPSHOT
+org.apache.calcite.avatica.version = 1.9.0
 /org.apache.calcite.avatica/avatica-core = ${org.apache.calcite.avatica.version}
 /org.apache.calcite/calcite-core = ${org.apache.calcite.version}
 /org.apache.calcite/calcite-linq4j = ${org.apache.calcite.version}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/core/src/java/org/apache/calcite/config/CalciteConnectionProperty.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/calcite/config/CalciteConnectionProperty.java b/solr/core/src/java/org/apache/calcite/config/CalciteConnectionProperty.java
deleted file mode 100644
index b532c83..0000000
--- a/solr/core/src/java/org/apache/calcite/config/CalciteConnectionProperty.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.config;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.calcite.avatica.ConnectionProperty;
-import org.apache.calcite.avatica.util.Casing;
-import org.apache.calcite.avatica.util.Quoting;
-import org.apache.calcite.model.JsonSchema;
-import org.apache.calcite.sql.validate.SqlConformance;
-
-import static org.apache.calcite.avatica.ConnectionConfigImpl.PropEnv;
-import static org.apache.calcite.avatica.ConnectionConfigImpl.parse;
-
-/**
- * Properties that may be specified on the JDBC connect string.
- */
-public enum CalciteConnectionProperty implements ConnectionProperty {
-  /** Whether to store query results in temporary tables. */
-  AUTO_TEMP("autoTemp", Type.BOOLEAN, false, false),
-
-  /** Whether Calcite should use materializations. */
-  MATERIALIZATIONS_ENABLED("materializationsEnabled", Type.BOOLEAN, true,
-      false),
-
-  /** Whether Calcite should create materializations. */
-  CREATE_MATERIALIZATIONS("createMaterializations", Type.BOOLEAN, true, false),
-
-  /** How NULL values should be sorted if neither NULLS FIRST nor NULLS LAST are
-   * specified. The default, HIGH, sorts NULL values the same as Oracle. */
-  DEFAULT_NULL_COLLATION("defaultNullCollation", Type.ENUM, NullCollation.HIGH, NullCollation.class,
-      true),
-
-  /** How many rows the Druid adapter should fetch at a time when executing
-   * "select" queries. */
-  DRUID_FETCH("druidFetch", Type.NUMBER, 16384, false),
-
-  /** URI of the model. */
-  MODEL("model", Type.STRING, null, false),
-
-  /** Lexical policy. */
-  LEX("lex", Type.ENUM, Lex.ORACLE, Lex.class, false),
-
-  /** Collection of built-in functions and operators. Valid values include
-   * "standard" and "oracle". */
-  FUN("fun", Type.STRING, "standard", true),
-
-  /** How identifiers are quoted.
-   *  If not specified, value from {@link #LEX} is used. */
-  QUOTING("quoting", Type.ENUM, null, Quoting.class, false),
-
-  /** How identifiers are stored if they are quoted.
-   *  If not specified, value from {@link #LEX} is used. */
-  QUOTED_CASING("quotedCasing", Type.ENUM, null, Casing.class, false),
-
-  /** How identifiers are stored if they are not quoted.
-   *  If not specified, value from {@link #LEX} is used. */
-  UNQUOTED_CASING("unquotedCasing", Type.ENUM, null, Casing.class, false),
-
-  /** Whether identifiers are matched case-sensitively.
-   *  If not specified, value from {@link #LEX} is used. */
-  CASE_SENSITIVE("caseSensitive", Type.BOOLEAN, null, false),
-
-  /** Name of initial schema. */
-  SCHEMA("schema", Type.STRING, null, false),
-
-  /** Schema factory.
-   *
-   * <p>The name of a class that implements
-   * {@link org.apache.calcite.schema.SchemaFactory}.
-   *
-   * <p>Ignored if {@link #MODEL} is specified. */
-  SCHEMA_FACTORY("schemaFactory", Type.PLUGIN, null, false),
-
-  /** Schema type.
-   *
-   * <p>Value may be null, "MAP", "JDBC", or "CUSTOM"
-   * (implicit if {@link #SCHEMA_FACTORY} is specified).
-   * The value "NONE" is converted to null.
-   *
-   * <p>Ignored if {@link #MODEL} is specified. */
-  SCHEMA_TYPE("schemaType", Type.ENUM, JsonSchema.Type.NONE, JsonSchema.Type.class, false),
-
-  /** Specifies whether Spark should be used as the engine for processing that
-   * cannot be pushed to the source system. If false (the default), Calcite
-   * generates code that implements the Enumerable interface. */
-  SPARK("spark", Type.BOOLEAN, false, false),
-
-  /** Time zone, for example 'gmt-3'. Default is the JVM's time zone. */
-  TIME_ZONE("timeZone", Type.STRING, null, false),
-
-  /** If the planner should try de-correlating as much as it is possible.
-   * If true (the default), Calcite de-correlates the plan. */
-  FORCE_DECORRELATE("forceDecorrelate", Type.BOOLEAN, true, false),
-
-  /** Type system. The name of a class that implements
-   * {@link org.apache.calcite.rel.type.RelDataTypeSystem} and has a public
-   * default constructor or an {@code INSTANCE} constant. */
-  TYPE_SYSTEM("typeSystem", Type.PLUGIN, null, false),
-
-  /** SQL conformance level. */
-  CONFORMANCE("conformance", Type.ENUM, SqlConformance.DEFAULT, SqlConformance.class, false);
-
-  private final String camelName;
-  private final Type type;
-  private final Object defaultValue;
-  private final Class valueClass;
-  private final boolean required;
-
-  private static final Map<String, CalciteConnectionProperty> NAME_TO_PROPS;
-
-  /** Deprecated; use {@link #TIME_ZONE}. */
-  @Deprecated // to be removed before 2.0
-  public static final CalciteConnectionProperty TIMEZONE = TIME_ZONE;
-
-  static {
-    NAME_TO_PROPS = new HashMap<>();
-    for (CalciteConnectionProperty p : CalciteConnectionProperty.values()) {
-      NAME_TO_PROPS.put(p.camelName.toUpperCase(), p);
-      NAME_TO_PROPS.put(p.name(), p);
-    }
-  }
-
-  CalciteConnectionProperty(String camelName, Type type, Object defaultValue,
-                            boolean required) {
-    this(camelName, type, defaultValue, type.defaultValueClass(), required);
-  }
-
-  CalciteConnectionProperty(String camelName, Type type, Object defaultValue,
-                            Class valueClass, boolean required) {
-    this.camelName = camelName;
-    this.type = type;
-    this.defaultValue = defaultValue;
-    this.valueClass = valueClass;
-    this.required = required;
-    assert defaultValue == null || type.valid(defaultValue, valueClass);
-  }
-
-  public String camelName() {
-    return camelName;
-  }
-
-  public Object defaultValue() {
-    return defaultValue;
-  }
-
-  public Type type() {
-    return type;
-  }
-
-  public boolean required() {
-    return required;
-  }
-
-  public Class valueClass() {
-    return valueClass;
-  }
-
-  public PropEnv wrap(Properties properties) {
-    return new PropEnv(parse(properties, NAME_TO_PROPS), this);
-  }
-
-}
-
-// End CalciteConnectionProperty.java

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/core/src/java/org/apache/solr/handler/SQLHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/SQLHandler.java b/solr/core/src/java/org/apache/solr/handler/SQLHandler.java
index 61d0340..7b72a4c 100644
--- a/solr/core/src/java/org/apache/solr/handler/SQLHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/SQLHandler.java
@@ -101,7 +101,7 @@ public class SQLHandler extends RequestHandlerBase implements SolrCoreAware , Pe
         throw new Exception("stmt parameter cannot be null");
       }
 
-      String url = "jdbc:calcitesolr:";
+      String url = CalciteSolrDriver.CONNECT_STRING_PREFIX;
 
       Properties properties = new Properties();
       // Add all query parameters

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/core/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java b/solr/core/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
index 3dd30cc..3a7640d 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
@@ -47,6 +47,10 @@ public class CalciteSolrDriver extends Driver {
 
   @Override
   public Connection connect(String url, Properties info) throws SQLException {
+    if(!this.acceptsURL(url)) {
+      return null;
+    }
+
     Connection connection = super.connect(url, info);
     CalciteConnection calciteConnection = (CalciteConnection) connection;
     final SchemaPlus rootSchema = calciteConnection.getRootSchema();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/licenses/avatica-core-1.9.0-SNAPSHOT.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/avatica-core-1.9.0-SNAPSHOT.jar.sha1 b/solr/licenses/avatica-core-1.9.0-SNAPSHOT.jar.sha1
deleted file mode 100644
index 574e17b..0000000
--- a/solr/licenses/avatica-core-1.9.0-SNAPSHOT.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-bbddcaa253f82976cde4f7db115731e96a05c00a

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/licenses/avatica-core-1.9.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/avatica-core-1.9.0.jar.sha1 b/solr/licenses/avatica-core-1.9.0.jar.sha1
new file mode 100644
index 0000000..b44a615
--- /dev/null
+++ b/solr/licenses/avatica-core-1.9.0.jar.sha1
@@ -0,0 +1 @@
+c16b346eef02495f2f4b429fe04c33e526ec0229

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/licenses/calcite-core-1.10.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/calcite-core-1.10.0.jar.sha1 b/solr/licenses/calcite-core-1.10.0.jar.sha1
deleted file mode 100644
index 9ead56b..0000000
--- a/solr/licenses/calcite-core-1.10.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-06550935a70e0d503ae1a11a251066dbb1bc20bb

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/licenses/calcite-core-1.11.0-SNAPSHOT.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/calcite-core-1.11.0-SNAPSHOT.jar.sha1 b/solr/licenses/calcite-core-1.11.0-SNAPSHOT.jar.sha1
new file mode 100644
index 0000000..3cb15dd
--- /dev/null
+++ b/solr/licenses/calcite-core-1.11.0-SNAPSHOT.jar.sha1
@@ -0,0 +1 @@
+1f21f343b06236702bb8b5dad167374b7b13768b

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/licenses/calcite-linq4j-1.10.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/calcite-linq4j-1.10.0.jar.sha1 b/solr/licenses/calcite-linq4j-1.10.0.jar.sha1
deleted file mode 100644
index 16751a3..0000000
--- a/solr/licenses/calcite-linq4j-1.10.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-cb161081f3cca51d7a2089df746d771a8af2a577

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28fb5855/solr/licenses/calcite-linq4j-1.11.0-SNAPSHOT.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/calcite-linq4j-1.11.0-SNAPSHOT.jar.sha1 b/solr/licenses/calcite-linq4j-1.11.0-SNAPSHOT.jar.sha1
new file mode 100644
index 0000000..c1c9b39
--- /dev/null
+++ b/solr/licenses/calcite-linq4j-1.11.0-SNAPSHOT.jar.sha1
@@ -0,0 +1 @@
+2be11a01e467b25e6f8925e4dfa94a77ec9746dd