[ 
https://issues.apache.org/jira/browse/FLINK-5256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15722067#comment-15722067
 ] 

Fabian Hueske commented on FLINK-5256:
--------------------------------------

The query 

{code}
SELECT b, sum(a) FROM x GROUP BY b HAVING sum(a) > (SELECT sum(a) * 0.1 FROM x)
{code}

translates into the following logical plan 

{code}
LogicalProject(b=[$0], EXPR$1=[$1])
  LogicalFilter(condition=[>($1, $2)])
    LogicalJoin(condition=[true], joinType=[left])
      LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])
        LogicalProject(b=[$1], a=[$0])
          LogicalTableScan(table=[[x]])
      LogicalProject(EXPR$0=[*($0, 0.1)])
        LogicalAggregate(group=[{}], agg#0=[SUM($0)])
          LogicalProject(a=[$0])
            LogicalTableScan(table=[[x]])
{code}

The last join is a LeftJoin and joins a global aggregate with a grouped one.

> Extend DataSetSingleRowJoin to support Left and Right joins
> -----------------------------------------------------------
>
>                 Key: FLINK-5256
>                 URL: https://issues.apache.org/jira/browse/FLINK-5256
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>    Affects Versions: 1.2.0
>            Reporter: Fabian Hueske
>            Assignee: Alexander Shoshin
>
> The {{DataSetSingleRowJoin}} is a broadcast-map join that supports arbitrary 
> inner joins where one input is a single row.
> I found that Calcite translates certain subqueries into non-equi left and 
> right joins with single input. These cases can be handled if the  
> {{DataSetSingleRowJoin}} is extended to support outer joins on the 
> non-single-row input, i.e., left joins if the right side is single input and 
> vice versa.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to