fudianchn opened a new pull request, #39242: URL: https://github.com/apache/shardingsphere/pull/39242
### What Fixes the openGauss `LIMIT ?, ?` parameter marker order reported in #34961. ### Root cause `OpenGaussStatementVisitor.createLimitSegmentWhenRowCountOrOffsetAbsent` visited `selectLimitValue` (row-count) **before** `selectOffsetValue` (offset). Parameter marker indices are assigned in visit order (`visitParameterMarker` returns `parameterMarkerSegments.size()` at visit time), so for the MySQL-style `LIMIT offset, row-count` the lexical first `?` (offset) was assigned index 1 and the second `?` (row-count) index 0 — reversed. For example `setInt(1, 2)` (offset) / `setInt(2, 1)` (count) produced "return 2 rows from offset 1" instead of "skip 2, return 1". ### Fix Visit the offset before the row-count so marker indices follow lexical order. This matches the reference implementation in `DorisStatementVisitor.visitLimitClause`. Only the visit order of two adjacent lines is swapped; the `LimitSegment` construction is unchanged. ### Tests Added `OpenGaussStatementVisitorTest.assertVisitLimitWithOffsetAndRowCountParameterMarkers`: parses `SELECT * FROM t ORDER BY id LIMIT ?, ?` and asserts `offset.parameterIndex == 0`, `rowCount.parameterIndex == 1`. Fails before the change (offset=1, rowCount=0), passes after. ### Verification - `./mvnw -pl parser/sql/engine/dialect/opengauss -am install -DskipTests` — BUILD SUCCESS. - `./mvnw -pl parser/sql/engine/dialect/opengauss test` — all tests green. - Style gates (Spotless / Checkstyle / PMD / SpotBugs) pass on the changed module. ### Credit Thanks to @daguimu for the original diagnosis in #38647 (closed only for staleness/style), and to @terrymanu for confirming the fix direction. This is a fresh, rebased PR with the style gates satisfied. Fixes #34961 -- 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]
