drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinfengni <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-3623: Use shorter query path for LIMIT 0...
Date Wed, 28 Oct 2015 20:46:00 GMT
Github user jinfengni commented on a diff in the pull request:

    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/FindLimit0Visitor.java
    @@ -46,6 +51,32 @@ public static boolean containsLimit0(RelNode rel) {
         return visitor.isContains();
    +  public static DrillRel addLimitOnTopOfLeafNodes(final DrillRel rel) {
    +    final RelShuttleImpl shuttle = new RelShuttleImpl() {
    +      private RelNode addLimitAsParent(RelNode node) {
    +        final RexBuilder builder = node.getCluster().getRexBuilder();
    +        final RexLiteral offset = builder.makeExactLiteral(BigDecimal.ZERO);
    +        final RexLiteral fetch = builder.makeExactLiteral(BigDecimal.ZERO);
    +        return new DrillLimitRel(node.getCluster(), node.getTraitSet(), node, offset,
    --- End diff --
    I understand in your case, you only putDrillLimitRel. But you may want to make this Visitor
more general, such that it could create any kind of LimitRel, including DrillLimitRel, LogicalLimitRel,
DrillLimitPrel, etc. You can do that by define a LimitFactory, and pass to this Visitor. This's
similar to what other Calcite rule would do, to make the code more general. 

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message