You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/12/09 19:54:57 UTC

[GitHub] [beam] sonam-vend commented on a change in pull request #13483: Implemeted ARRAY_AGG fn for Zetasql dialect

sonam-vend commented on a change in pull request #13483:
URL: https://github.com/apache/beam/pull/13483#discussion_r539602319



##########
File path: sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/SqlOperators.java
##########
@@ -81,6 +72,12 @@
           x -> createTypeFactory().createSqlType(SqlTypeName.VARCHAR),
           new UdafImpl<>(new StringAgg.StringAggString()));
 
+  public static final SqlOperator ARR_AGG_ARR_FN =
+          createUdafOperator(
+                  "array_agg",
+                  x -> createTypeFactory().createSqlType(SqlTypeName.ARRAY),

Review comment:
       @ibzib exactly. I try to implement generic array like not sure if it is the correct way.
   
    private static RelDataType relDataType =
             new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
                     .builder()
                     .add("col_tinyint", SqlTypeName.TINYINT)
                     .add("col_smallint", SqlTypeName.SMALLINT)
                     .add("col_integer", SqlTypeName.INTEGER)
                     .add("col_bigint", SqlTypeName.BIGINT)
                     .add("col_float", SqlTypeName.FLOAT)
                     .add("col_double", SqlTypeName.DOUBLE)
                     .add("col_decimal", SqlTypeName.DECIMAL)
                     .add("col_string_varchar", SqlTypeName.VARCHAR)
                     .add("col_time", SqlTypeName.TIME)
                     .add("col_date", SqlTypeName.DATE)
                     .add("col_timestamp_with_local_time_zone", SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE)
                     .add("col_timestamp", SqlTypeName.TIMESTAMP)
                     .add("col_boolean", SqlTypeName.BOOLEAN)
                     .build();
   
     public static final SqlOperator ARR_AGG_ARR_FN =
             createUdafOperator(
                     "array_agg",
                     x -> createTypeFactory().createArrayType(**relDataType**, -1),
                     new UdafImpl<>(new ArrayAgg.ArrayAggArray()));




----------------------------------------------------------------
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:
users@infra.apache.org