Pramy commented on issue #3155: Sharding jdbc parse sql statement which have a table name alias as T whill case error URL: https://github.com/apache/incubator-shardingsphere/issues/3155#issuecomment-538067563 i use official *.g4 to build `MySqlParser` and `MySqlLexer` [https://github.com/antlr/grammars-v4/tree/master/mysql/Positive-Technologies](https://github.com/antlr/grammars-v4/tree/master/mysql/Positive-Technologies) try to parser `SELECT T.* FROM TS_ORDER T WHERE T.ID = 3` ``` public static void main(String[] args) { CharStream input = CharStreams.fromString("SELECT T.* FROM TS_ORDER T WHERE T.ID = 3"); Lexer lexer = new MySqlLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); MySqlParser parser = new MySqlParser(tokens); MySqlParser.SelectStatementContext tree = parser.selectStatement(); System.out.println(tree.toStringTree(parser)); System.out.println(tree.getChild(0).getChild(1).getText()); } ``` it is working ``` (selectStatement (querySpecification SELECT (selectElements (selectElement (fullId (uid (simpleId T))) . *)) (fromClause FROM (tableSources (tableSource (tableSourceItem (tableName (fullId (uid (simpleId TS_ORDER)))) (uid (simpleId T))))) WHERE (expression (predicate (predicate (expressionAtom (fullColumnName (uid (simpleId T)) (dottedId .ID)))) (comparisonOperator =) (predicate (expressionAtom (constant (decimalLiteral 3))))))))) T.* ``` I am sorry that I am not good at `antlr`, so I can only do so much.
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
