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 2021/12/21 14:39:59 UTC

[GitHub] [shardingsphere] GreekPanda opened a new issue #14206: Sql statement failed to run if upper cases, with error Runtime exception: [Cannot invoke method mod() on null object]

GreekPanda opened a new issue #14206:
URL: https://github.com/apache/shardingsphere/issues/14206


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   shardshphere-5.0.0
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   Run with the correct answer using SELECT statement 
   ### Actual behavior
   Error with : [Cannot invoke method mod() on null object]
   ### Reason analyze (If you can)
   ShardingProxy can't suppert SQL upper case statement.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   Java code are generated by tools, all SQL are upper case in default.  I've made a good Shardingshpere environment follow official tutorials, then I've built a Springboot demo to demonize all features of Shardingshphere. 
   Insert  statement is good, but select statement failed
   ### Example codes for reproduce this issue (such as a github link).
   Code:
   @Test
       public void queryData() {
           OrderPOExample orderPOExample = new OrderPOExample();
           orderPOExample.createCriteria().andUserIdEqualTo(BigInteger.valueOf(1));
           OrderQuery orderQuery = new OrderQuery();
           Long orderId = 680170115576606720L;
           orderQuery.setOrderId(BigInteger.valueOf(orderId));
           //orderQuery.setUserId(BigInteger.valueOf(10));
           List<OrderPO> orderPOList = orderService.queryList(orderQuery);
           log.info(JSON.toJSONString(orderPOList));
       }
   
   error:
   
   ### The error may involve com.zhqc.cloud.sharding.dao.OrderDao.selectByQuery-Inline
   ### The error occurred while setting parameters
   ### SQL: SELECT           order_id, order_no, user_id         FROM T_ORDER   WHERE 1=1             AND ORDER_ID = ?
   ### Cause: java.sql.SQLException: Runtime exception: [Cannot invoke method mod() on null object]
   ; uncategorized SQLException; SQL state [C1997]; error code [1997]; Runtime exception: [Cannot invoke method mod() on null object]; nested exception is java.sql.SQLException: Runtime exception: [Cannot invoke method mod() on null object]
   
   table of sql:
   
   DROP TABLE IF EXISTS `t_order_0`;
   CREATE TABLE `t_order_0`  (
     `order_id` bigint(0) NOT NULL,
     `order_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
     `user_id` bigint(0) NULL DEFAULT NULL,
     PRIMARY KEY (`order_id`) USING BTREE
   ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
   
   -- ----------------------------
   -- Records of t_order_0
   -- ----------------------------
   INSERT INTO `t_order_0` VALUES (680170112074362880, '7040e6290ff14781a70a7f037006a451', 0);
   INSERT INTO `t_order_0` VALUES (680170114066657280, '214bb349fe534851bf65206ecca4103b', 2);
   INSERT INTO `t_order_0` VALUES (680170115576606720, '64848c61fc85446aadecdfd92e9ae1f4', 4);
   INSERT INTO `t_order_0` VALUES (680170117019447296, 'b0098e590dcb45eaac8744ee304fd78c', 6);
   INSERT INTO `t_order_0` VALUES (680170118302904320, '82f99a8f71704b2ea29fae8423719c6e', 8);


-- 
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] strongduanmu commented on issue #14206: Sql statement failed to run if upper cases, with error Runtime exception: [Cannot invoke method mod() on null object]

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


   Hi @GreekPanda, thank you for your feedback. Can you try the master branch? This issue has been fixed by #14168.


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