You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/09 07:49:52 UTC

[GitHub] [shardingsphere] marxy opened a new issue #5492: COUNT(DISTINCT x1) from table group by x2 return wrong result

marxy opened a new issue #5492:
URL: https://github.com/apache/shardingsphere/issues/5492


   ## Bug Report
   SELECT col1, COUNT(DISTINCT col2) FROM tbl_name GROUP BY col1
   I find it in document's [support list](https://shardingsphere.apache.org/document/current/en/features/sharding/use-norms/sql/#supported-sql-2), but the result of this sql is wrong.
   ### Which version of ShardingSphere did you use?
   4.0.1
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
    Sharding-JDBC
   ### Expected behavior
   Logic SQL: SELECT
               col1 AS name,
               COUNT(DISTINCT col2) as num
           from table_name
           group by col1 
   
   ### Actual behavior
   Actual SQL: ds0 ::: SELECT
               DISTINCT col1 AS name,
               col2 as num
           from table_name_0
           group by col1 ORDER BY col1 ASC 
   
   Actual SQL: ds0 ::: SELECT
               DISTINCT col1 AS name,
               col2 as num
           from table_name_1
           group by col1 ORDER BY col1 ASC 
   
   ### Reason analyze (If you can)
   In mysql,  the sql "select DISTINCT col1,col2  group by col1" always return one row with each group by colunm, so the aggregated result of num is wrong.
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking closed issue #5492: COUNT(DISTINCT x1) from table group by x2 return wrong result

Posted by GitBox <gi...@apache.org>.
kimmking closed issue #5492:
URL: https://github.com/apache/shardingsphere/issues/5492


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #5492: COUNT(DISTINCT x1) from table group by x2 return wrong result

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5492:
URL: https://github.com/apache/shardingsphere/issues/5492#issuecomment-912174433


   @wosniuxx You can try the latest master branch, it has been supported now.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on issue #5492: COUNT(DISTINCT x1) from table group by x2 return wrong result

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5492:
URL: https://github.com/apache/shardingsphere/issues/5492#issuecomment-626164615


   That doesn't support disctinct column is different with group by column.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wosniuxx commented on issue #5492: COUNT(DISTINCT x1) from table group by x2 return wrong result

Posted by GitBox <gi...@apache.org>.
wosniuxx commented on issue #5492:
URL: https://github.com/apache/shardingsphere/issues/5492#issuecomment-911532441


   Same problem +1
   Could has plan with it?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org