drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arina-ielchiieva <...@git.apache.org>
Subject [GitHub] drill pull request #889: DRILL-5691: enhance scalar sub queries checking for...
Date Tue, 08 Aug 2017 10:23:50 GMT
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/889#discussion_r131870970
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java
---
    @@ -204,24 +205,28 @@ public static void addLeastRestrictiveCasts(LogicalExpression[]
leftExpressions,
     
       /**
        * Utility method to check if a subquery (represented by its root RelNode) is provably
scalar. Currently
    -   * only aggregates with no group-by are considered scalar. In the future, this method
should be generalized
    -   * to include more cases and reconciled with Calcite's notion of scalar.
    +   * only aggregates with no group-by and sub input rel with one row are considered scalar.
In the future,
    +   * this method should be generalized to include more cases and reconciled with Calcite's
notion of scalar.
        * @param root The root RelNode to be examined
        * @return True if the root rel or its descendant is scalar, False otherwise
        */
       public static boolean isScalarSubquery(RelNode root) {
         DrillAggregateRel agg = null;
    -    RelNode currentrel = root;
    -    while (agg == null && currentrel != null) {
    -      if (currentrel instanceof DrillAggregateRel) {
    -        agg = (DrillAggregateRel)currentrel;
    -      } else if (currentrel instanceof RelSubset) {
    -        currentrel = ((RelSubset)currentrel).getBest() ;
    -      } else if (currentrel.getInputs().size() == 1) {
    +    RelNode currentRel = root;
    +    boolean hasMoreInputs = false;
    +    while (agg == null && currentRel != null) {
    +      if (currentRel instanceof DrillAggregateRel) {
    +        agg = (DrillAggregateRel)currentRel;
    +      } else if (currentRel instanceof RelSubset) {
    +        currentRel = ((RelSubset)currentRel).getBest() ;
    --- End diff --
    
    `currentRel = ((RelSubset) currentRel).getBest() ;`


---
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.
---

Mime
View raw message