geoffreyclaude commented on code in PR #16685:
URL: https://github.com/apache/datafusion/pull/16685#discussion_r2187358106


##########
datafusion/sql/src/relation/mod.rs:
##########
@@ -281,3 +796,49 @@ fn optimize_subquery_sort(plan: LogicalPlan) -> 
Result<Transformed<LogicalPlan>>
     });
     new_plan
 }
+
+/// Helper: determine optional filter predicate based on ROWS PER MATCH
+fn rows_filter(rpm: &Option<RowsPerMatch>) -> Option<Expr> {
+    match rpm {
+        // ONE ROW PER MATCH (default): keep last match row only

Review Comment:
   Implementation "shortcut" for proof-of-concept: a more efficient 
implementation would be to have real aggregation on the ONE ROW PER. MATCH, 
grouped by the partition keys and match number.



##########
datafusion/sql/src/relation/mod.rs:
##########
@@ -281,3 +796,49 @@ fn optimize_subquery_sort(plan: LogicalPlan) -> 
Result<Transformed<LogicalPlan>>
     });
     new_plan
 }
+
+/// Helper: determine optional filter predicate based on ROWS PER MATCH
+fn rows_filter(rpm: &Option<RowsPerMatch>) -> Option<Expr> {
+    match rpm {
+        // ONE ROW PER MATCH (default): keep last match row only

Review Comment:
   done



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to