spring-projects / spring-projects/spring-batch
boolean remainingPageQuery=true flag in SqlPagingQueryUtils adds sortKeys to whereClause
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
Bug description
generateLimitQuery() method in SqlPagingQueryUtils calls buildWhereClause() method when remainingPageQuery=true and adds
sortKeys to where clause, why so?
I have sortKeys, say
name ascending, age ascending
and where clause has two fields (name and age) which i will pass during program execution.
So technically the sql should be
select * from table1 where name=:name and age=:age
order by name asc, age asc
but query built is
select * from table1 where name=:name and age=:age and ((name > :_name) or (age >:_age))
order by name asc, age asc
In above case, I dont want this extra conditions in where clause for added sortKeys.
Environment
spring-batch-infrastructure-4.3.6
java version 17
database using is DB2
Steps to reproduce
Expected behavior
I dont want extra conditions in where clause than given ones as I am not passing any values for sortKeys except the ordering sequence.
Minimal Complete Reproducible example
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SqlPagingQueryUtils.generateLimitQuery() and its buildWhereClause() call when remainingPageQuery=true. Reproduce the stated sort keys, where fields, DB2 environment, and Spring Batch 4.3.6 version, then compare the generated SQL with the expected query; done means the intended behavior is established and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100