[ https://issues.apache.org/jira/browse/FLINK-6094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121705#comment-16121705 ]
ASF GitHub Bot commented on FLINK-6094: --------------------------------------- Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/4471#discussion_r132303241 --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/stream/table/validation/JoinValidationTest.scala --- @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.api.stream.table.validation + +import org.apache.flink.api.scala._ +import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment +import org.apache.flink.table.api.{TableEnvironment, TableException, ValidationException} +import org.apache.flink.table.api.scala._ +import org.apache.flink.table.runtime.utils.StreamTestData +import org.apache.flink.table.utils.TableTestBase +import org.apache.flink.types.Row +import org.junit.Test + +class JoinValidationTest extends TableTestBase { + + private val util = streamTestUtil() + private val ds1 = util.addTable[(Int, Long, String)]("Table3",'a, 'b, 'c) + private val ds2 = util.addTable[(Int, Long, Int, String, Long)]("Table5", 'd, 'e, 'f, 'g, 'h) + + @Test(expected = classOf[ValidationException]) + def testJoinNonExistingKey(): Unit = { + ds1.join(ds2) + // must fail. Field 'foo does not exist + .where('foo === 'e) + .select('c, 'g) + } + + @Test(expected = classOf[ValidationException]) + def testJoinWithNonMatchingKeyTypes(): Unit = { + ds1.join(ds2) + // must fail. Field 'a is Int, and 'g is String + .where('a === 'g) + .select('c, 'g) + } + + + @Test(expected = classOf[ValidationException]) + def testJoinWithAmbiguousFields(): Unit = { + ds1.join(ds2.select('d, 'e, 'f, 'g, 'h as 'c)) + // must fail. Both inputs share the same field 'c + .where('a === 'd) + .select('c, 'g) + } + + @Test(expected = classOf[TableException]) + def testNoEqualityJoinPredicate1(): Unit = { + ds1.join(ds2) + // must fail. No equality join predicate + .where('d === 'f) + .select('c, 'g) + .toDataSet[Row] + } + + @Test(expected = classOf[TableException]) + def testNoEqualityJoinPredicate2(): Unit = { + ds1.join(ds2) + // must fail. No equality join predicate + .where('a < 'd) + .select('c, 'g) + .toDataSet[Row] --- End diff -- replace `toDataSet` call by `toRetractStream[Row]` > Implement stream-stream proctime non-window inner join > ------------------------------------------------------- > > Key: FLINK-6094 > URL: https://issues.apache.org/jira/browse/FLINK-6094 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL > Reporter: Shaoxuan Wang > Assignee: Hequn Cheng > > This includes: > 1.Implement stream-stream proctime non-window inner join > 2.Implement the retract process logic for join -- This message was sent by Atlassian JIRA (v6.4.14#64029)