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/12/09 16:36:10 UTC

[GitHub] [shardingsphere] Terrdi opened a new issue #8551: Data Fragment Doesn't Work for Negative

Terrdi opened a new issue #8551:
URL: https://github.com/apache/shardingsphere/issues/8551


   ## 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?
   <dependency>
     <groupId>org.apache.shardingsphere</groupId>
     <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
     <version>5.0.0-RC1-SNAPSHOT</version>
   </dependency>
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   ### Actual behavior
   * it reports "no database route info" while the value of the field which is used to distinguish the database is negative.
   * it send the sql text like this while the value of the field which is used to distinguish the table is negative.
   ```sql
   INSERT INTO org.apache.shardingsphere.sharding.rewrite.token.pojo.TableToken@a0d875d  ( id,order_no,user_id )  VALUES  org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken@693f2c89
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   INSERT INTO t_geektime_order ( id, order_no, user_id ) VALUES ( 1, -1, -1 );
   INSERT INTO t_geektime_order ( id, order_no, user_id ) VALUES ( 1, -1, 1 );
   
   ##### data fragment configuration
           database-strategy:
                 standard:
                   sharding-column: user_id
                   sharding-algorithm-name: database-inline
               table-strategy:
                 standard:
                   sharding-column: order_no
                   sharding-algorithm-name: t-geektime-order-inline
           sharding-algorithms:
             database-inline:
               type: INLINE
               props:
                 algorithm-expression: ds$->{user_id % 2}
             t-geektime-order-inline:
               type: INLINE
               props:
                 algorithm-expression: t_geektime_order_$->{order_no % 16}
   
   
   ### Example codes for reproduce this issue (such as a github link).
   ```java
   Order order = new Order();
   order.setId(1);
   order.setUserId(-1234231);
   order.setOrderNo(112312312L);
   orderService.save(order);
   
   Order order = new Order();
   order.setId(1);
   order.setUserId(1234231);
   order.setOrderNo(-112312312L);
   orderService.save(order);
   ```


----------------------------------------------------------------
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] jingshanglu commented on issue #8551: Data Fragment Doesn't Work for Negative

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


   @tristaZero @TanveshT I'll check 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.

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



[GitHub] [shardingsphere] tristaZero commented on issue #8551: Data Fragment Doesn't Work for Negative

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


   Hi @Terrdi ,
   Thanks for your issue. 
   Could you configure `sql-show` = `true` to provide more details? Like, `Actual SQLs`.


----------------------------------------------------------------
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] Terrdi commented on issue #8551: Data Fragment Doesn't Work for Negative

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


   Hi @tristaZero 
   It didn't generate sql while the value of the field which is used to **distinguish the database** is negative.
   
   This is the sql while the value of the field which is used to **distinguish the table** is negative.
   > 2020-12-10 23:02:27.470  INFO 39287 --- [           main] ShardingSphere-SQL                       : Logic SQL: INSERT INTO t_order  ( id,
   order_no,
   
   user_id )  VALUES  ( ?,
   ?,
   
   ? )
   > 2020-12-10 23:02:27.470  INFO 39287 --- [           main] ShardingSphere-SQL                       : SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty, onDuplicateKeyColumns=Optional.empty)
   > 2020-12-10 23:02:27.470  INFO 39287 --- [           main] ShardingSphere-SQL                       : Actual SQL: ds0 ::: INSERT INTO org.apache.shardingsphere.sharding.rewrite.token.pojo.TableToken@2349f14d  ( id,
   order_no,
   
   user_id )  VALUES  org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken@17e0933c ::: [2, -112312312, 1234231]
   


----------------------------------------------------------------
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 #8551: Data Fragment Doesn't Work for Negative

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


   Hi @Terrdi Thanks for test. 
   
   Hi @jingshanglu I am curious our SQL parser can parse a negative value well? Could you look at this case?


----------------------------------------------------------------
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] Terrdi edited a comment on issue #8551: Data Fragment Doesn't Work for Negative

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


   Hi @tristaZero 
   It didn't generate sql while the value of the field which is used to **distinguish the database** is negative.
   
   This is the sql while the value of the field which is used to **distinguish the table** is negative.
   > 2020-12-10 23:02:27.470  INFO 39287 --- [           main] ShardingSphere-SQL                       : Logic SQL: INSERT INTO t_order  ( id,order_no,user_id )  VALUES  ( ?,?,? )
   > 2020-12-10 23:02:27.470  INFO 39287 --- [           main] ShardingSphere-SQL                       : SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty, onDuplicateKeyColumns=Optional.empty)
   > 2020-12-10 23:02:27.470  INFO 39287 --- [           main] ShardingSphere-SQL                       : Actual SQL: ds0 ::: INSERT INTO org.apache.shardingsphere.sharding.rewrite.token.pojo.TableToken@2349f14d  ( id,order_no,user_id )  VALUES  org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken@17e0933c ::: [2, -112312312, 1234231]
   


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