You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lincoln-lil (via GitHub)" <gi...@apache.org> on 2023/08/24 01:25:12 UTC

[GitHub] [flink] lincoln-lil commented on a diff in pull request #23272: [FLINK-28866] Use DDL instead of legacy method to register the test s…

lincoln-lil commented on code in PR #23272:
URL: https://github.com/apache/flink/pull/23272#discussion_r1303682814


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/batch/sql/join/JoinITCase.scala:
##########
@@ -52,14 +53,83 @@ class JoinITCase extends BatchTestBase {
   @BeforeEach
   override def before(): Unit = {
     super.before()
-    registerCollection("SmallTable3", smallData3, type3, "a, b, c", nullablesOfSmallData3)
-    registerCollection("Table3", data3, type3, "a, b, c", nullablesOfData3)
-    registerCollection("Table5", data5, type5, "d, e, f, g, h", nullablesOfData5)
-    registerCollection("NullTable3", nullData3, type3, "a, b, c", nullablesOfNullData3)
-    registerCollection("NullTable5", nullData5, type5, "d, e, f, g, h", nullablesOfNullData5)
-    registerCollection("l", data2_1, INT_DOUBLE, "a, b")
-    registerCollection("r", data2_2, INT_DOUBLE, "c, d")
-    registerCollection("t", data2_3, INT_DOUBLE, "c, d", nullablesOfData2_3)
+    val smallData3Id = TestValuesTableFactory.registerData(smallData3)
+    val data3Id = TestValuesTableFactory.registerData(data3)
+    val nullData3Id = TestValuesTableFactory.registerData(nullData3)
+    val data5Id = TestValuesTableFactory.registerData(data5)
+    val nullData5Id = TestValuesTableFactory.registerData(nullData5)
+    val data21Id = TestValuesTableFactory.registerData(data2_1)
+    val data22Id = TestValuesTableFactory.registerData(data2_2)
+    val data23Id = TestValuesTableFactory.registerData(data2_3)
+
+    var ddl =
+      s"""CREATE TEMPORARY TABLE SmallTable3 (
+         | a int,
+         | b bigint,
+         | c string
+         |)WITH(
+         |  'connector' = 'values',
+         |  'data-id' = '$smallData3Id',
+         |  'bounded' = 'true'
+         |)
+         |""".stripMargin
+    tEnv.executeSql(ddl)

Review Comment:
   we can execute ddl directly thus ommiting the local variable and replacement
   ```
   tEnv.executeSql(s"""CREATE TEMPORARY TABLE SmallTable3 (
            | a int,
            | b bigint,
            | c string
            |)WITH(
            |  'connector' = 'values',
            |  'data-id' = '$smallData3Id',
            |  'bounded' = 'true'
            |)
            |""".stripMargin)
   ```



-- 
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-unsubscribe@flink.apache.org

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