sohami commented on a change in pull request #1417: DRILL-6645: Transform TopN
in Lateral Unnest pipeline to Sort and Limit.
URL: https://github.com/apache/drill/pull/1417#discussion_r207586797
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/TopNPrel.java
##########
@@ -115,6 +118,16 @@ public Prel addImplicitRowIDCol(List<RelNode> children) {
.replace(this.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE))
.replace(collationTrait)
.replace(DRILL_PHYSICAL);
- return (Prel) this.copy(traits, children);
+ return transformTopNToSortAndLimit(children, traits, collationTrait);
+ }
+
+ private Prel transformTopNToSortAndLimit(List<RelNode> children, RelTraitSet
traits, RelCollation collationTrait) {
+ SortPrel sortprel = new SortPrel(this.getCluster(), traits,
children.get(0), collationTrait);
+ RexNode offset =
this.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(0),
+
this.getCluster().getTypeFactory().createSqlType(SqlTypeName.INTEGER));
+ RexNode limit =
this.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(this.limit),
+
this.getCluster().getTypeFactory().createSqlType(SqlTypeName.INTEGER));
+ LimitPrel limitPrel = new LimitPrel(this.getCluster(), traits, sortprel,
offset, limit, false);
Review comment:
`LimitPrel` created here should be for `PartitionLimit` or will it be taken
care of in `LimitPrel::addImplicitRowIDCol` ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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