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/03/10 02:47:00 UTC

[GitHub] [incubator-shardingsphere] yesidu opened a new issue #4680: count(distinct col) renturn null

yesidu opened a new issue #4680: count(distinct col) renturn null
URL: https://github.com/apache/incubator-shardingsphere/issues/4680
 
 
   mybatis:int getMsgDay(@Param("account_uid") String account_uid);
   SQL:SELECT COUNT(DISTINCT DATE_FORMAT(create_time,'%Y%m%d')) as count FROM table_name
   WHERE account_uid = #{account_uid}
   
   if there is no data, then return null, it case an exection:
   org.apache.ibatis.binding.BindingException: Mapper method 'com.*.getMsgDay attempted to return null from a method with a primitive return type (int).

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


With regards,
Apache Git Services

[GitHub] [shardingsphere] kimmking commented on issue #4680: count(distinct col) renturn null

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


   AggregationType(MAX, MIN, SUM, COUNT, AVG) + Distinct all have this problem.
   I will fix later.
   
   
   


----------------------------------------------------------------
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] [incubator-shardingsphere] kimmking commented on issue #4680: count(distinct col) renturn null

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4680: count(distinct col) renturn null
URL: https://github.com/apache/incubator-shardingsphere/issues/4680#issuecomment-597146240
 
 
   I reproduced it. It's a bug.

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


With regards,
Apache Git Services

[GitHub] [shardingsphere] kimmking edited a comment on issue #4680: count(distinct col) renturn null

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #4680:
URL: https://github.com/apache/shardingsphere/issues/4680#issuecomment-645998081


   I will fix to show:
   ```
   mysql> select avg(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.04 sec)
   
   mysql> select sum(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.02 sec)
   
   mysql> select count(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                              0 | NULL |
   +--------------------------------+------+
   1 row in set (0.01 sec)
   
   mysql> select min(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.02 sec)
   
   mysql>
   mysql> select max(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.01 sec)
   
   
   mysql> select max(distinct id) as a,name from test;
   +---+------+
   | a | name |
   +---+------+
   | NULL | NULL |
   +---+------+
   1 row in set (0.02 sec)
   
   mysql> select count(distinct id) as a,name from test;
   +---+------+
   | a | name |
   +---+------+
   | 0 | NULL |
   +---+------+
   1 row in set (0.01 sec)
   
   mysql> select avg(distinct id) as a,name from test;
   +---+------+
   | a | name |
   +---+------+
   | NULL | NULL |
   +---+------+
   1 row in set (0.01 sec)
   
   ```
   


----------------------------------------------------------------
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] tristaZero closed issue #4680: count(distinct col) renturn null

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


   


----------------------------------------------------------------
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] tristaZero commented on issue #4680: count(distinct col) renturn null

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


   > +1
   
   Hi this issue has been fixed already. If it is convenient, you can give it a test on the master branch. Thx. 


----------------------------------------------------------------
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] changchangjie commented on issue #4680: count(distinct col) renturn null

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


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

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



[GitHub] [shardingsphere] kimmking commented on issue #4680: count(distinct col) renturn null

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


   I will fix to show:
   ```
   mysql> select avg(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.04 sec)
   
   mysql> select sum(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.02 sec)
   
   mysql> select count(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                              0 | NULL |
   +--------------------------------+------+
   1 row in set (0.01 sec)
   
   mysql> select min(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.02 sec)
   
   mysql>
   mysql> select max(distinct id),name from test;
   +--------------------------------+------+
   | AGGREGATION_DISTINCT_DERIVED_0 | name |
   +--------------------------------+------+
   |                           NULL | NULL |
   +--------------------------------+------+
   1 row in set (0.01 sec)
   
   ```
   


----------------------------------------------------------------
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] changchangjie commented on issue #4680: count(distinct col) renturn null

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


   > > +1
   > 
   > Hi this issue has been fixed already. If it is convenient, you can give it a test on the master branch. Thx.
   
    I'm using version 4.0.0-RC3. Which version should I upgrade to


----------------------------------------------------------------
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] [incubator-shardingsphere] kimmking commented on issue #4680: count(distinct col) renturn null

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4680: count(distinct col) renturn null
URL: https://github.com/apache/incubator-shardingsphere/issues/4680#issuecomment-597046368
 
 
   I will try to reproduce this issue later, maybe tomorrow.

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


With regards,
Apache Git Services