junwen12221 commented on issue #8284:
URL: https://github.com/apache/shardingsphere/issues/8284#issuecomment-735830336
@tristaZero
Generally, logical RelNode(`src\main\java\org\apache\calcite\rel\logical`)
starts from `org.apache.calcite.plan.Convention#NONE`,
for example:
```
public static LogicalTableScan create(RelOptCluster cluster,
final RelOptTable relOptTable, List<RelHint> hints) {
final Table table = relOptTable.unwrap(Table.class);
final RelTraitSet traitSet =
cluster.traitSetOf(Convention.NONE)
.replaceIfs(RelCollationTraitDef.INSTANCE, () -> {
if (table != null) {
return table.getStatistic().getCollations();
}
return ImmutableList.of();
});
return new LogicalTableScan(cluster, traitSet, hints, relOptTable);
}
```
Then it goes through the (rule) converter to transform into the another
RelNode with a new `org.apache.calcite.plan.Convention`,
The class that specializes in this conversion is
`org.apache.calcite.rel.convert.ConverterRule`.
So it is also a kind of `org.apache.calcite.plan.RelOptRule`.
org.apache.calcite.plan.RelRule ,a new class recently added, in order to
change the behavior of the rule through configuration.
You can see:
[CALCITE-3923](https://issues.apache.org/jira/browse/CALCITE-3923)
CoreRules also a new class recently added from refactor.Simply put, it sums
up the rules of
Classes in` src\main\java\org\apache\calcite\rel\logical`
Its input is logical RelNode, and its output is also logical RelNode,
they are all `Convention.NONE`. Unlike `ConverterRule` from one Convention
RelNode to another Convention RelNode.
According to the same idea, we can guess the purpose of
`org.apache.calcite.adapter.enumerable.EnumerableRules`,
It implements the conversion from `Convention.NONE` to
`EnumerableConvention.INSTANCE`.
EnumerableConvention is (EnumerableRel) ReNode of Calcite code generator
executor.
After the conversion is complete, you can use
`org.apache.calcite.adapter.enumerable.EnumerableRel#implemen`t to generate the
executor.
Despite all the above, they are actually some cases of`
org.apache.calcite.plan.RelOptRule`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]