luoyuxia commented on code in PR #21927:
URL: https://github.com/apache/flink/pull/21927#discussion_r1217441125


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/CalcITCase.scala:
##########
@@ -366,6 +366,24 @@ class CalcITCase extends StreamingTestBase {
     sink.getAppendResults.foreach(result => assertEquals(expected, result))
   }
 
+  @Test
+  def testIfFunction(): Unit = {
+
+    implicit val typeInfo: TypeInformation[Row] =

Review Comment:
   The test will fail, 
   ```
   org.apache.flink.table.api.ValidationException: SQL validation failed. At 
line 1, column 11: Column 'a' not found in any table
        at 
org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$validate(FlinkPlannerImpl.scala:187)
        at 
org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:113)
   ```
   how about using 
   ```
       val testDataId = TestValuesTableFactory.registerData(TestData.data1)
       val ddl =
         s"""
            |CREATE TABLE t (
            |  a int,
            |  b varchar,
            |  c int
            |) WITH (
            |  'connector' = 'values',
            |  'data-id' = '$testDataId',
            |  'bounded' = 'true'
            |)
          """.stripMargin
       tEnv.executeSql(ddl)
       val expected = List("false,1", "false,2", "false,3", "true,4", "true,5", 
"true,6")
       val actual = tEnv
         .executeSql("SELECT IF(a > 3, 'true', 'false'), a from t")
         .collect()
         .map(r => r.toString)
         .toList
       assertEquals(expected.sorted, actual.sorted)
   ```?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to