dawidwys commented on code in PR #22951:
URL: https://github.com/apache/flink/pull/22951#discussion_r1489331336


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java:
##########
@@ -231,6 +232,21 @@ ANY, and(logical(LogicalTypeRoot.BOOLEAN), LITERAL)
                             
"org.apache.flink.table.runtime.functions.scalar.ArrayContainsFunction")
                     .build();
 
+    public static final BuiltInFunctionDefinition ARRAY_SORT =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("ARRAY_SORT")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(new 
ArrayComparableElementArgumentTypeStrategy()),
+                                    sequence(
+                                            new 
ArrayComparableElementArgumentTypeStrategy(),
+                                            logical(LogicalTypeRoot.BOOLEAN))))

Review Comment:
   @MartijnVisser Actually Snowflake does:
   > nulls_first
    Default: FALSE if the ARRAY is sorted in ascending order; TRUE if the ARRAY 
is sorted in descending order.
   
   I'd suggest we:
    
   1. adapt Snowflake's signature where we get `ARRAY<COMPARABLE>, BOOLEAN, 
BOOLEAN`, output is `ARRAY<COMPARABLE>` which is `NULLABLE` if any of the input 
is nullable
   2. We use defaults: ascending and `nulls_first` for ASC, `nulls_last` for 
DESC
   3. If any of the input is null the output is also null
   
   How does this sound?  



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