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/06/03 09:01:49 UTC

[GitHub] [shardingsphere] justbk2015 opened a new issue #10635: SQL join can't run on sharding-proxy

justbk2015 opened a new issue #10635:
URL: https://github.com/apache/shardingsphere/issues/10635


   ## Bug Report
   this sql can't right run on ss-proxy.
   ### Which version of ShardingSphere did you use?
   branch of opengauss_adapt 
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Sharding-Proxy
   ### Expected behavior
   run with no exception.
   ### Actual behavior
   run with exception. see error trace:
   ![image](https://user-images.githubusercontent.com/12265143/120617245-8160c380-c48c-11eb-8491-d18f3ddaf213.png)
   
   ### Reason analyze (If you can)
   logic table rewrite failed! if I rewrite with right sql, it's run with no error.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1. sharding-config:
       **bmsql_customer:**
         actualDataNodes: ds_${0..0}.bmsql_customer_${0..0}
         databaseStrategy:
           standard:
             shardingAlgorithmName: ds_bmsql_customer_inline
             shardingColumn: c_w_id
         tableStrategy:
           standard:
             shardingAlgorithmName: tb_bmsql_customer_inline
             shardingColumn: c_id
       **bmsql_warehouse:**
         actualDataNodes: ds_${0..0}.bmsql_warehouse_${0..0}
         databaseStrategy:
           standard:
             shardingAlgorithmName: ds_bmsql_warehouse_inline
             shardingColumn: w_id
         tableStrategy:
           standard:
             shardingAlgorithmName: tb_bmsql_warehouse_inline
             shardingColumn: w_id
   ------- all algorithm just mod with 1, like blow:
       tb_bmsql_warehouse_inline:
         props:
           algorithm-expression: bmsql_warehouse_${w_id % 1}
         type: INLINE
   2. table define:
   create table bmsql_warehouse (
     w_id        integer   not null,
     w_ytd       decimal(12,2),
     w_tax       decimal(4,4),
     w_name      varchar(10),
     w_street_1  varchar(20),
     w_street_2  varchar(20),
     w_city      varchar(20),
     w_state     char(2),
     w_zip       char(9)
   );
   create table bmsql_customer (
     c_w_id         integer        not null,
     c_d_id         integer        not null,
     c_id           integer        not null,
     c_discount     decimal(4,4),
     c_credit       char(2),
     c_last         varchar(16),
     c_first        varchar(16),
     c_credit_lim   decimal(12,2),
     c_balance      decimal(12,2),
     c_ytd_payment  decimal(12,2),
     c_payment_cnt  integer,
     c_delivery_cnt integer,
     c_street_1     varchar(20),
     c_street_2     varchar(20),
     c_city         varchar(20),
     c_state        char(2),
     c_zip          char(9),
     c_phone        char(16),
     c_since        timestamp,
     c_middle       char(2),
     c_data         varchar(500)
   );
   3. run sql
   "SELECT c_discount, c_last, c_credit, w_tax " +
                   "    FROM bmsql_customer c " +
                   "    JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) " +
                   "    WHERE c_w_id = ? AND c_d_id = ? AND c_id = ?" 
   with param 1, 3, 1912
   3. get result
   ![image](https://user-images.githubusercontent.com/12265143/120618064-4612c480-c48d-11eb-87df-056283f8c986.png)
   
   ### Example codes for reproduce this issue (such as a github link).
       @Test
       public void testSqlXx() throws SQLException {
           String sql = "SELECT c_discount, c_last, c_credit, w_tax " +
                   "    FROM bmsql_customer c " +
                   "    JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) " +
                   "    WHERE c_w_id = ? AND c_d_id = ? AND c_id = ?"
                   ;
           Object[] params = new Object[] {1, 3, 1912};
   
           try (PreparedStatement ps = conn.prepareStatement(sql)) {
               setPsParam(ps, params);
               ps.execute();
           }
       }
   
       private void setPsParam(PreparedStatement ps, Object[] params) {
           IntStream.range(0, params.length).forEach(idx -> {
               try {
                   ps.setObject(idx + 1, params[idx]);
               } catch (SQLException throwables) {
                   throwables.printStackTrace();
               }
           });
       }


-- 
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] wgy8283335 commented on issue #10635: SQL join can't run on sharding-proxy

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


   I'm glad to help with this issue.


-- 
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] TeslaCN commented on issue #10635: SQL join can't run on sharding-proxy

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






-- 
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] justbk2015 commented on issue #10635: SQL join can't run on sharding-proxy

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


   > @strongduanmu The exception in your log is caused by `;`.
   
   I have same problem in gsql client, as I know, gsql's sql must end with ";", so this is a problem too.


