Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions avatica-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-avatica-server</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Avatica Server</name>
<description>JDBC server.</description>

Expand Down
4 changes: 2 additions & 2 deletions avatica/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-avatica</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Avatica</name>
<description>JDBC driver framework.</description>

Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-core</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Core</name>
<description>Core Calcite APIs and engine.</description>

Expand Down
30 changes: 16 additions & 14 deletions core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>Conversion data is held in a {@link WeakHashMap} so that the JVM's garbage
* <p>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
Expand All @@ -51,12 +55,16 @@ public class ConventionTraitDef extends RelTraitDef<Convention> {
//~ 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<RelOptPlanner, ConversionData>
plannerConversionMap =
new WeakHashMap<RelOptPlanner, ConversionData>();
private final LoadingCache<RelOptPlanner, ConversionData> conversionCache =
CacheBuilder.newBuilder().weakKeys().build(
new CacheLoader<RelOptPlanner, ConversionData>() {
public ConversionData load(@Nonnull RelOptPlanner key) {
return new ConversionData();
}
});

//~ Constructors -----------------------------------------------------------

Expand Down Expand Up @@ -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 ----------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private Collection<Function> getFunctionsFrom(List<String> names) {
return functions2;
}

private CalciteSchema getSchema(Iterable<String> schemaNames) {
protected CalciteSchema getSchema(Iterable<String> schemaNames) {
CalciteSchema schema = rootSchema;
for (String schemaName : schemaNames) {
schema = schema.getSubSchema(schemaName, caseSensitive);
Expand Down
4 changes: 2 additions & 2 deletions example/csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-example</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-example-csv</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Example CSV</name>
<description>An example Calcite provider that reads CSV files</description>

Expand Down
4 changes: 2 additions & 2 deletions example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<!-- The basics. -->
<artifactId>calcite-example</artifactId>
<packaging>pom</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Examples</name>
<description>Calcite examples</description>

Expand Down
4 changes: 2 additions & 2 deletions linq4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-linq4j</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Linq4j</name>
<description>Calcite APIs for LINQ (Language-Integrated Query) in Java</description>

Expand Down
4 changes: 2 additions & 2 deletions mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-mongodb</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite MongoDB</name>
<description>MongoDB adapter for Calcite</description>

Expand Down
4 changes: 2 additions & 2 deletions plus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-plus</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Plus</name>
<description>Miscellaneous extras for Calcite</description>

Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ limitations under the License.
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<packaging>pom</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>

<!-- More project information. -->
<name>Calcite</name>
Expand Down Expand Up @@ -88,34 +88,34 @@ limitations under the License.
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-avatica</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-avatica</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-avatica-server</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<type>test-jar</type>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-linq4j</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</dependency>

<!-- Now third-party dependencies, sorted by groupId and artifactId. -->
Expand Down
4 changes: 2 additions & 2 deletions spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-spark</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Spark</name>

<properties>
Expand Down
4 changes: 2 additions & 2 deletions splunk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<artifactId>calcite-splunk</artifactId>
<packaging>jar</packaging>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
<name>Calcite Splunk</name>
<description>Splunk adapter for Calcite; also a JDBC driver for Splunk</description>

Expand Down
2 changes: 1 addition & 1 deletion ubenchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
<parent>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite</artifactId>
<version>1.4.0-drill-r19</version>
<version>1.4.0-drill-r20-test</version>
</parent>

<properties>
Expand Down