GavinHua commented on issue #17973:
URL: 
https://github.com/apache/shardingsphere/issues/17973#issuecomment-1515644377

   #23544
   
   
https://github.com/apache/shardingsphere/blob/07eb5011a4f4e2a5bda9e1a5667ed753a8329c0f/sql-parser/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java#L788-L805
   
   
   ```sql
   select id, name, create_time from dbo.test_sharding order by create_time 
desc 
   OFFSET #{offset} ROWS FETCH NEXT #{rows} ROWS ONLY
   ```
   
   Taking this SQL as an example, there are two parameters, `offset` and 
`rows`, which means that `parameterMarkerSegments.size()=2`. 
   
   However, when constructing the ParameterMarkerLimitValueSegment, the index 
used is `parameterMarkerSegments.size()` instead of 
`parameterMarkerSegments.size() - 1`. 
   
   I think this is what's causing the exception to be thrown in subsequent 
executions of `java.lang.IndexOutOfBoundsException: Index: 2, Size: 2`.
   


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