amaliujia commented on a change in pull request #12766:
URL: https://github.com/apache/beam/pull/12766#discussion_r487308868



##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/SqlOperators.java
##########
@@ -155,6 +156,25 @@ public static SqlFunction createZetaSqlFunction(String 
name, SqlTypeName returnT
         SqlFunctionCategory.USER_DEFINED_FUNCTION);
   }
 
+  /**
+   * Create a dummy SqlAggFunction of type OTHER_FUNCTION from given function 
name and return type.
+   * These functions will be executed by Beam CombineFns implemented in {@link
+   * 
org.apache.beam.sdk.extensions.sql.impl.transform.BeamBuiltinAggregations}.
+   */
+  public static SqlAggFunction createZetaSqlAggFunction(String name, 
RelDataType returnType) {
+    return new SqlAggFunction(
+        name,
+        null, // sqlIdentifier
+        SqlKind.OTHER_FUNCTION,
+        x -> returnType,

Review comment:
       I am not sure whether this is the right trigger to override the return 
type of an agg operator. Maybe the best to evaluate it is to support `AVG` in 
ZetaSQL. As I recall the return type is different for ZetaSQL and Calcite when 
input parameter type is `INT64` for `AVG`.




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


Reply via email to