morrySnow opened a new pull request, #61681:
URL: https://github.com/apache/doris/pull/61681

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Problem Summary: MySQL supports ORDER BY and LIMIT clauses in single-table
   UPDATE and DELETE statements, but Doris does not. This PR adds support for
   these clauses so users can write statements like:
   
   ```sql
   DELETE FROM table1 ORDER BY c1 ASC NULLS FIRST LIMIT 10, 3;
   UPDATE table1 SET c1 = 10 ORDER BY c2 LIMIT 100, 20;
   ```
   
   The implementation reuses the existing `queryOrganization` grammar rule and
   `withQueryOrganization` builder method. For DELETE, when ORDER BY or LIMIT is
   present, the statement is routed through `DeleteFromUsingCommand` (INSERT 
INTO
   SELECT path) which naturally supports sort/limit semantics. For UPDATE, the
   queryOrganization is applied to the query plan after `withFilter`.
   
   ### Release note
   
   Support ORDER BY and LIMIT clauses in UPDATE and DELETE statements, 
consistent
   with MySQL single-table UPDATE/DELETE syntax.
   
   ### Check List (For Author)
   
   - Test: Regression test / Unit Test
       - Parser syntax tests in NereidsParserTest
       - Plan tree structure tests in LogicalPlanBuilderTest
       - DELETE regression tests in test_delete_order_by_limit.groovy
       - UPDATE regression tests in test_update_order_by_limit.groovy
   - Behavior changed: No
   - Does this need documentation: No


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