konlue opened a new pull request, #7758:
URL: https://github.com/apache/shenyu/pull/7758

   Fixes #7739.
   
   ## Summary
   
   The Oracle `selectLimit` statement limits rows with `WHERE ROWNUM <= 
#{limit}` in the same query block as `ORDER BY operation_time desc`. Oracle may 
apply the row limit before sorting, so the recent-operation list can return 
older rows and omit the newest N; the generic statement orders first and then 
applies `LIMIT`.
   
   ## Modifications
   
   - Wrap the operator-filtered, descending query in an inner subquery and 
apply `WHERE ROWNUM <= #{limit}` in the outer query (Oracle's documented top-N 
form).
   - Add a statement-shape regression test resolved with `databaseId="oracle"`.
   
   ## Verifying this change
   
   - [x] New `OperationRecordLogSelectLimitSqlTest`: under 
`databaseId="oracle"`, asserts the SQL starts with the wrapped subquery, `ORDER 
BY` precedes `ROWNUM`, and `ROWNUM <= ?` plus the operator filter are present. 
Fails on the previous statement (which shows `rownum` before `order by`), 
passes with the fix.
   - [x] Targeted test passes:
   
     ```bash
     ./mvnw -B -ntp -pl shenyu-admin test 
-Dtest=OperationRecordLogSelectLimitSqlTest
     ```
     1/1 green.
   
   - [x] Checkstyle passes:
   
     ```bash
     ./mvnw -B -ntp -pl shenyu-admin checkstyle:check
     ```
     clean.
   
   ## Notes
   
   The configured limit and the per-operator filter are unchanged; only the 
evaluation order (filter/sort, then row limit) is corrected. The test pins 
MyBatis dialect selection locally; execution against a real Oracle instance is 
exercised by the repository's SQL matrix. This PR touches the same mapper file 
as the separate Oracle `CONCAT` fix, but a different statement.


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