sharding-jdbc: Oracle pagination query error
See original GitHub issueversion
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
<version>5.1.1</version>
testcase
def "testOraclePagination"() {
when: "pagination case 1"
def pagination_sql2 = """
select * from (
select t1."num",rownum as "rownum_" from(
select 'a' as "num" from dual)t1)
where "rownum_" >? and "rownum_"< ?
"""
try (def connection = sqlSessionFactory.openSession().getConnection()) {
connection.prepareStatement(pagination_sql2)
}
then:
noExceptionThrown()
when: "pagination case 2"
def pagination_sql3 = """
select t2."num",t2,"rownum_" from (
select t1."num",rownum as "rownum_" from(
select 'a' as "num" from dual)t1)t2
where t2."rownum_" > ? and t2."rownum_" <= (?+?)
"""
try (def connection = sqlSessionFactory.openSession().getConnection()) {
connection.prepareStatement(pagination_sql3)
}
then:
noExceptionThrown()
when: "pagination case 3"
def pagination_sql4 = """
select * from (
select t1."num",rownum as "rownum_" from(
select 'a' as "num" from dual)t1)
where t2."rownum_" > ? and t2."rownum_" <= (?+?)
"""
try (def connection = sqlSessionFactory.openSession().getConnection()) {
connection.prepareStatement(pagination_sql4)
}
then:
noExceptionThrown()
}
pagination case 3 throw exception
Caused by: java.lang.ClassCastException: class org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment cannot be cast to class org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment (org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment and org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment are in unnamed module of loader 'app')
at org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.RowNumberPaginationContextEngine.createRowNumberValueSegment(RowNumberPaginationContextEngine.java:142)
at org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.RowNumberPaginationContextEngine.createPaginationWithRowNumber(RowNumberPaginationContextEngine.java:129)
at org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.RowNumberPaginationContextEngine.createPaginationContext(RowNumberPaginationContextEngine.java:67)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
JPA and Oracle DB: Distinct query with pagination leads to ...
Is there a solution for oracle to get the distinct running together with the pagination? EDIT. So it seems like oracle fails with...
Read more >Pagination query and optimization - Ask TOM
Hi Tom, I've been reading through a few posts regarding pagination. I'm using the following query template in my application, ...
Read more >pagination problem — oracle-tech
But the performance of all my pages is same(very slow and poor). I am refreshing the page and performing the query once again....
Read more >On Top-n and Pagination Queries - Oracle Blogs
in order to get rows n through m from "your query." As always, there is more than one way to do things in...
Read more >What is efficient way to paginate on the large table? - Ask TOM
Also, when the offset is big then Oracle does a full table scan. select /*+ gather_plan_statistics */ * from t order by pk...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.
fixed in ShardingSphere 5.2.0