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

ASF GitHub Bot commented on FLINK-5520:
---------------------------------------

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3141#discussion_r96856944
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/batch/table/JoinITCase.scala
 ---
    @@ -234,7 +249,38 @@ class JoinITCase(
         TestBaseUtils.compareResultAsText(results.asJava, expected)
       }
     
    -  @Test
    +  @Test(expected = classOf[ValidationException])
    +  def testLeftJoinWithNotOnlyEquiJoin(): Unit = {
    +    val env: ExecutionEnvironment = 
ExecutionEnvironment.getExecutionEnvironment
    +    val tEnv = TableEnvironment.getTableEnvironment(env, config)
    +    tEnv.getConfig.setNullCheck(true)
    +
    +    val ds1 = CollectionDataSets.get3TupleDataSet(env).toTable(tEnv, 'a, 
'b, 'c)
    +    val ds2 = CollectionDataSets.get5TupleDataSet(env).toTable(tEnv, 'd, 
'e, 'f, 'g, 'h)
    +
    +    val joinT = ds1.leftOuterJoin(ds2, 'a === 'd && 'b < 'h).select('c, 'g)
    +
    +    val results = joinT.toDataSet[Row].collect()
    +  }
    +
    +  @Test(expected = classOf[ValidationException])
    +  def testFullJoinWithNotOnlyEquiJoin(): Unit = {
    +    val env: ExecutionEnvironment = 
ExecutionEnvironment.getExecutionEnvironment
    +    val tEnv = TableEnvironment.getTableEnvironment(env, config)
    +    tEnv.getConfig.setNullCheck(true)
    +
    +    val ds1 = CollectionDataSets.get3TupleDataSet(env).toTable(tEnv, 'a, 
'b, 'c)
    +    val ds2 = CollectionDataSets.get5TupleDataSet(env).toTable(tEnv, 'd, 
'e, 'f, 'g, 'h)
    +
    +    val joinT = ds1.fullOuterJoin(ds2, 'a === 'd && 'b < 'h).select('c, 'g)
    +
    +    val results = joinT.toDataSet[Row].collect()
    +  }
    +
    +
    --- End diff --
    
    Add tests to check that local predicates are not allowed in outer joins as 
well.


> Disable outer joins with non-equality predicates
> ------------------------------------------------
>
>                 Key: FLINK-5520
>                 URL: https://issues.apache.org/jira/browse/FLINK-5520
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.2.0
>            Reporter: Fabian Hueske
>            Assignee: lincoln.lee
>            Priority: Blocker
>             Fix For: 1.2.0
>
>
> Outer joins with non-equality predicates (and at least one equality 
> predicate) compute incorrect results. 
> Since this is not a very common requirement, I propose to disable this 
> feature for the 1.2.0 release and correctly implement it for a later version.
> The fix should add checks in the Table API validation phase (to get a good 
> error message) and in the DataSetJoinRule to prevent translation of SQL 
> queries with non-equality predicates on outer joins.



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

Reply via email to