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/06/09 16:25:24 UTC

[GitHub] [shardingsphere] ganzr edited a comment on issue #5960: sql must specify databaseName?

ganzr edited a comment on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-641086188


   **exception thrown by sharding-proxy:**
   [ERROR] 15:02:37.405 [ShardingSphere-Command-8] o.a.s.s.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: null
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitEscapedTableReference(MySQLDMLVisitor.java:491)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitEscapedTableReference(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$EscapedTableReferenceContext.accept(MySQLStatementParser.java:5947)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitTableReferences(MySQLDMLVisitor.java:484)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitTableReferences(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$TableReferencesContext.accept(MySQLStatementParser.java:5891)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitFromClause(MySQLDMLVisitor.java:476)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitFromClause(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$FromClauseContext.accept(MySQLStatementParser.java:5846)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:329)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectClauseContext.accept(MySQLStatementParser.java:4551)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:317)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$UnionClauseContext.accept(MySQLStatementParser.java:4446)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:309)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectContext.accept(MySQLStatementParser.java:3098)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:80)
           at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
           at org.apache.shardingsphere.shardingproxy.backend.text.TextProtocolBackendHandlerFactory.newInstance(TextProtocolBackendHandlerFactory.java:69)
           at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:65)
           at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:70)
           at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:59)
           at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:92)
           at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
   
   
   **sql: select * from BLOCK;**
   
   
   **confilg rules:**
   
   shardingRule:
    tables:
      BLOCK:
        actualDataNodes: ds_${0..1}.BLOCK
        tableStrategy:
          inline:
            shardingColumn: ID
            algorithmExpression: BLOCK_${ID % 2}
        keyGenerator:
          type: SNOWFLAKE
          column: ID
      STATE:
       actualDataNodes: ds_${0..1}.STATE
       tableStrategy:
         inline:
           shardingColumn: ID
           algorithmExpression: STATE_${ID % 2}
      TRANSACTION:
       actualDataNodes: ds_${0..1}.TRANSACTION
       tableStrategy:
         inline:
           shardingColumn: ID
           algorithmExpression: TRANSACTION_${ID % 2}
    bindingTables:
      - BLOCK,STATE,TRANSACTION
    broadcastTables:
      - BLOCK_CACHE,
    defaultDataSourceName: ds_0
    defaultDatabaseStrategy:
      inline:
        shardingColumn: ID
        algorithmExpression: ds_${ID % 2}
    defaultTableStrategy:
      none:
   
   **server config:**
   ![image](https://user-images.githubusercontent.com/20966436/84117900-cfeba580-aa64-11ea-9ad0-1b11863b53b1.png)
   
   


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