tsreaper commented on a change in pull request #16650:
URL: https://github.com/apache/flink/pull/16650#discussion_r680613521
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/utils/AggFunctionFactory.scala
##########
@@ -366,7 +366,7 @@ class AggFunctionFactory(
new LeadLagAggFunction.DoubleLeadLagAggFunction(argTypes.length)
case BOOLEAN =>
new LeadLagAggFunction.BooleanLeadLagAggFunction(argTypes.length)
- case VARCHAR =>
+ case VARCHAR | CHAR =>
new LeadLagAggFunction.StringLeadLagAggFunction(argTypes.length)
Review comment:
`LeadLagAggFunction.StringLeadLagAggFunction#getResultType` returns
`STRING` type, which is a `VARCHAR` type. I think users will not expect feeding
a `CHAR` into the lead/lag function and get a `VARCHAR` out. It might be better
to add a new type of lead/lag function.
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/batch/sql/agg/LeadLagITCase.scala
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.runtime.batch.sql.agg
+
+import org.apache.flink.table.planner.runtime.utils.BatchTestBase
+import org.apache.flink.table.planner.runtime.utils.BatchTestBase.row
+import org.junit.Test
+
+class LeadLagITCase extends BatchTestBase{
Review comment:
For normal batch aggregation IT cases we add them to
`org.apache.flink.table.planner.runtime.batch.sql.agg.AggregateITCaseBase`.
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/batch/sql/agg/LeadLagITCase.scala
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.runtime.batch.sql.agg
+
+import org.apache.flink.table.planner.runtime.utils.BatchTestBase
+import org.apache.flink.table.planner.runtime.utils.BatchTestBase.row
+import org.junit.Test
+
+class LeadLagITCase extends BatchTestBase{
+
+ override def before(): Unit = {
+ super.before()
+ tEnv.executeSql(
+ """
+ |CREATE TEMPORARY VIEW T AS
+ |SELECT * FROM ( VALUES
+ | ('Alice', '[email protected]', ARRAY [ '[email protected]' ], 'Test
Ltd1'),
Review comment:
These types doesn't seem to cover all branches in
`createBatchLeadLagAggFunction`. Please add more types and don't forget the
`null` values for each type.
--
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]