xndai commented on a change in pull request #1884: [CALCITE-2970] Performance
issue when enabling abstract converter for EnumerableConvention
URL: https://github.com/apache/calcite/pull/1884#discussion_r399590406
##########
File path: core/src/main/java/org/apache/calcite/rel/RelCollationTraitDef.java
##########
@@ -61,18 +65,21 @@ public RelCollation getDefault() {
public RelNode convert(
RelOptPlanner planner,
+ RelBuilder builder,
RelNode rel,
RelCollation toCollation,
+ Convention toConvention,
boolean allowInfiniteCostConverters) {
if (toCollation.getFieldCollations().isEmpty()) {
// An empty sort doesn't make sense.
return null;
}
- // Create a logical sort, then ask the planner to convert its remaining
- // traits (e.g. convert it to an EnumerableSortRel if rel is enumerable
- // convention)
- final Sort sort = LogicalSort.create(rel, toCollation, null, null);
+ // Create a sort operator based on given convention
+ RelNode sort = builder.withConvention(toConvention)
Review comment:
I can create a RelBuilder here directly from the global RelBuilderFactory
singleton, eliminating this parameter. But the withConvention() method is
really convenient if you want to create RelNodes with different conventions
using a builder.
----------------------------------------------------------------
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]
With regards,
Apache Git Services