dianfu commented on a change in pull request #8311: [FLINK-10976][table] Add 
Aggregate operator to Table API
URL: https://github.com/apache/flink/pull/8311#discussion_r281001183
 
 

 ##########
 File path: 
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/stream/table/validation/AggregateValidationTest.scala
 ##########
 @@ -47,4 +47,54 @@ class AggregateValidationTest extends TableTestBase {
       // must fail. 'c is not a grouping key or aggregation
       .select('c)
   }
+
+  @Test(expected = classOf[ValidationException])
+  def testTableFunctionInSelection(): Unit = {
+    val util = streamTestUtil()
+    val table = util.addTable[(Long, Int, String)]('a, 'b, 'c)
+
+    util.tableEnv.registerFunction("func", new TableFunc0)
+    table
+      .groupBy('a)
+      .aggregate('b.sum as 'd)
+      // must fail. Cannot use TableFunction in select after aggregate
+      .select("func(a)")
+  }
+
+  @Test(expected = classOf[ValidationException])
+  def testInvalidExpressionInAggregate(): Unit = {
+    val util = streamTestUtil()
+    val table = util.addTable[(Long, Int, String)]('a, 'b, 'c)
+
+    table
+      .groupBy('a)
+      // must fail. Only AggregateFunction can be used in aggregate
 
 Review comment:
   The exception message is not friendly for users:
   org.apache.flink.table.api.ValidationException: Invalid arguments [log(b), 
'd'] for function: as

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to