diff --git a/avatica-server/pom.xml b/avatica-server/pom.xml index 52a2e5b8a0c3..6c340baed193 100644 --- a/avatica-server/pom.xml +++ b/avatica-server/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-avatica-server jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Avatica Server JDBC server. diff --git a/avatica/pom.xml b/avatica/pom.xml index 6d6c1339e528..1ad6136fa83f 100644 --- a/avatica/pom.xml +++ b/avatica/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-avatica jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Avatica JDBC driver framework. diff --git a/core/pom.xml b/core/pom.xml index 3e443ee9bbdc..962d867f9769 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-core jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Core Core Calcite APIs and engine. diff --git a/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java b/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java index 9de4762ed96a..dccaa6625ab5 100644 --- a/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java +++ b/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java @@ -25,18 +25,22 @@ import org.apache.calcite.util.graph.DirectedGraph; import org.apache.calcite.util.graph.Graphs; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import java.util.List; -import java.util.WeakHashMap; +import javax.annotation.Nonnull; /** * Definition of the the convention trait. * A new set of conversion information is created for * each planner that registers at least one {@link ConverterRule} instance. * - *

Conversion data is held in a {@link WeakHashMap} so that the JVM's garbage + *

Conversion data is held in a {@link LoadingCache} + * with weak keys so that the JVM's garbage * collector may reclaim the conversion data after the planner itself has been * garbage collected. The conversion information consists of a graph of * conversions (from one calling convention to another) and a map of graph arcs @@ -51,12 +55,16 @@ public class ConventionTraitDef extends RelTraitDef { //~ Instance fields -------------------------------------------------------- /** - * Weak-key map of RelOptPlanner to ConversionData. The idea is that when - * the planner goes away, so does the map entry. + * Weak-key cache of RelOptPlanner to ConversionData. The idea is that when + * the planner goes away, so does the cache entry. */ - private final WeakHashMap - plannerConversionMap = - new WeakHashMap(); + private final LoadingCache conversionCache = + CacheBuilder.newBuilder().weakKeys().build( + new CacheLoader() { + public ConversionData load(@Nonnull RelOptPlanner key) { + return new ConversionData(); + } + }); //~ Constructors ----------------------------------------------------------- @@ -198,13 +206,7 @@ public boolean canConvert( } private ConversionData getConversionData(RelOptPlanner planner) { - ConversionData conversionData = plannerConversionMap.get(planner); - if (conversionData == null) { - // Create new, empty ConversionData - conversionData = new ConversionData(); - plannerConversionMap.put(planner, conversionData); - } - return conversionData; + return conversionCache.getUnchecked(planner); } //~ Inner Classes ---------------------------------------------------------- diff --git a/core/src/main/java/org/apache/calcite/prepare/CalciteCatalogReader.java b/core/src/main/java/org/apache/calcite/prepare/CalciteCatalogReader.java index 75fca834b9e6..8348694b04a5 100644 --- a/core/src/main/java/org/apache/calcite/prepare/CalciteCatalogReader.java +++ b/core/src/main/java/org/apache/calcite/prepare/CalciteCatalogReader.java @@ -154,7 +154,7 @@ private Collection getFunctionsFrom(List names) { return functions2; } - private CalciteSchema getSchema(Iterable schemaNames) { + protected CalciteSchema getSchema(Iterable schemaNames) { CalciteSchema schema = rootSchema; for (String schemaName : schemaNames) { schema = schema.getSubSchema(schemaName, caseSensitive); diff --git a/example/csv/pom.xml b/example/csv/pom.xml index 9e125815a55a..453cff3f772f 100644 --- a/example/csv/pom.xml +++ b/example/csv/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite-example - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-example-csv jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Example CSV An example Calcite provider that reads CSV files diff --git a/example/pom.xml b/example/pom.xml index 9db037ebfe2d..c89b1c13f550 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -20,13 +20,13 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-example pom - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Examples Calcite examples diff --git a/linq4j/pom.xml b/linq4j/pom.xml index 5f61f5b5c39a..94e96ddf7e78 100644 --- a/linq4j/pom.xml +++ b/linq4j/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-linq4j jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Linq4j Calcite APIs for LINQ (Language-Integrated Query) in Java diff --git a/mongodb/pom.xml b/mongodb/pom.xml index 3bb5f9adac22..dff19b1de882 100644 --- a/mongodb/pom.xml +++ b/mongodb/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-mongodb jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite MongoDB MongoDB adapter for Calcite diff --git a/plus/pom.xml b/plus/pom.xml index dd5d8c4321ac..5d5c27b8f45a 100644 --- a/plus/pom.xml +++ b/plus/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-plus jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Plus Miscellaneous extras for Calcite diff --git a/pom.xml b/pom.xml index 1591e13e42eb..a301e3489418 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ limitations under the License. org.apache.calcite calcite pom - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite @@ -88,34 +88,34 @@ limitations under the License. org.apache.calcite calcite-avatica - 1.4.0-drill-r19 + 1.4.0-drill-r20-test org.apache.calcite calcite-avatica - 1.4.0-drill-r19 + 1.4.0-drill-r20-test test-jar org.apache.calcite calcite-avatica-server - 1.4.0-drill-r19 + 1.4.0-drill-r20-test org.apache.calcite calcite-core - 1.4.0-drill-r19 + 1.4.0-drill-r20-test org.apache.calcite calcite-core test-jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test org.apache.calcite calcite-linq4j - 1.4.0-drill-r19 + 1.4.0-drill-r20-test diff --git a/spark/pom.xml b/spark/pom.xml index ba9fd6138ff0..73a070737b08 100644 --- a/spark/pom.xml +++ b/spark/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-spark jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Spark diff --git a/splunk/pom.xml b/splunk/pom.xml index e14bafe20848..45ac0406e7af 100644 --- a/splunk/pom.xml +++ b/splunk/pom.xml @@ -20,12 +20,12 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test calcite-splunk jar - 1.4.0-drill-r19 + 1.4.0-drill-r20-test Calcite Splunk Splunk adapter for Calcite; also a JDBC driver for Splunk diff --git a/ubenchmark/pom.xml b/ubenchmark/pom.xml index 997252537be5..009b8be94abd 100644 --- a/ubenchmark/pom.xml +++ b/ubenchmark/pom.xml @@ -20,7 +20,7 @@ limitations under the License. org.apache.calcite calcite - 1.4.0-drill-r19 + 1.4.0-drill-r20-test