Skip to content

Commit 3c827e9

Browse files
committed
Change SqlToRelConverter.config.withExpand
1 parent b3105d4 commit 3c827e9

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/CalciteQueryPlanner.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.sql.parser.SqlParser;
6060
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.sql.parser.SqlParserImplFactory;
6161
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.sql.util.SqlOperatorTables;
62+
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.sql2rel.SqlToRelConverter;
6263
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.tools.FrameworkConfig;
6364
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.tools.Frameworks;
6465
import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.tools.Planner;
@@ -141,6 +142,9 @@ public FrameworkConfig defaultConfig(JdbcConnection connection, Collection<RuleS
141142
final SqlOperatorTable opTab0 =
142143
connection.config().fun(SqlOperatorTable.class, SqlStdOperatorTable.instance());
143144

145+
// Revert the flag flip of CALCITE-3870 which led to missing rules
146+
SqlToRelConverter.Config sqlToRelConfig = SqlToRelConverter.config().withExpand(true);
147+
144148
return Frameworks.newConfigBuilder()
145149
.parserConfig(parserConfig.build())
146150
.defaultSchema(defaultSchema)
@@ -150,6 +154,7 @@ public FrameworkConfig defaultConfig(JdbcConnection connection, Collection<RuleS
150154
.costFactory(BeamCostModel.FACTORY)
151155
.typeSystem(connection.getTypeFactory().getTypeSystem())
152156
.operatorTable(SqlOperatorTables.chain(opTab0, catalogReader))
157+
.sqlToRelConverterConfig(sqlToRelConfig)
153158
.build();
154159
}
155160

sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/planner/BeamRuleSets.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class BeamRuleSets {
7272

7373
// push a filter into a join
7474
CoreRules.FILTER_INTO_JOIN,
75+
CoreRules.FILTER_SUB_QUERY_TO_CORRELATE,
7576
// push filter into the children of a join
7677
CoreRules.JOIN_CONDITION_PUSH,
7778
// push filter through an aggregation

0 commit comments

Comments
 (0)