[
https://issues.apache.org/jira/browse/CALCITE-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15634561#comment-15634561
]
Maryann Xue commented on CALCITE-1482:
--------------------------------------
+1 for the short term fix. And this is exactly what we are doing in Phoenix
right now.
The reason why we have to use hooks for Phoenix is that we only want to
register those secondary indices that can be potentially used by the query,
otherwise we would end up going through the entire Phoenix metadata to register
all existing secondary indices. Optimally we would like to have the "pull"
model vs. this "push" model, and to not have to go through any registration
process into a static MaterializationService instance at all. For example, we
could have an interface called {{getMaterializations(CalciteSchema
rootSchema)}} so that the adapter (Phoenix or Cassandra or anything else) can
provide a list of available materialization definitions and those definition
entries will be compiled by Calcite into constructs that can be used by the
query planner.
I guess the reason why we have MaterializationService as long-standing instance
is to be able to define and populate materializations. So I'm thinking to
actually decouple these two things, definition and population, and to have
MaterializationService dedicated to population only.
> Resource leak on creation of CassandraSchema
> --------------------------------------------
>
> Key: CALCITE-1482
> URL: https://issues.apache.org/jira/browse/CALCITE-1482
> Project: Calcite
> Issue Type: Bug
> Components: cassandra
> Affects Versions: 1.10.0
> Reporter: Michael Mior
> Assignee: Michael Mior
>
> Found via the following Coverity scan
> {noformat}
> *** CID 138163: Resource leaks (RESOURCE_LEAK)
> /cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java:
> 115 in
> org.apache.calcite.adapter.cassandra.CassandraSchema.<init>(java.lang.String,
> java.lang.String, java.lang.String, java.lang.String,
> org.apache.calcite.schema.SchemaPlus, java.lang.String)()
> 109 } catch (Exception e) {
> 110 throw new RuntimeException(e);
> 111 }
> 112 this.parentSchema = parentSchema;
> 113 this.name = name;
> 114
> >> CID 138163: Resource leaks (RESOURCE_LEAK)
> >> Ignoring resource created by
> >> "org.apache.calcite.runtime.Hook.TRIMMED.add(this.new
> >> org.apache.calcite.adapter.cassandra.CassandraSchema.1())" leaks it.
> 115 Hook.TRIMMED.add(new Function<RelNode, Void>() {
> 116 public Void apply(RelNode node) {
> 117 CassandraSchema.this.addMaterializedViews();
> 118 return null;
> 119 }
> 120 });
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)