RocMarshal commented on a change in pull request #17613:
URL: https://github.com/apache/flink/pull/17613#discussion_r747186368



##########
File path: 
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/BangEqualITCase.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.planner.runtime.stream.sql
+
+import org.apache.flink.streaming.api.scala._
+import org.apache.flink.table.api.bridge.scala._
+import org.apache.flink.table.data.RowData
+import org.apache.flink.table.planner.runtime.utils.{StreamingTestBase, 
TestingAppendRowDataSink}
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo
+import org.apache.flink.table.types.logical.{IntType, VarCharType}
+
+import org.junit.Assert._
+import org.junit.Test
+
+class BangEqualITCase extends StreamingTestBase {

Review comment:
       Could you check the case in Batched mode ?

##########
File path: 
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/BangEqualITCase.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.planner.runtime.stream.sql
+
+import org.apache.flink.streaming.api.scala._
+import org.apache.flink.table.api.bridge.scala._
+import org.apache.flink.table.data.RowData
+import org.apache.flink.table.planner.runtime.utils.{StreamingTestBase, 
TestingAppendRowDataSink}
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo
+import org.apache.flink.table.types.logical.{IntType, VarCharType}
+
+import org.junit.Assert._
+import org.junit.Test
+
+class BangEqualITCase extends StreamingTestBase {
+
+  @Test
+  def testBangEqual(): Unit = {
+
+    val sqlQueryBangEqual =
+      """
+        |SELECT * FROM 
+        | (VALUES (1, 'Bob'), (1, 'Alice'), (2, 'Lily')) T(a, b)
+        |WHERE a != 2
+        |
+        |""".stripMargin
+
+    val sqlQueryUnEqual =
+      """
+        |SELECT * FROM 
+        | (VALUES (1, 'Bob'), (1, 'Alice'), (2, 'Lily')) T(a, b)
+        |WHERE a <> 2
+        |
+        |""".stripMargin
+
+    val outputType = InternalTypeInfo.ofFields(
+      new IntType(),
+      new VarCharType(5))
+
+    val result1 = tEnv.sqlQuery(sqlQueryBangEqual).toAppendStream[RowData]
+    val sink1 = new TestingAppendRowDataSink(outputType)
+    result1.addSink(sink1).setParallelism(1)
+
+    val result2 = tEnv.sqlQuery(sqlQueryUnEqual).toAppendStream[RowData]
+    val sink2 = new TestingAppendRowDataSink(outputType)
+    result2.addSink(sink2).setParallelism(1)
+
+    env.execute()
+
+    val expected = List("+I(1,Alice)", "+I(1,Bob)")

Review comment:
       It would be better if you could describe the table columns by 
TableFactoryHarness and describe the table result by Row instead of string, as 
mentioned from this 
[pr](https://github.com/apache/flink/pull/17352#discussion_r715626383) by 
@Airblader .
   

##########
File path: 
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/BangEqualITCase.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.planner.runtime.stream.sql
+
+import org.apache.flink.streaming.api.scala._
+import org.apache.flink.table.api.bridge.scala._
+import org.apache.flink.table.data.RowData
+import org.apache.flink.table.planner.runtime.utils.{StreamingTestBase, 
TestingAppendRowDataSink}
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo
+import org.apache.flink.table.types.logical.{IntType, VarCharType}
+
+import org.junit.Assert._
+import org.junit.Test
+
+class BangEqualITCase extends StreamingTestBase {
+
+  @Test
+  def testBangEqual(): Unit = {
+
+    val sqlQueryBangEqual =
+      """
+        |SELECT * FROM 
+        | (VALUES (1, 'Bob'), (1, 'Alice'), (2, 'Lily')) T(a, b)
+        |WHERE a != 2
+        |
+        |""".stripMargin
+
+    val sqlQueryUnEqual =
+      """
+        |SELECT * FROM 
+        | (VALUES (1, 'Bob'), (1, 'Alice'), (2, 'Lily')) T(a, b)
+        |WHERE a <> 2

Review comment:
       Would the sql statement be compressed  by extracting '<>' & '!=' into a 
local variable for reusing code ? 
   Or split the test case into two test cases, testBangEqual() & 
sqlQueryUnEqual().
   (only a minor comment.)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to