You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/07/28 10:30:36 UTC
[GitHub] [ignite] korlov42 opened a new pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
korlov42 opened a new pull request #9282:
URL: https://github.com/apache/ignite/pull/9282
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
### The Contribution Checklist
- [ ] There is a single JIRA ticket related to the pull request.
- [ ] The web-link to the pull request is attached to the JIRA ticket.
- [ ] The JIRA ticket has the _Patch Available_ state.
- [ ] The pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
- [ ] The pull request title is treated as the final commit message.
The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] zstan commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r680886272
##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTest.java
##########
@@ -89,504 +85,20 @@
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.thread.IgniteStripedThreadPoolExecutor;
-import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import org.junit.Test;
import static org.apache.calcite.tools.Frameworks.createRootSchema;
import static org.apache.calcite.tools.Frameworks.newConfigBuilder;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.FRAMEWORK_CONFIG;
-import static org.apache.ignite.internal.processors.query.calcite.externalize.RelJsonWriter.toJson;
/**
*
*/
//@WithSystemProperty(key = "calcite.debug", value = "true")
@SuppressWarnings({"TooBroadScope", "FieldCanBeLocal", "TypeMayBeWeakened"})
public class PlannerTest extends AbstractPlannerTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLogicalPlan() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " +
- "FROM PUBLIC.Developer d JOIN (" +
- "SELECT pp.id as id0, pp.ver as ver0 FROM PUBLIC.Project pp" +
- ") p " +
- "ON d.projectId = p.id0 + 1" +
- "WHERE (d.projectId + 1) > ?";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLogicalPlanDefaultSchema() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " +
- "FROM Developer d JOIN (" +
- "SELECT pp.id as id0, pp.ver as ver0 FROM Project pp" +
- ") p " +
- "ON d.projectId = p.id0 " +
- "WHERE (d.projectId + 1) > ?";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCorrelatedQuery() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, (SELECT p.name FROM Project p WHERE p.id = d.id) name, d.projectId " +
- "FROM Developer d";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testHepPlaner() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- @Override public IgniteIndex getIndex(String idxName) {
- return new IgniteIndex(null, null, null, null) {
- @Override public <Row> Iterable<Row> scan(
- ExecutionContext<Row> execCtx,
- ColocationGroup group,
- Predicate<Row> filters,
- Supplier<Row> lowerIdxConditions,
- Supplier<Row> upperIdxConditions,
- Function<Row, Row> rowTransformer,
- @Nullable ImmutableBitSet requiredColumns
- ) {
- return Linq4j.asEnumerable(Arrays.asList(
- row(execCtx, requiredColumns, 0, "Igor", 0),
- row(execCtx, requiredColumns, 1, "Roman", 0)
- ));
- }
- };
- }
-
- @Override public ColocationGroup colocationGroup(PlanningContext ctx) {
- return ColocationGroup.forAssignments(Arrays.asList(
- select(nodes, 0, 1),
- select(nodes, 1, 2),
- select(nodes, 2, 0),
- select(nodes, 0, 1),
- select(nodes, 1, 2)
- ));
- }
-
- @Override public IgniteDistribution distribution() {
- return IgniteDistributions.affinity(0, "Developer", "hash");
- }
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- @Override public IgniteIndex getIndex(String idxName) {
- return new IgniteIndex(null, null, null, null) {
- @Override public <Row> Iterable<Row> scan(
- ExecutionContext<Row> execCtx,
- ColocationGroup group,
- Predicate<Row> filters,
- Supplier<Row> lowerIdxConditions,
- Supplier<Row> upperIdxConditions,
- Function<Row, Row> rowTransformer,
- @Nullable ImmutableBitSet requiredColumns
- ) {
- return Linq4j.asEnumerable(Arrays.asList(
- row(execCtx, requiredColumns, 0, "Calcite", 1),
- row(execCtx, requiredColumns, 1, "Ignite", 1)
- ));
- }
- };
- }
-
- @Override public ColocationGroup colocationGroup(PlanningContext ctx) {
- return ColocationGroup.forAssignments(Arrays.asList(
- select(nodes, 0, 1),
- select(nodes, 1, 2),
- select(nodes, 2, 0),
- select(nodes, 0, 1),
- select(nodes, 1, 2)
- ));
- }
-
- @Override public IgniteDistribution distribution() {
- return IgniteDistributions.affinity(0, "Project", "hash");
- }
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " +
- "FROM PUBLIC.Developer d JOIN (" +
- "SELECT pp.id as id0, pp.ver as ver0 FROM PUBLIC.Project pp" +
- ") p " +
- "ON d.projectId = p.id0 " +
- "WHERE (d.projectId + 1) > ?";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
-
- RelNode rel = relRoot.rel;
-
- // Transformation chain
- rel = planner.transform(PlannerPhase.HEURISTIC_OPTIMIZATION, rel.getTraitSet(), rel);
-
- relRoot = relRoot.withRel(rel).withKind(sqlNode.getKind());
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testVolcanoPlanerDistributed() throws Exception {
Review comment:
I found that you remove a lot of tests, can u explain why we don`t need them any more ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r681709647
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/LogicalScanConverterRule.java
##########
@@ -71,7 +106,23 @@
RelMetadataQuery mq,
IgniteLogicalTableScan rel
) {
- RelTraitSet traits = rel.getTraitSet().replace(IgniteConvention.INSTANCE);
+ RelOptCluster cluster = rel.getCluster();
+ IgniteTable table = rel.getTable().unwrap(IgniteTable.class);
+
+ RelDistribution distribution = table.distribution();
+ if (rel.requiredColumns() != null) {
+ Mappings.TargetMapping mapping = createMapping(
+ rel.projects(),
+ rel.requiredColumns(),
+ table.getRowType(cluster.getTypeFactory()).getFieldCount()
+ );
+
+ distribution = distribution.apply(mapping);
+ }
+
+ RelTraitSet traits = cluster.traitSetOf(IgniteConvention.INSTANCE)
Review comment:
before this patch the traits partially were set for logical rels and transitively were applied to the physical rels. Now the traits are created for physical rels only
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r680985442
##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/ProjectScanMergeRuleTest.java
##########
@@ -122,7 +121,7 @@ public void testProjects() {
.check();
checkQuery("SELECT NAME FROM products d WHERE CAT_ID > 1;")
- .matches(containsIndexScan("PUBLIC", "PRODUCTS"))
+ .matches(containsAnyScan("PUBLIC", "PRODUCTS"))
Review comment:
This particular test class is intended to verify ProjectScanMergeRule. See no reason to verify the index choosing, especially on the data set of 4 rows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r679868856
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteTableImpl.java
##########
@@ -107,21 +108,32 @@ public IgniteTableImpl(GridKernalContext ctx, TableDescriptor desc) {
}
/** {@inheritDoc} */
- @Override public IgniteLogicalTableScan toRel(RelOptCluster cluster, RelOptTable relOptTbl) {
- RelTraitSet traitSet = cluster.traitSetOf(distribution())
- .replace(RewindabilityTrait.REWINDABLE);
-
- return IgniteLogicalTableScan.create(cluster, traitSet, relOptTbl, null, null, null);
+ @Override public boolean rewindable() {
+ return true;
}
/** {@inheritDoc} */
- @Override public IgniteLogicalIndexScan toRel(RelOptCluster cluster, RelOptTable relOptTbl, String idxName) {
- RelTraitSet traitSet = cluster.traitSetOf(Convention.Impl.NONE)
- .replace(distribution())
- .replace(RewindabilityTrait.REWINDABLE)
- .replace(getIndex(idxName).collation());
+ @Override public IgniteLogicalTableScan toRel(
+ RelOptCluster cluster,
+ RelOptTable relOptTbl,
+ @Nullable List<RexNode> proj,
+ @Nullable RexNode cond,
+ @Nullable ImmutableBitSet requiredColumns
+ ) {
+ return IgniteLogicalTableScan.create(cluster, cluster.traitSet(), relOptTbl, proj, cond, requiredColumns);
+ }
- return IgniteLogicalIndexScan.create(cluster, traitSet, relOptTbl, idxName, null, null, null);
+ /** {@inheritDoc} */
+ @Override public IgniteLogicalIndexScan toRel(
+ RelOptCluster cluster,
+ RelOptTable relOptTbl,
+ String idxName,
+ @Nullable List<RexNode> proj,
+ @Nullable RexNode cond,
+ @Nullable ImmutableBitSet requiredColumns
+ ) {
+
Review comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] zstan commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r680842832
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteIndex.java
##########
@@ -59,6 +59,11 @@ public RelCollation collation() {
return collation;
}
+ /** */
+ public boolean rewindable() {
Review comment:
i surprised, what does it mean in case of class usage ? Also no inheritance found why do we need such a property here ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] zstan commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r680849562
##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/ProjectScanMergeRuleTest.java
##########
@@ -122,7 +121,7 @@ public void testProjects() {
.check();
checkQuery("SELECT NAME FROM products d WHERE CAT_ID > 1;")
- .matches(containsIndexScan("PUBLIC", "PRODUCTS"))
+ .matches(containsAnyScan("PUBLIC", "PRODUCTS"))
Review comment:
i broke this tests and i hope no need to fix them in a such a way, if we have possibility to obtain here TasbleScan - seems we have a problem )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r681691273
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteIndex.java
##########
@@ -59,6 +59,11 @@ public RelCollation collation() {
return collation;
}
+ /** */
+ public boolean rewindable() {
Review comment:
in private discussion @zstan have convinced me to get rid of this property
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r679869486
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PlannerPhase.java
##########
@@ -70,13 +70,70 @@
*/
public enum PlannerPhase {
/** */
- HEURISTIC_OPTIMIZATION("Heuristic optimization phase") {
+ HEP_DECORRELATE("Heuristic phase to decorrelate subqueries") {
/** {@inheritDoc} */
@Override public RuleSet getRules(PlanningContext ctx) {
return RuleSets.ofList(
CoreRules.FILTER_SUB_QUERY_TO_CORRELATE,
CoreRules.PROJECT_SUB_QUERY_TO_CORRELATE,
- CoreRules.JOIN_SUB_QUERY_TO_CORRELATE);
+ CoreRules.JOIN_SUB_QUERY_TO_CORRELATE
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override public Program getProgram(PlanningContext ctx) {
+ return hep(getRules(ctx));
+ }
+ },
+
+ /** */
+ HEP_FILTER_PUSH_DOWN("Heuristic phase to push down filters") {
+ /** {@inheritDoc} */
+ @Override public RuleSet getRules(PlanningContext ctx) {
+ return RuleSets.ofList(
+ CoreRules.FILTER_MERGE,
+ CoreRules.FILTER_AGGREGATE_TRANSPOSE,
+ CoreRules.FILTER_SET_OP_TRANSPOSE,
+ CoreRules.JOIN_CONDITION_PUSH,
+
+ FilterIntoJoinRule.Config.DEFAULT
+ .withOperandSupplier(b0 ->
+ b0.operand(LogicalFilter.class).oneInput(b1 ->
+ b1.operand(LogicalJoin.class).anyInputs())).toRule(),
+
+ FilterProjectTransposeRule.Config.DEFAULT
+ .withOperandFor(LogicalFilter.class, f -> true, LogicalProject.class, p -> true).toRule()
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override public Program getProgram(PlanningContext ctx) {
+ return hep(getRules(ctx));
+ }
+ },
+
+ /** */
+ HEP_PROJECT_PUSH_DOWN("Heuristic phase to push down and merge projects") {
+ /** {@inheritDoc} */
+ @Override public RuleSet getRules(PlanningContext ctx) {
+ return RuleSets.ofList(
+ ProjectScanMergeRule.TABLE_SCAN_SKIP_CORRELATED,
+ ProjectScanMergeRule.INDEX_SCAN_SKIP_CORRELATED,
+
+ CoreRules.JOIN_PUSH_EXPRESSIONS,
+
+ ProjectFilterTransposeRule.Config.DEFAULT
+ .withOperandFor(LogicalProject.class, LogicalFilter.class).toRule(),
+
+ ProjectMergeRule.Config.DEFAULT
+ .withOperandFor(LogicalProject.class).toRule(),
+
+ ProjectRemoveRule.Config.DEFAULT
+ .withOperandSupplier(b ->
+ b.operand(LogicalProject.class)
+ .predicate(ProjectRemoveRule::isTrivial)
+ .anyInputs()).toRule()
Review comment:
Good catch! Replaced with core rules for HEP phase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r681714924
##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTest.java
##########
@@ -89,504 +85,20 @@
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.thread.IgniteStripedThreadPoolExecutor;
-import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import org.junit.Test;
import static org.apache.calcite.tools.Frameworks.createRootSchema;
import static org.apache.calcite.tools.Frameworks.newConfigBuilder;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.FRAMEWORK_CONFIG;
-import static org.apache.ignite.internal.processors.query.calcite.externalize.RelJsonWriter.toJson;
/**
*
*/
//@WithSystemProperty(key = "calcite.debug", value = "true")
@SuppressWarnings({"TooBroadScope", "FieldCanBeLocal", "TypeMayBeWeakened"})
public class PlannerTest extends AbstractPlannerTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLogicalPlan() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " +
- "FROM PUBLIC.Developer d JOIN (" +
- "SELECT pp.id as id0, pp.ver as ver0 FROM PUBLIC.Project pp" +
- ") p " +
- "ON d.projectId = p.id0 + 1" +
- "WHERE (d.projectId + 1) > ?";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLogicalPlanDefaultSchema() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " +
- "FROM Developer d JOIN (" +
- "SELECT pp.id as id0, pp.ver as ver0 FROM Project pp" +
- ") p " +
- "ON d.projectId = p.id0 " +
- "WHERE (d.projectId + 1) > ?";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCorrelatedQuery() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, (SELECT p.name FROM Project p WHERE p.id = d.id) name, d.projectId " +
- "FROM Developer d";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testHepPlaner() throws Exception {
- IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
-
- TestTable developer = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("PROJECTID", f.createJavaType(Integer.class))
- .build()) {
- @Override public IgniteIndex getIndex(String idxName) {
- return new IgniteIndex(null, null, null, null) {
- @Override public <Row> Iterable<Row> scan(
- ExecutionContext<Row> execCtx,
- ColocationGroup group,
- Predicate<Row> filters,
- Supplier<Row> lowerIdxConditions,
- Supplier<Row> upperIdxConditions,
- Function<Row, Row> rowTransformer,
- @Nullable ImmutableBitSet requiredColumns
- ) {
- return Linq4j.asEnumerable(Arrays.asList(
- row(execCtx, requiredColumns, 0, "Igor", 0),
- row(execCtx, requiredColumns, 1, "Roman", 0)
- ));
- }
- };
- }
-
- @Override public ColocationGroup colocationGroup(PlanningContext ctx) {
- return ColocationGroup.forAssignments(Arrays.asList(
- select(nodes, 0, 1),
- select(nodes, 1, 2),
- select(nodes, 2, 0),
- select(nodes, 0, 1),
- select(nodes, 1, 2)
- ));
- }
-
- @Override public IgniteDistribution distribution() {
- return IgniteDistributions.affinity(0, "Developer", "hash");
- }
- };
-
- TestTable project = new TestTable(
- new RelDataTypeFactory.Builder(f)
- .add("ID", f.createJavaType(Integer.class))
- .add("NAME", f.createJavaType(String.class))
- .add("VER", f.createJavaType(Integer.class))
- .build()) {
- @Override public IgniteIndex getIndex(String idxName) {
- return new IgniteIndex(null, null, null, null) {
- @Override public <Row> Iterable<Row> scan(
- ExecutionContext<Row> execCtx,
- ColocationGroup group,
- Predicate<Row> filters,
- Supplier<Row> lowerIdxConditions,
- Supplier<Row> upperIdxConditions,
- Function<Row, Row> rowTransformer,
- @Nullable ImmutableBitSet requiredColumns
- ) {
- return Linq4j.asEnumerable(Arrays.asList(
- row(execCtx, requiredColumns, 0, "Calcite", 1),
- row(execCtx, requiredColumns, 1, "Ignite", 1)
- ));
- }
- };
- }
-
- @Override public ColocationGroup colocationGroup(PlanningContext ctx) {
- return ColocationGroup.forAssignments(Arrays.asList(
- select(nodes, 0, 1),
- select(nodes, 1, 2),
- select(nodes, 2, 0),
- select(nodes, 0, 1),
- select(nodes, 1, 2)
- ));
- }
-
- @Override public IgniteDistribution distribution() {
- return IgniteDistributions.affinity(0, "Project", "hash");
- }
- };
-
- IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
-
- publicSchema.addTable("DEVELOPER", developer);
- publicSchema.addTable("PROJECT", project);
-
- SchemaPlus schema = createRootSchema(false)
- .add("PUBLIC", publicSchema);
-
- String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " +
- "FROM PUBLIC.Developer d JOIN (" +
- "SELECT pp.id as id0, pp.ver as ver0 FROM PUBLIC.Project pp" +
- ") p " +
- "ON d.projectId = p.id0 " +
- "WHERE (d.projectId + 1) > ?";
-
- RelTraitDef<?>[] traitDefs = {
- ConventionTraitDef.INSTANCE
- };
-
- PlanningContext ctx = PlanningContext.builder()
- .localNodeId(F.first(nodes))
- .originatingNodeId(F.first(nodes))
- .parentContext(Contexts.empty())
- .frameworkConfig(newConfigBuilder(FRAMEWORK_CONFIG)
- .defaultSchema(schema)
- .traitDefs(traitDefs)
- .build())
- .logger(log)
- .query(sql)
- .parameters(2)
- .topologyVersion(AffinityTopologyVersion.NONE)
- .build();
-
- RelRoot relRoot;
-
- try (IgnitePlanner planner = ctx.planner()) {
- assertNotNull(planner);
-
- String qry = ctx.query();
-
- assertNotNull(qry);
-
- // Parse
- SqlNode sqlNode = planner.parse(qry);
-
- // Validate
- sqlNode = planner.validate(sqlNode);
-
- // Convert to Relational operators graph
- relRoot = planner.rel(sqlNode);
-
- RelNode rel = relRoot.rel;
-
- // Transformation chain
- rel = planner.transform(PlannerPhase.HEURISTIC_OPTIMIZATION, rel.getTraitSet(), rel);
-
- relRoot = relRoot.withRel(rel).withKind(sqlNode.getKind());
- }
-
- assertNotNull(relRoot.rel);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testVolcanoPlanerDistributed() throws Exception {
Review comment:
All removed tests were verifying that planner could provide any result different from NULL. I don't think these tests have any value, since now we have extended out test coverage with lots of different tests that verifies every particular feature and uses a much smarter assertions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r679868755
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java
##########
@@ -51,8 +53,7 @@ public ExposeIndexRule(Config config) {
/** */
private static boolean preMatch(IgniteLogicalTableScan scan) {
- return scan.simple() // was not modified by ProjectScanMergeRule or FilterScanMergeRule
Review comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] zstan commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r680880979
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/LogicalScanConverterRule.java
##########
@@ -71,7 +106,23 @@
RelMetadataQuery mq,
IgniteLogicalTableScan rel
) {
- RelTraitSet traits = rel.getTraitSet().replace(IgniteConvention.INSTANCE);
+ RelOptCluster cluster = rel.getCluster();
+ IgniteTable table = rel.getTable().unwrap(IgniteTable.class);
+
+ RelDistribution distribution = table.distribution();
+ if (rel.requiredColumns() != null) {
+ Mappings.TargetMapping mapping = createMapping(
+ rel.projects(),
+ rel.requiredColumns(),
+ table.getRowType(cluster.getTypeFactory()).getFieldCount()
+ );
+
+ distribution = distribution.apply(mapping);
+ }
+
+ RelTraitSet traits = cluster.traitSetOf(IgniteConvention.INSTANCE)
Review comment:
uhu ! u found ANY distribution source ?)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] zstan closed pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
zstan closed pull request #9282:
URL: https://github.com/apache/ignite/pull/9282
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r679147830
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PlannerPhase.java
##########
@@ -70,13 +70,70 @@
*/
public enum PlannerPhase {
/** */
- HEURISTIC_OPTIMIZATION("Heuristic optimization phase") {
+ HEP_DECORRELATE("Heuristic phase to decorrelate subqueries") {
/** {@inheritDoc} */
@Override public RuleSet getRules(PlanningContext ctx) {
return RuleSets.ofList(
CoreRules.FILTER_SUB_QUERY_TO_CORRELATE,
CoreRules.PROJECT_SUB_QUERY_TO_CORRELATE,
- CoreRules.JOIN_SUB_QUERY_TO_CORRELATE);
+ CoreRules.JOIN_SUB_QUERY_TO_CORRELATE
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override public Program getProgram(PlanningContext ctx) {
+ return hep(getRules(ctx));
+ }
+ },
+
+ /** */
+ HEP_FILTER_PUSH_DOWN("Heuristic phase to push down filters") {
+ /** {@inheritDoc} */
+ @Override public RuleSet getRules(PlanningContext ctx) {
+ return RuleSets.ofList(
+ CoreRules.FILTER_MERGE,
+ CoreRules.FILTER_AGGREGATE_TRANSPOSE,
+ CoreRules.FILTER_SET_OP_TRANSPOSE,
+ CoreRules.JOIN_CONDITION_PUSH,
+
+ FilterIntoJoinRule.Config.DEFAULT
+ .withOperandSupplier(b0 ->
+ b0.operand(LogicalFilter.class).oneInput(b1 ->
+ b1.operand(LogicalJoin.class).anyInputs())).toRule(),
+
+ FilterProjectTransposeRule.Config.DEFAULT
+ .withOperandFor(LogicalFilter.class, f -> true, LogicalProject.class, p -> true).toRule()
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override public Program getProgram(PlanningContext ctx) {
+ return hep(getRules(ctx));
+ }
+ },
+
+ /** */
+ HEP_PROJECT_PUSH_DOWN("Heuristic phase to push down and merge projects") {
+ /** {@inheritDoc} */
+ @Override public RuleSet getRules(PlanningContext ctx) {
+ return RuleSets.ofList(
+ ProjectScanMergeRule.TABLE_SCAN_SKIP_CORRELATED,
+ ProjectScanMergeRule.INDEX_SCAN_SKIP_CORRELATED,
+
+ CoreRules.JOIN_PUSH_EXPRESSIONS,
+
+ ProjectFilterTransposeRule.Config.DEFAULT
+ .withOperandFor(LogicalProject.class, LogicalFilter.class).toRule(),
+
+ ProjectMergeRule.Config.DEFAULT
+ .withOperandFor(LogicalProject.class).toRule(),
+
+ ProjectRemoveRule.Config.DEFAULT
+ .withOperandSupplier(b ->
+ b.operand(LogicalProject.class)
+ .predicate(ProjectRemoveRule::isTrivial)
+ .anyInputs()).toRule()
Review comment:
Why can't we use `CoreRules` instances for these rules? It looks like `CoreRules` instances have the same configuration as here. For some rules extended operand is used in core rules, for example, `Project` instead of `LogicalProject`, but as far as I understand `LogicalProject` is the only type of `Project` available on this phase. The same for `HEP_FILTER_PUSH_DOWN`.
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteTableImpl.java
##########
@@ -107,21 +108,32 @@ public IgniteTableImpl(GridKernalContext ctx, TableDescriptor desc) {
}
/** {@inheritDoc} */
- @Override public IgniteLogicalTableScan toRel(RelOptCluster cluster, RelOptTable relOptTbl) {
- RelTraitSet traitSet = cluster.traitSetOf(distribution())
- .replace(RewindabilityTrait.REWINDABLE);
-
- return IgniteLogicalTableScan.create(cluster, traitSet, relOptTbl, null, null, null);
+ @Override public boolean rewindable() {
+ return true;
}
/** {@inheritDoc} */
- @Override public IgniteLogicalIndexScan toRel(RelOptCluster cluster, RelOptTable relOptTbl, String idxName) {
- RelTraitSet traitSet = cluster.traitSetOf(Convention.Impl.NONE)
- .replace(distribution())
- .replace(RewindabilityTrait.REWINDABLE)
- .replace(getIndex(idxName).collation());
+ @Override public IgniteLogicalTableScan toRel(
+ RelOptCluster cluster,
+ RelOptTable relOptTbl,
+ @Nullable List<RexNode> proj,
+ @Nullable RexNode cond,
+ @Nullable ImmutableBitSet requiredColumns
+ ) {
+ return IgniteLogicalTableScan.create(cluster, cluster.traitSet(), relOptTbl, proj, cond, requiredColumns);
+ }
- return IgniteLogicalIndexScan.create(cluster, traitSet, relOptTbl, idxName, null, null, null);
+ /** {@inheritDoc} */
+ @Override public IgniteLogicalIndexScan toRel(
+ RelOptCluster cluster,
+ RelOptTable relOptTbl,
+ String idxName,
+ @Nullable List<RexNode> proj,
+ @Nullable RexNode cond,
+ @Nullable ImmutableBitSet requiredColumns
+ ) {
+
Review comment:
Redundant NL
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java
##########
@@ -51,8 +53,7 @@ public ExposeIndexRule(Config config) {
/** */
private static boolean preMatch(IgniteLogicalTableScan scan) {
- return scan.simple() // was not modified by ProjectScanMergeRule or FilterScanMergeRule
Review comment:
It was the only usage of the `simple()` method, perhaps this method should be removed too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] korlov42 commented on a change in pull request #9282: IGNITE-15203 Calcite. Extract Filter and Project related rules to separate HEP phase
Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #9282:
URL: https://github.com/apache/ignite/pull/9282#discussion_r680982086
##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteIndex.java
##########
@@ -59,6 +59,11 @@ public RelCollation collation() {
return collation;
}
+ /** */
+ public boolean rewindable() {
Review comment:
To make it similar to the IgniteTable interface. You could override this in tests if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org