-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove alias of sort key when PagingQueryProvider has sort key with alias and group by clause. #4743
base: main
Are you sure you want to change the base?
Conversation
spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkProcessor.java
Outdated
Show resolved
Hide resolved
Can you please edit your initial comment and explain the problem this PR addresses. I know you linked the previous PR in which the problem is explained, but since we might include this PR in the change log it would be better to have the problem explained here. Moreover, is this specific to MySQL only? |
@fmbenhassine Thank you for the comment. Using a table alias from a subquery in an outer query is not compliant with the ANSI SQL standard. Given this, it is likely that all DBMSs providing an implementation of Since I'm not familiar with other DBMSs, I only created a test for MysqlPagingQueryProvider. |
Signed-off-by: KyeongHoon Lee <[email protected]>
Signed-off-by: KyeongHoon Lee <[email protected]>
Remove table aliases of the sort keys when the PagingQueryProvider uses sort keys with table aliases and a GROUP BY clause. Signed-off-by: KyeongHoon Lee <[email protected]>
This reverts commit a851d71. Signed-off-by: KyeongHoon Lee <[email protected]>
@fmbenhassine Hello!! I add some tests for MariaDB, PostgreSQL and SQLite. I executed query on those DBMSs running in Docker. I found implementations of PagingQueryProvider that call the method I modified: Db2PagingQueryProvider, DerbyPagingQueryProvider, HanaPagingQueryProvider, MariaDBPagingQueryProvider, MySqlPagingQueryProvider, PostgresPagingQueryProvider, and SqlitePagingQueryProvider. Among these, I have directly created tables and executed queries in all except Db2, Derby, and Hana |
Signed-off-by: KyeongHoon Lee <[email protected]>
Hello.
Motivation
I tried to build a batch application.
Environment
Problem
I use MySqlPagingQueryProvider like below, and Query built by this provider only works for first page query.
(Because of sort key's alias)
Generated Remaining Query
This generated remaining query has order by clause with t1.memeber, and valid scope of t1 alias is in MAIN_QRY.
Solution