fsk119 commented on code in PR #22599:
URL: https://github.com/apache/flink/pull/22599#discussion_r1203384646
##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/batch/sql/agg/AggregateITCaseBase.scala:
##########
@@ -1184,6 +1184,34 @@ abstract class AggregateITCaseBase(testName: String)
extends BatchTestBase {
checkResult("select count(*) from src", Seq(row(3)))
}
+ @Test
+ def testLeadAggFunction(): Unit = {
+ val data =
+ List(rowOf(2L, 15, "Hello"), rowOf(8L, 11, "Hello world"), rowOf(9L, 12,
"Hello world!"))
+ val dataId = TestValuesTableFactory.registerData(data)
+ tEnv.executeSql(s"""
+ |CREATE TABLE src(
+ | `id` BIGINT,
+ | len INT NOT NULL,
Review Comment:
nit: len -> `len`
##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/AggregateITCase.scala:
##########
@@ -1765,4 +1765,35 @@ class AggregateITCase(aggMode: AggMode, miniBatch:
MiniBatchMode, backend: State
val expected = List("3")
assertEquals(expected.sorted, sink.getRetractResults.sorted)
}
+
+ @Test
+ def testLagAggFunction(): Unit = {
+ val data =
+ List(rowOf(2L, 15, "Hello"), rowOf(8L, 11, "Hello world"), rowOf(9L, 12,
"Hello world!"))
+ val dataId = TestValuesTableFactory.registerData(data)
+ tEnv.executeSql(s"""
+ |CREATE TABLE src(
+ | `id` BIGINT,
+ | len INT,
Review Comment:
ditto
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/aggregate/LagAggFunction.java:
##########
@@ -44,6 +44,15 @@ public LagAggFunction(LogicalType[] valueTypes) {
Arrays.stream(valueTypes)
.map(DataTypeUtils::toInternalDataType)
.toArray(DataType[]::new);
+ // When the initial value has not been initialized and is not allowed
to be null or
+ // default value allowed to be empty,output should be changed to allow
nulls
Review Comment:
The output value can only be not null if the default input arguments include
a non-null default value.
--
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]