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

Fabian Hueske commented on FLINK-5255:
--------------------------------------

Hmm, the Calcite documentation states that the rules are not applied in a 
specific order but explore the whole plan space.
I looked a bit into it but could not get a plan with a {{LogicalCalc}} as input 
of the join either.

Finally, I changed {{isSingleRow}} as follows such that it can be called on 
{{join.getLeft()}} and {{join.getRight()}}: 

{code}
private def isSingleRow(node: RelNode): Boolean = {

    node match {
      case ss: RelSubset => isSingleRow(ss.getOriginal)
      case lp: LogicalProject => isSingleRow(lp.getInput)
      case lf: LogicalFilter => isSingleRow(lf.getInput) // only if empty input 
is supported
      case lc: LogicalCalc => isSingleRow(lc.getInput)
      case la: LogicalAggregate => la.getGroupSet.isEmpty
      case _ => false
    }
  }
{code}



> Improve single row check in DataSetSingleRowJoinRule
> ----------------------------------------------------
>
>                 Key: FLINK-5255
>                 URL: https://issues.apache.org/jira/browse/FLINK-5255
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>    Affects Versions: 1.2.0
>            Reporter: Fabian Hueske
>            Assignee: Alexander Shoshin
>
> {{DataSetSingleRowJoinRule}} checks converts an arbitrary inner join (cross, 
> theta, equi) where one input has exactly one row into a broadcast-map join.
> Currently, the condition to check for the single row is that the input of the 
> join must be a global aggregation. The check fails if the input is a 
> {{LogicalCalc}} followed by {{LogicalAggregate}}.
> Hence, the following query cannot be executed:
> {code}
> SELECT absum, x.a
> FROM x, (SELECT a.sum + b.sum AS absum FROM y)
> {code}
> The single row check should be extended to accept a {{LogicalCalc}} that has 
> no condition {{(RexProgram.getCondition() == null)}}.



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

Reply via email to