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/17 06:24:57 UTC

[GitHub] [shardingsphere] wangleigithub opened a new issue #8664: rewrite sql cause a bug

wangleigithub opened a new issue #8664:
URL: https://github.com/apache/shardingsphere/issues/8664


   ## 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?
   5.0.0-alpha
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ss-proxy
   ### Expected behavior
   
   ### Actual behavior
   [INFO ] 11:27:29.078 [ShardingSphere-Command-3] ShardingSphere-SQL - Logic SQL: INSERT INTO `z_f_inflowpeople` (
           ID,
           W_ID,
           FLOWREASON,
           FAMILYINFO,
           OUTFLWADDR,
           OUTFLWADDRNO,
           INFLOWDATE,
           PROCCARDNO,
           ISGETONLY,
           REPORTDATE,
           REPORTSITE,
           ADDTIME,
           ADDBY,
           ADDIP,
           UPDATETIME,
           UPDATEBY,
           UPDATEIP,
           ISDELETE,
           INFLOWADDR,
           INFLOWADDRNO
   )
   VALUES
           (
                   '00003E4439844A0D84C07F5895C6B274',
                   '32020522954195',
                   'AB10',
                   'AA10',
                   '211121101',
                   '杈藉畞鐪佺洏閿﹀競澶ф醇鍘跨敯搴勫彴闀,
                   '2014-10-30 00:00:00',
                   '',
                   '',
                   '2014-10-30 00:00:000',
                   '320205001001',
                   '2014-10-30 00:00:00',
                   '瀵煎叆',
                   '172.0.0.1 ',
                   '2014-10-30 00:00:00',
                   '瀵煎叆',
                   '172.0.0.1', '', '', ''
           )
   [INFO ] 11:27:29.078 [ShardingSphere-Command-3] ShardingSphere-SQL - SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty, onDuplicateKeyColumns=Optional.empty)
   [INFO ] 11:27:29.078 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds_0 ::: INSERT INTO org.apache.shardingsphere.sharding.rewrite.token.pojo.TableToken@405a374c (
           ID,
           W_ID,
           FLOWREASON,
           FAMILYINFO,
           OUTFLWADDR,
           OUTFLWADDRNO,
           INFLOWDATE,
           PROCCARDNO,
           ISGETONLY,
           REPORTDATE,
           REPORTSITE,
           ADDTIME,
           ADDBY,
           ADDIP,
           UPDATETIME,
           UPDATEBY,
           UPDATEIP,
           ISDELETE,
           INFLOWADDR,
           INFLOWADDRNO
   )
   VALUES
           org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken@2512a189
   [ERROR] 11:27:29.081 [ShardingSphere-Command-3] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.shardingsphere.sharding.rewrite.token.pojo.TableToken@405a374c (
           ID,
   ' at line 1D,
           at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
           at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
           at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
           at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764)
           at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:781)
           at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:103)
           at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.accessor.impl.StatementAccessor.execute(StatementAccessor.java:43)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.executeSQL(ProxySQLExecutorCallback.java:84)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.executeSQL(ProxySQLExecutorCallback.java:77)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.executeSQL(ProxySQLExecutorCallback.java:48)
           at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.impl.DefaultSQLExecutorCallback.execute0(DefaultSQLExecutorCallback.java:75)
           at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.impl.DefaultSQLExecutorCallback.execute(DefaultSQLExecutorCallback.java:57)
           at org.apache.shardingsphere.infra.executor.kernel.ExecutorKernel.syncExecute(ExecutorKernel.java:99)
           at org.apache.shardingsphere.infra.executor.kernel.ExecutorKernel.parallelExecute(ExecutorKernel.java:95)
           at org.apache.shardingsphere.infra.executor.kernel.ExecutorKernel.execute(ExecutorKernel.java:78)
           at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.SQLExecutor.execute(SQLExecutor.java:65)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
           at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
           at org.apache.shardingsphere.proxy.backend.text.query.QueryBackendHandler.execute(QueryBackendHandler.java:61)
           at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
           at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
           at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:745)
   
   
   ### Reason analyze (If you can)
   I think the rewrite engine may have a bug ...
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   when I run a simple sql in mysql client:
   My sharding rules:
   
    ds_inline_Z_F_InFlowPeople:
         props:
           algorithm-expression: ds_$->{Long.valueOf(w_id) % 3}
         type: INLINE
       Z_F_InFlowPeople_inline:
         props:
           algorithm-expression: Z_F_InFlowPeople_$->{Long.valueOf(w_id) % 9}
   
   z_f_inflowpeople:
         actualDataNodes: ds_${0..2}.z_f_inflowpeople_${0..8}
         databaseStrategy:
           standard:
             shardingAlgorithmName: ds_inline_Z_F_InFlowPeople
             shardingColumn: w_id
         logicTable: z_f_inflowpeople
         tableStrategy:
           standard:
             shardingAlgorithmName: Z_F_InFlowPeople_inline
             shardingColumn: w_id
   
   when I run a simple sql like this :
   
   INSERT INTO z_f_inflowpeople (
   	ID,
   	W_ID,
   	FLOWREASON,
   	FAMILYINFO,
   	OUTFLWADDR,
   	OUTFLWADDRNO,
   	INFLOWDATE,
   	PROCCARDNO,
   	ISGETONLY,
   	REPORTDATE,
   	REPORTSITE,
   	ADDTIME,
   	ADDBY,
   	ADDIP,
   	UPDATETIME,
   	UPDATEBY,
   	UPDATEIP,
   	ISDELETE,
   	INFLOWADDR,
   	INFLOWADDRNO
   )
   VALUES
   	(
   		'00003E4439844A0D84C07F5895C6B274',
   		'32020522954195',
   		'AB10',
   		'AA10',
   		'211121101',
   		'辽宁省盘锦市大洼县田庄台镇',
   		'2014-10-30 00:00:00',
   		'',
   		'',
   		'2014-10-30 00:00:000',
   		'320205001001',
   		'2014-10-30 00:00:00',
   		'导入',
   		'172.0.0.1 ',
   		'2014-10-30 00:00:00',
   		'导入',
   		'172.0.0.1', '', '', ''
   	) 
   
   ### 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.

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



[GitHub] [shardingsphere] sandynz commented on issue #8664: rewrite sql cause a bug

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


   Looks `TableToken` miss `toString()` implementation, if routing go into `RouteSQLBuilder`, it should work, maybe routing go into `DefaultSQLBuilder`.


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