snuyanzin commented on code in PR #27929:
URL: https://github.com/apache/flink/pull/27929#discussion_r3081251694


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/PartitionedTable.java:
##########
@@ -35,6 +36,36 @@
 @PublicEvolving
 public interface PartitionedTable {
 
+    /**
+     * Sorts the partitioned table within each partition.
+     *
+     * <p>This is useful for process table functions that need ordered input 
within each set scoped
+     * by the key.
+     *
+     * <p>Note: The first sorting column must be a time attribute column in 
ascending order for
+     * which a watermark has been declared. The watermarked column must be 
forwarded without any
+     * modification to ensure event-time sorting. Secondary ordering columns 
can differ and are used
+     * for deterministic ordering within the same timestamp.
+     *
+     * <p>Example:
+     *
+     * <pre>{@code
+     * // Primary ordering by watermarked timestamp, secondary by score
+     * env.fromCall(
+     *   "MyPTF",
+     *   table
+     *     .partitionBy($("key"))
+     *     .orderBy($("ts").asc(), $("score").desc())
+     *     .asArgument("input_table")
+     * )
+     * }</pre>
+     *
+     * @param fields expressions for ordering (e.g., {@code $("ts").asc(), 
$("score").desc()})
+     * @return a partitioned and ordered table

Review Comment:
   We have some weird tests with expressions in `ORDER BY` like for instance
   
https://github.com/apache/flink/blob/d8010df8795e1a8e4895d66b7b4861a85c8e0e24/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/batch/sql/OverAggregateITCase.scala#L1035-L1036
   
   are there any limitations for PTF case?
   
   can there be `order by` by some PTF?
   do we have any validation around this?  



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