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


##########
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:
   SQL Server: Uses the ORDER BY clause for sorting based on column names, 
supporting ascending or descending order. Does not have native array types but 
allows sorting through table variables or temporary tables.
   
   SQLite: Similar to SQL Server, it relies on ORDER BY for sorting without 
built-in array support.
   
   PostgreSQL: Supports arrays and provides functions like array_sort for 
direct sorting of array elements.
   For postgresql https://www.postgresql.org/docs/8.4/intarray.html
   it has four ways to sort an array
   ```
   
   sort(int[], text dir) | int[] | sort array — dir must be asc or desc | 
sort('{1,2,3}'::int[], 'desc') | {3,2,1}
   sort(int[]) | int[] | sort in ascending order | sort(array[11,77,44]) | 
{11,44,77}
   sort_asc(int[]) | int[] | sort in ascending order |   |  
   sort_desc(int[]) | int[] | sort in descending order |  
   ```
   MySQL & MariaDB: Lack built-in array support; sorting is achieved using 
ORDER BY. 
   



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to