You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by arina-ielchiieva <gi...@git.apache.org> on 2017/08/08 10:23:50 UTC

[GitHub] drill pull request #889: DRILL-5691: enhance scalar sub queries checking for...

Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/889#discussion_r131870863
  
    --- 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;
    --- End diff --
    
    ` agg = (DrillAggregateRel) currentRel;`


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