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/01/25 04:38:25 UTC

[GitHub] [shardingsphere] strongduanmu opened a new issue #15041: Exception occur when execute query which contains schema name in projections

strongduanmu opened a new issue #15041:
URL: https://github.com/apache/shardingsphere/issues/15041


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   262285d
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Execute successfully.
   
   ### Actual behavior
   
   ```
   [INFO ] 2022-01-25 12:33:52.092 [Connection-3-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT sharding_db.t_order.order_id FROM sharding_db.t_order
   [INFO ] 2022-01-25 12:33:52.092 [Connection-3-ThreadExecutor] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2022-01-25 12:33:52.092 [Connection-3-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT sharding_db.t_order_0.order_id FROM t_order_0 UNION ALL SELECT sharding_db.t_order_1.order_id FROM t_order_1
   [INFO ] 2022-01-25 12:33:52.092 [Connection-3-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_1 ::: SELECT sharding_db.t_order_0.order_id FROM t_order_0 UNION ALL SELECT sharding_db.t_order_1.order_id FROM t_order_1
   [ERROR] 2022-01-25 12:33:52.099 [Connection-3-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'sharding_db.t_order_0.order_id' in 'field list'
   	at sun.reflect.GeneratedConstructorAccessor41.newInstance(Unknown Source)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
   	at com.mysql.jdbc.Util.getInstance(Util.java:408)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
   	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
   	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
   	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
   	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
   	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
   	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2449)
   	at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
   	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:939)
   	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.executor.callback.impl.ProxyStatementExecutorCallback.execute(ProxyStatementExecutorCallback.java:40)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:73)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:66)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:44)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:101)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:97)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:82)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:71)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:154)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:125)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:117)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:128)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:69)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	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:96)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:69)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   Sharding rule:
   
   ```yaml
   schemaName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_1:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !SHARDING
     tables:
       t_order:
         actualDataNodes: ds_${0..1}.t_order_${0..1}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_inline
         keyGenerateStrategy:
           column: order_id
           keyGeneratorName: snowflake
       t_order_item:
         actualDataNodes: ds_${0..1}.t_order_item_${0..1}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_item_inline
         keyGenerateStrategy:
           column: order_item_id
           keyGeneratorName: snowflake
     bindingTables:
       - t_order,t_order_item
     defaultDatabaseStrategy:
       standard:
         shardingColumn: user_id
         shardingAlgorithmName: database_inline
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       database_inline:
         type: INLINE
         props:
           algorithm-expression: ds_${user_id % 2}
       t_order_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_${order_id % 2}
       t_order_item_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_item_${order_id % 2}
   
     keyGenerators:
       snowflake:
         type: SNOWFLAKE
   
     scalingName: default_scaling
     scaling:
       default_scaling:
         input:
           workerThread: 40
           batchSize: 1000
           rateLimiter:
             type: QPS
             props:
               qps: 50
         output:
           workerThread: 40
           batchSize: 1000
           rateLimiter:
             type: TPS
             props:
               tps: 2000
         streamChannel:
           type: MEMORY
           props:
             block-queue-size: 10000
         completionDetector:
           type: IDLE
           props:
             incremental-task-idle-minute-threshold: 30
         dataConsistencyChecker:
           type: DATA_MATCH
           props:
             chunk-size: 1000
   ```
   
   Execute sql:
   
   ```sql
   mysql> SELECT sharding_db.t_order.order_id FROM sharding_db.t_order;
   ERROR 1054 (42S22): Unknown column 'sharding_db.t_order_0.order_id' in 'field list'
   ```
   
   ### 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

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



[GitHub] [shardingsphere] menghaoranss closed issue #15041: Exception occur when execute query which contains schema name in projections

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


   


-- 
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] menghaoranss closed issue #15041: Exception occur when execute query which contains schema name in projections

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


   


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