-- 
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] strongduanmu commented on issue #10635: SQL join can't run on sharding-proxy

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


   This exception is an error reported by calcite query optimization. @tristaZero Can you help look at this problem?
   
   ```
   [INFO ] 2021-06-03 19:24:19.266 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [ERROR] 2021-06-03 19:24:19.826 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLException: Error while preparing statement [SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;]
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:220)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:202)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:93)
   	at org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.execute(FederateJDBCExecutor.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.executeQuery(FederateJDBCExecutor.java:68)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.federateExecute(ProxySQLExecutor.java:153)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:114)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:98)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.text.PostgreSQLComQueryExecutor.execute(PostgreSQLComQueryExecutor.java:63)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	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:748)
   Caused by: java.lang.RuntimeException: parse failed: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:623)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:508)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:478)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:213)
   	... 18 common frames omitted
   Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:388)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:151)
   	at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:140)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:155)
   	at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:180)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:619)
   	... 22 common frames omitted
   Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:35588)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:35402)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:3739)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:199)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:153)
   	... 24 common frames omitted
   Exception in thread "Connection-2-ThreadExecutor" java.lang.NullPointerException
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.close(FederateJDBCExecutor.java:74)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.closeFederateExecutor(BackendConnection.java:302)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.closeExecutionResources(CommandExecutorTask.java:119)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
   	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:748)
   ```


-- 
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] strongduanmu commented on issue #10635: SQL join can't run on sharding-proxy

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


   This exception is an error reported by calcite query optimization. @tristaZero Can you help look at this problem?
   
   ```
   [INFO ] 2021-06-03 19:24:19.266 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [ERROR] 2021-06-03 19:24:19.826 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLException: Error while preparing statement [SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;]
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:220)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:202)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:93)
   	at org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.execute(FederateJDBCExecutor.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.executeQuery(FederateJDBCExecutor.java:68)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.federateExecute(ProxySQLExecutor.java:153)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:114)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:98)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.text.PostgreSQLComQueryExecutor.execute(PostgreSQLComQueryExecutor.java:63)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	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:748)
   Caused by: java.lang.RuntimeException: parse failed: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:623)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:508)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:478)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:213)
   	... 18 common frames omitted
   Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:388)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:151)
   	at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:140)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:155)
   	at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:180)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:619)
   	... 22 common frames omitted
   Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:35588)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:35402)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:3739)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:199)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:153)
   	... 24 common frames omitted
   Exception in thread "Connection-2-ThreadExecutor" java.lang.NullPointerException
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.close(FederateJDBCExecutor.java:74)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.closeFederateExecutor(BackendConnection.java:302)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.closeExecutionResources(CommandExecutorTask.java:119)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
   	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:748)
   ```


-- 
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 closed issue #10635: SQL join can't run on sharding-proxy

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


   


-- 
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] TeslaCN commented on issue #10635: SQL join can't run on sharding-proxy

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


   
   ```
   [INFO ] 2021-06-03 19:34:31.848 [Connection-6-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer JOIN bmsql_warehouse ON (w_id = c_w_id) WHERE c_w_id = ? AND c_d_id = ? AND c_id = ?
   [INFO ] 2021-06-03 19:34:31.848 [Connection-6-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2021-06-03 19:34:31.848 [Connection-6-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer JOIN bmsql_warehouse ON (w_id = c_w_id) WHERE c_w_id = ? AND c_d_id = ? AND c_id = ? ::: [1, 3, 1912]
   [ERROR] 2021-06-03 19:34:31.851 [Connection-6-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLException: Error while preparing statement [SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer JOIN bmsql_warehouse ON (w_id = c_w_id) WHERE c_w_id = ? AND c_d_id = ? AND c_id = ?]
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:220)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:202)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:93)
   	at org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.execute(FederateJDBCExecutor.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.executeQuery(FederateJDBCExecutor.java:68)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.federateExecute(ProxySQLExecutor.java:153)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:114)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:98)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.binary.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	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)
   Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 89 to line 1, column 92: Column 'w_id' not found in any table
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:467)
   	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:883)
   	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:868)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5043)
   	at org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:259)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:6015)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:6000)
   	at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:320)
   	at org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.visitChild(SqlShuttle.java:134)
   	at org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.visitChild(SqlShuttle.java:101)
   	at org.apache.calcite.sql.SqlOperator.acceptCall(SqlOperator.java:879)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visitScoped(SqlValidatorImpl.java:6033)
   	at org.apache.calcite.sql.validate.SqlScopedShuttle.visit(SqlScopedShuttle.java:50)
   	at org.apache.calcite.sql.validate.SqlScopedShuttle.visit(SqlScopedShuttle.java:33)
   	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.expand(SqlValidatorImpl.java:5609)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateJoin(SqlValidatorImpl.java:3261)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3196)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3461)
   	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
   	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1067)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1041)
   	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:232)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1016)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:724)
   	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:567)
   	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:242)
   	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:208)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:642)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:508)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:478)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:213)
   	... 17 common frames omitted
   Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Column 'w_id' not found in any table
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:467)
   	at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:560)
   	... 50 common frames omitted
   ```


-- 
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] strongduanmu edited a comment on issue #10635: SQL join can't run on sharding-proxy

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


   This exception is an error reported by calcite query optimization. @tristaZero Can you help look at this problem?
   
   ```
   [INFO ] 2021-06-03 19:24:19.266 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [ERROR] 2021-06-03 19:24:19.826 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLException: Error while preparing statement [SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;]
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:220)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:202)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:93)
   	at org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.execute(FederateJDBCExecutor.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.executeQuery(FederateJDBCExecutor.java:68)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.federateExecute(ProxySQLExecutor.java:153)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:114)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:98)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.text.PostgreSQLComQueryExecutor.execute(PostgreSQLComQueryExecutor.java:63)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	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:748)
   Caused by: java.lang.RuntimeException: parse failed: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:623)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:508)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:478)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:213)
   	... 18 common frames omitted
   Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:388)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:151)
   	at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:140)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:155)
   	at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:180)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:619)
   	... 22 common frames omitted
   Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:35588)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:35402)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:3739)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:199)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:153)
   	... 24 common frames omitted
   Exception in thread "Connection-2-ThreadExecutor" java.lang.NullPointerException
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.close(FederateJDBCExecutor.java:74)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.closeFederateExecutor(BackendConnection.java:302)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.closeExecutionResources(CommandExecutorTask.java:119)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
   	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:748)
   ```
   
   When I removed the semicolon, the following problem appeared.
   ```
   sharding_db=> SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   ERROR:  Cannot find JDBC type '3' in PostgreSQL column type
   ```


-- 
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] strongduanmu edited a comment on issue #10635: SQL join can't run on sharding-proxy

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


   This exception is an error reported by calcite query optimization. @tristaZero Can you help look at this problem?
   
   ```
   [INFO ] 2021-06-03 19:24:19.266 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLSelectStatement(limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2021-06-03 19:24:19.269 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   [ERROR] 2021-06-03 19:24:19.826 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLException: Error while preparing statement [SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;]
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:220)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:202)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:93)
   	at org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.execute(FederateJDBCExecutor.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.executeQuery(FederateJDBCExecutor.java:68)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.federateExecute(ProxySQLExecutor.java:153)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:114)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:98)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.text.PostgreSQLComQueryExecutor.execute(PostgreSQLComQueryExecutor.java:63)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	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:748)
   Caused by: java.lang.RuntimeException: parse failed: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:623)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:508)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:478)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:213)
   	... 18 common frames omitted
   Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:388)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:151)
   	at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:140)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:155)
   	at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:180)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:619)
   	... 22 common frames omitted
   Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered ";" at line 1, column 159.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "GROUP" ...
       "HAVING" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "WINDOW" ...
       "." ...
       "NOT" ...
       "IN" ...
       "<" ...
       "<=" ...
       ">" ...
       ">=" ...
       "=" ...
       "<>" ...
       "!=" ...
       "BETWEEN" ...
       "LIKE" ...
       "SIMILAR" ...
       "+" ...
       "-" ...
       "*" ...
       "/" ...
       "%" ...
       "||" ...
       "AND" ...
       "OR" ...
       "IS" ...
       "MEMBER" ...
       "SUBMULTISET" ...
       "CONTAINS" ...
       "OVERLAPS" ...
       "EQUALS" ...
       "PRECEDES" ...
       "SUCCEEDS" ...
       "IMMEDIATELY" ...
       "MULTISET" ...
       "[" ...
       "FORMAT" ...
       
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:35588)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:35402)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:3739)
   	at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:199)
   	at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:153)
   	... 24 common frames omitted
   Exception in thread "Connection-2-ThreadExecutor" java.lang.NullPointerException
   	at org.apache.shardingsphere.infra.executor.sql.federate.execute.FederateJDBCExecutor.close(FederateJDBCExecutor.java:74)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.closeFederateExecutor(BackendConnection.java:302)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.closeExecutionResources(CommandExecutorTask.java:119)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
   	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:748)
   ```
   
   When I removed the semicolon, the following problem appeared.
   ```
   sharding_db=> SELECT c_discount, c_last, c_credit, w_tax FROM bmsql_customer c JOIN bmsql_warehouse w ON (w.w_id = c.c_w_id) WHERE c_w_id = 1 AND c_d_id = 3 AND c_id = 1912;
   ERROR:  Cannot find JDBC type '3' in PostgreSQL column type
   ```


-- 
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] justbk2015 commented on issue #10635: SQL join can't run on sharding-proxy

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


   this is the complete config file:
   [config-sharding.zip](https://github.com/apache/shardingsphere/files/6603750/config-sharding.zip)
   


-- 
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] TeslaCN commented on issue #10635: SQL join can't run on sharding-proxy

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


   @strongduanmu The exception in your log is caused by `;`.


-- 
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 #10635: SQL join can't run on sharding-proxy

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


   Hi everyone,
   
   `Join` SQL for two sharding tables is supported now. But, I am unsure `;` of PostgreSQL can work well. It still needs test and fix. Please give it a look


-- 
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 edited a comment on issue #10635: SQL join can't run on sharding-proxy

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


   Hi everyone,
   
   `Join` SQL for two sharding tables is supported now. But, I am unsure `;` of PostgreSQL can work well. It still needs test and fix. Please give #10687  a look


-- 
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] justbk2015 commented on issue #10635: SQL join can't run on sharding-proxy

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


   > @strongduanmu The exception in your log is caused by `;`.
   
   I have same problem in gsql client, as I know, gsql's sql must end with ";", so this is a problem too.


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