Skip to content
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

The query result is incorrect when querying the total count of cross-table pagination with a SQL statement that includes GROUP BY. #28914

Open
ly164608001 opened this issue Nov 2, 2023 · 0 comments

Comments

@ly164608001
Copy link

Bug Report

The query result is incorrect when querying the total count of cross-table pagination with a SQL statement that includes GROUP BY

Which version of ShardingSphere did you use?

5.2.0

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

Able to return the correct result.

Actual behavior

Simply calculated the sum of their respective results

Reason analyze (If you can)

The results should be compared after grouping by, removing duplicates, and then calculating the statistics

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

1、CREATE table sharingtest_202309(id BIGINT,name VARCHAR, create_date date);
CREATE table sharingtest_202310(id BIGINT,name VARCHAR, create_date date);

2、shardingRule
sharding_test:
actualDataNodes: db0.sharding_test_$->{2021..2030}$->{['01','02','03','04','05','06','07','08','09','10','11','12']}
tableStrategy:
standard:
shardingColumn: create_date
shardingAlgorithmName: table-month
3、executeSQL: select count(0) from (select name
from
sharingtest
where
create_date >= '2023-09-01'
and create_date <= '2023-10-31'
group by
name
) tmp_count
4、The expected result is 2, but the actual result is 3

@github-actions github-actions bot added the stale label Dec 2, 2023
@apache apache deleted a comment from github-actions bot Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants