Skip to content
Permalink
Browse files
IGNITE-16738 Add trait definitions to the EMPTY_CONTEXT and to the si…
…ngleton empty CLUSTER (#805)
  • Loading branch information
tledkov-gridgain committed May 12, 2022
1 parent 9221b5a commit e461879e8bdc7c72d9a30c0729fc64f07733e341
Showing 2 changed files with 18 additions and 1 deletion.
@@ -158,7 +158,6 @@ public void testInConditionWithSubquery() {
}

@Test
@Disabled("https://issues.apache.org/jira/browse/IGNITE-16738")
public void testDistinctQueryWithInConditionWithSubquery() {
var rows = sql("SELECT distinct(name) FROM emp1 o WHERE name IN ("
+ " SELECT name"
@@ -31,10 +31,13 @@
import org.apache.calcite.config.CalciteConnectionProperty;
import org.apache.calcite.jdbc.CalciteSchema;
import org.apache.calcite.plan.Contexts;
import org.apache.calcite.plan.ConventionTraitDef;
import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelOptSchema;
import org.apache.calcite.plan.RelTraitDef;
import org.apache.calcite.plan.volcano.VolcanoPlanner;
import org.apache.calcite.prepare.CalciteCatalogReader;
import org.apache.calcite.rel.RelCollationTraitDef;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.metadata.Metadata;
import org.apache.calcite.rel.metadata.MetadataDef;
@@ -48,6 +51,9 @@
import org.apache.calcite.tools.Frameworks;
import org.apache.ignite.internal.sql.engine.QueryCancel;
import org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory;
import org.apache.ignite.internal.sql.engine.trait.CorrelationTraitDef;
import org.apache.ignite.internal.sql.engine.trait.DistributionTraitDef;
import org.apache.ignite.internal.sql.engine.trait.RewindabilityTraitDef;
import org.apache.ignite.internal.sql.engine.type.IgniteTypeFactory;
import org.apache.ignite.internal.util.ArrayUtils;
import org.apache.ignite.lang.IgniteLogger;
@@ -94,6 +100,11 @@ public void registerSchema(RelOptSchema schema) {
}
};

// Dummy planner must contain all trait definitions to create singleton cluster with all default traits.
for (RelTraitDef<?> def : EMPTY_CONTEXT.config().getTraitDefs()) {
DUMMY_PLANNER.addRelTraitDef(def);
}

RelDataTypeSystem typeSys = CALCITE_CONNECTION_CONFIG.typeSystem(RelDataTypeSystem.class, FRAMEWORK_CONFIG.getTypeSystem());
TYPE_FACTORY = new IgniteTypeFactory(typeSys);

@@ -249,6 +260,13 @@ public static class Builder {
private static final FrameworkConfig EMPTY_CONFIG =
Frameworks.newConfigBuilder(FRAMEWORK_CONFIG)
.defaultSchema(createRootSchema(false))
.traitDefs(new RelTraitDef<?>[] {
ConventionTraitDef.INSTANCE,
RelCollationTraitDef.INSTANCE,
DistributionTraitDef.INSTANCE,
RewindabilityTraitDef.INSTANCE,
CorrelationTraitDef.INSTANCE,
})
.build();

private FrameworkConfig frameworkCfg = EMPTY_CONFIG;

0 comments on commit e461879

Please sign in to comment.