Library-cll opened a new issue, #33795:
URL: https://github.com/apache/shardingsphere/issues/33795

   ## Bug Report
   
   Execute the following sql. 
   `select field_1, field_2, count(1) from table_1 where field_1 in (xxxx, 
xxxxx) group by field_1`
   When no data row meets the condition, null should be returned, but the row 
with data 0 is returned.
   
   
   
   ### Which version of ShardingSphere did you use?
   
   ShardingSphere-JDBC 5.5.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC 5.5.0
   
   ### Expected behavior
   
   Return empty
   
   ### Actual behavior
   
   Return  0
   
   ### Reason analyze (If you can)
   
   In this issue: https://github.com/apache/shardingsphere/issues/4680, the bug 
where count returns null is fixed. However, when goupby exists in sql, null 
should be returned instead of 0.
   
   In line 157, count is assigned a value, causing all SQL statements 
containing count to return one row of data.
   
   
https://github.com/apache/shardingsphere/blob/fc0a225809011f656856bb871f8e47909c5a38a2/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java#L142-L162
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   `select field_1, field_2, count(1) from table_1 where field_1 in (xxxx, 
xxxxx) group by field_1`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to