flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] sunjincheng121 commented on a change in pull request #8057: [FLINK-12028][table] Add `addColumns`,`renameColumns`, `dropColumns` …
Date Thu, 28 Mar 2019 06:44:02 GMT
sunjincheng121 commented on a change in pull request #8057: [FLINK-12028][table] Add `addColumns`,`renameColumns`,
`dropColumns` …
URL: https://github.com/apache/flink/pull/8057#discussion_r269872958
 
 

 ##########
 File path: flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/stream/table/validation/CalcValidationTest.scala
 ##########
 @@ -46,4 +47,88 @@ class CalcValidationTest extends TableTestBase {
     .groupBy('w)
     .select('w.end.rowtime, 'int.count as 'int) // no rowtime on non-window reference
   }
+
+  @Test
+  def testAddColumns(): Unit = {
+    val util = streamTestUtil()
+    val tab = util.addTable[(Int, Long, String)]("Table3",'a, 'b, 'c)
+
+    // Test aggregates
+    try {
+      tab.addColumns('a.sum)
+      fail("TableException expected")
+    } catch {
+      case _: TableException => //ignore
+    }
+
+    // Test replace the existing column, but do not with the alias.
+    try {
+      tab.addColumns(true, concat('c, "Sunny"))
+      fail("TableException expected")
+    } catch {
+      case _: TableException => //ignore
+    }
+
+  }
+
+  @Test
+  def testRenameColumns(): Unit = {
+    val util = streamTestUtil()
+    val tab = util.addTable[(Int, Long, String)]("Table3",'a, 'b, 'c)
+
+    // Test aggregates
+    try {
+      tab.renameColumns('a.sum)
+      fail("TableException expected")
+    } catch {
+      case _: TableException => //ignore
+    }
+
+    // Test without alias case.
+    try {
+      tab.renameColumns('a)
+      fail("TableException expected")
+    } catch {
+      case _: TableException => //ignore
+    }
+
+    // Test for fields that do not exist
+    try {
+      tab.renameColumns('e)
 
 Review comment:
   I think line 97 has test the field which not exist case. but i should add the alias. what
do you think?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message