snuyanzin commented on code in PR #30059:
URL: https://github.com/apache/flink/pull/30059#discussion_r4659089454


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/FunctionITCase.java:
##########
@@ -1783,6 +1801,25 @@ void testAggregateFunction() throws Exception {
         assertThat(TestCollectionTableFactory.getResult()).isEqualTo(sinkData);
     }
 
+    @Test
+    void testCatalogAggregateFunctionsWithSameNameInDifferentDatabases() {
+        TestCollectionTableFactory.reset();
+        TestCollectionTableFactory.initData(List.of(Row.of("Bob")));
+
+        tEnv().executeSql("CREATE DATABASE db1");
+        tEnv().executeSql("CREATE DATABASE db2");
+        tEnv().createFunction("db1.agg", LongestStringAggregateFunction.class);
+        tEnv().createFunction("db2.agg", RawMapViewAggregateFunction.class);
+        tEnv().executeSql("CREATE TABLE SourceTable (s STRING) WITH 
('connector' = 'COLLECTION')");
+
+        final List<Row> actual =
+                CollectionUtil.iteratorToList(
+                        tEnv().executeSql("SELECT db1.agg(s), db2.agg(s) FROM 
SourceTable")
+                                .collect());
+
+        assertThat(actual).containsExactly(Row.of("Bob", "Bob=(Bob, 3)"));

Review Comment:
   please take a look at other tests and use `getResult` instead
   the approach with actual is error prone  since it skips type info



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