You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
both ShardingSphere-JDBC and ShardingSphere-Proxy
Expected behavior
The following sql should return no data.
selectcount(1)
from t_user
where1=2group by id,username
order by id;
Actual behavior
The sql returns one row, the count is zero.
Reason analyze (If you can)
When order by fields is differenet from group by fields, GroupByMemoryMergedResult will be used.
In GroupByMemoryMergedResult, if there is no data, it will try to generate one row. when select fields have count(1), it will renturn 0.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Environment
mysql: 5.7.4
shardingsphere: 5.5.0
Create table
createtablet_user_0(
id intprimary key auto_increment,
username varchar(30)
);
createtablet_user_1(
id intprimary key auto_increment,
username varchar(30)
);
createtablet_user_2(
id intprimary key auto_increment,
username varchar(30)
);
ShardingSphere Jdbc config file. ShardingSphere Proxy config file content is similar with it.
# Wrong result, returns one row.selectcount(1)
from t_user
where1=2group by id,username
order by id;
# Return no data as expect.selectcount(1)
from t_user
where1=2group by id,username
order by id,username;
Which version of ShardingSphere did you use?
5.5.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
both ShardingSphere-JDBC and ShardingSphere-Proxy
Expected behavior
The following sql should return no data.
Actual behavior
The sql returns one row, the count is zero.
![image](https://private-user-images.githubusercontent.com/51293207/375928704-3a408274-db80-48e2-9324-4fee7bb09d31.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzOTk3MjAsIm5iZiI6MTczOTM5OTQyMCwicGF0aCI6Ii81MTI5MzIwNy8zNzU5Mjg3MDQtM2E0MDgyNzQtZGI4MC00OGUyLTkzMjQtNGZlZTdiYjA5ZDMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDIyMzAyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxOWRkMzc5ZjBjMzc4ZjMzMzFlZGU4YzE4ZGE4YTNjMThlNTM3MGNlZmRhNzc2MzNiYThmNjYwNzIyNjQ1MmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wXUpLtl7whXTkM2lYYKGGZ8YurvbJa3Xeenm0foJd_g)
Reason analyze (If you can)
When order by fields is differenet from group by fields, GroupByMemoryMergedResult will be used.
![image](https://private-user-images.githubusercontent.com/51293207/375928514-c3f32a02-7532-434f-96d0-8b89eca8037f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzOTk3MjAsIm5iZiI6MTczOTM5OTQyMCwicGF0aCI6Ii81MTI5MzIwNy8zNzU5Mjg1MTQtYzNmMzJhMDItNzUzMi00MzRmLTk2ZDAtOGI4OWVjYTgwMzdmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDIyMzAyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc4Yzc5YTQxNGYyZGE4NDk1NTAzOGNlNGIwOTVhMTdkYzJkNTBkMzEzODgwMmEyOWIwNWEzZTc5YjMzMDYwZTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.F3r6Ac-HZQMn_d9vnd8rIRe4tXMerLtCc0ONDICd6hU)
![image](https://private-user-images.githubusercontent.com/51293207/375928502-1d3ae77b-28a7-4550-a9b4-3cb7b212ebb7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzOTk3MjAsIm5iZiI6MTczOTM5OTQyMCwicGF0aCI6Ii81MTI5MzIwNy8zNzU5Mjg1MDItMWQzYWU3N2ItMjhhNy00NTUwLWE5YjQtM2NiN2IyMTJlYmI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDIyMzAyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNkYzc2YThkZmFkOGQ1YzYzNGFmMWQwODRkNzdkYTM3ZmEwM2U3NzdjMzI3ODc4ZTQ4MmY2ZmMyYWNhMDBjOWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.aSzkkx0rQ9OgISpKZSwS1ysPrChNNTgxV7NkLfm5VlY)
In GroupByMemoryMergedResult, if there is no data, it will try to generate one row. when select fields have count(1), it will renturn 0.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Environment
mysql: 5.7.4
shardingsphere: 5.5.0
Create table
Related #33209
The text was updated successfully, but these errors were encountered: