liuyongvs commented on code in PR #18375:
URL: https://github.com/apache/flink/pull/18375#discussion_r1432254893


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/AggregateITCase.scala:
##########
@@ -1331,6 +1331,81 @@ class AggregateITCase(aggMode: AggMode, miniBatch: 
MiniBatchMode, backend: State
     assertThat(sink.getRetractResults.sorted).isEqualTo(expected.sorted)
   }
 
+  @TestTemplate
+  def testMinMaxWithChar(): Unit = {
+    val data =
+      List(
+        rowOf(1, "a"),
+        rowOf(1, "b"),
+        rowOf(2, "d"),
+        rowOf(2, "c")
+      )
+    val dataId = TestValuesTableFactory.registerData(data)
+    tEnv.executeSql(s"""
+                       |CREATE TABLE src(
+                       |  `id` INT,
+                       |  `char` CHAR(1)
+                       |) WITH (
+                       |  'connector' = 'values',
+                       |  'data-id' = '$dataId'
+                       |)
+                       |""".stripMargin)
+
+    val sql =
+      """
+        |select `id`, count(*), min(`char`), max(`char`) from src group by `id`
+      """.stripMargin
+
+    val sink = new TestingRetractSink()
+    tEnv.sqlQuery(sql).toRetractStream[Row].addSink(sink)
+    env.execute()
+
+    val expected = List("1,2,a,b", "2,2,c,d")
+    assertThat(sink.getRetractResults.sorted).isEqualTo(expected.sorted)
+  }
+
+  @TestTemplate
+  def testRetractMinMaxWithChar(): Unit = {
+    val data =
+      List(
+        changelogRow("+I", Int.box(1), "a"),
+        changelogRow("+I", Int.box(1), "b"),
+        changelogRow("+I", Int.box(1), "c"),
+        changelogRow("-D", Int.box(1), "c"),
+        changelogRow("-D", Int.box(1), "a"),
+        changelogRow("+I", Int.box(2), "a"),
+        changelogRow("+I", Int.box(2), "b"),
+        changelogRow("+I", Int.box(2), "c"),
+        changelogRow("-U", Int.box(2), "b"),
+        changelogRow("+U", Int.box(2), "d"),
+        changelogRow("-U", Int.box(2), "a"),
+        changelogRow("+U", Int.box(2), "b")
+      )
+    val dataId = TestValuesTableFactory.registerData(data)
+    tEnv.executeSql(s"""
+                       |CREATE TABLE src(
+                       |  `id` INT,
+                       |  `char` CHAR(1)
+                       |) WITH (
+                       |  'connector' = 'values',

Review Comment:
   could we also change test for  CHAR(2), because the sql standard char is 
fixed length, can supports max length for n when char(n)



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