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 Fri, 29 Mar 2019 10:41:01 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_r270357208
 
 

 ##########
 File path: flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/batch/table/validation/CalcValidationTest.scala
 ##########
 @@ -128,4 +128,96 @@ class CalcValidationTest extends TableTestBase {
 
     table.select('a.flatten(), 'a.flatten())
   }
+
+  @Test
+  def testAddColumns(): Unit = {
+    val util = batchTestUtil()
+    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 = batchTestUtil()
+    val tab = util.addTable[(Int, Long, String)]("Table3",'a, 'b, 'c)
+
+    // Test aggregates
+    try {
 
 Review comment:
   I find that some of the test case using `expected=Exception` and some of the test case
using `try/cach`, so if test multi-case I like using `try/catch`, but I am fine if you want
to change it into `expected=Exception`. Do you also prefer using `expected=Exception`?

----------------------------------------------------------------
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