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 2022/10/10 06:42:04 UTC

[GitHub] [shardingsphere] ryan-hao opened a new issue, #15606: The query get Null value when using "case when"

ryan-hao opened a new issue, #15606:
URL: https://github.com/apache/shardingsphere/issues/15606

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   ```
   implementation group: 'org.apache.shardingsphere', name: 'shardingsphere-jdbc-core-spring-boot-starter', version: '5.0.0'
   ```
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ```
   ShardingSphere-JDBC
   ```
   
   ### Expected behavior
   ```
   [{a=10, b=20, c=200}]
   ```
   
   ### Actual behavior
   ```
   [{a=10, b=20, c=null}]
   ```
   
   ### Reason analyze (If you can)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   MySQL
   ```
   # ind_test_1
   id    index_id    index_value
   21    21          20.000000
   
   # ind_test_0
   id    index_id    index_value
   10    10          10.000000
   ```
   
   ```
      @Test
      public void multi() {
         String sql =
            "SELECT SUM(CASE index_id WHEN 10 THEN index_value ELSE NULL END) AS a,  " +
            "       SUM(CASE index_id WHEN 21 THEN index_value ELSE NULL END) AS b, " +
            "       SUM(CASE index_id WHEN 10 THEN index_value ELSE NULL END) * SUM(CASE index_id WHEN 21 THEN index_value ELSE NULL END) as c " +
            "FROM ind_test " +
            "WHERE index_id IN (10, 21)";
         System.out.println(jdbcTemplate.queryForList(sql));
      }
   ```
   
   ```
   rules:
     sharding:
       tables:
         ind_test:
           actual-data-nodes: index-db.ind_test_$->{0..1}
           table-strategy:
             standard:
               sharding-column: index_id
               sharding-algorithm-name: ind-test-inline
           key-generate-strategy:
             column: id
             key-generator-name: snowflake
       sharding-algorithms:
         ind-test-inline:
           type: INLINE
           props:
             algorithm-expression: ind_test_$->{index_id % 2}
       key-generators:
         snowflake:
           type: SNOWFLAKE
           props:
             worker-id: 123
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   


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

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


[GitHub] [shardingsphere] github-actions[bot] closed issue #15606: The query get Null value when using "case when"

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #15606: The query get Null value when using "case when"
URL: https://github.com/apache/shardingsphere/issues/15606


-- 
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] github-actions[bot] commented on issue #15606: The query get Null value when using "case when"

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #15606:
URL: https://github.com/apache/shardingsphere/issues/15606#issuecomment-1272350329

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


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


Re: [I] The query get Null value when using "case when" [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #15606:
URL: https://github.com/apache/shardingsphere/issues/15606#issuecomment-2026021272

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


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