manxihuanchi opened a new issue, #26346:
URL: https://github.com/apache/shardingsphere/issues/26346

   ## Bug Report
   
   
   ### Which version of ShardingSphere did you use?
   shardingsphere-sql-parser-mysql  5.3.2
   shardingsphere-sql-parser-sql92   5.3.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   shardingsphere-sql-parser-sql92 5.3.2
   ### Expected behavior
   Can get COMMENT
   ### Actual behavior
   Can get COMMENT
   ### Reason analyze (If you can)
   package org.apache.shardingsphere.sql.parser.core;
   /**
    * Parse AST node.
    */
   @RequiredArgsConstructor
   public final class ParseASTNode implements ASTNode {
       
       private final ParseTree parseTree;
       
       private final CommonTokenStream tokenStream;
       
       /**
        * Get root node.
        * 
        * @return root node
        */
       public ParseTree getRootNode() {
           return parseTree.getChild(0);
       }
       
       /**
        * Get hidden tokens.
        * 
        * @return hidden tokens
        */
       public Collection<Token> getHiddenTokens() {
           Collection<Token> result = new LinkedList<>();
           for (Token each : tokenStream.getTokens()) {
               if (Token.HIDDEN_CHANNEL == each.getChannel()) {
   // each.getChannel()    Always 0
                   result.add(each);
               }
           }
           return result;
       }
   }
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   String oneSql = " CREATE TABLE `t_device`  (
     `device_number` varchar(255)  COMMENT '设备编号',
     `name` varchar(255)  COMMENT '设备名称',
     `specifications_models` varchar(255)  COMMENT '规格型号',
     `manufacturing_date` datetime(0)  COMMENT '制造日期',
     `manufacturers` varchar(255)  COMMENT '制造厂家',
     `start_use_date` varchar(255) COMMENT '启用日期',
     `installation_site` varchar(255)  COMMENT '安装地点',
     `brand` varchar(255)  COMMENT '品牌',
     `device_price` decimal(10, 2)  COMMENT '设备价格',
     `power` varchar(255)  COMMENT '功率'
   );";
   String databaseType = "MYSQL";
                   CacheOption cacheOption = new CacheOption(128, 1024L);
                SQLParserEngine parserEngine = new 
SQLParserEngine(databaseType, cacheOption);
                ParseASTNode parseASTNode = parserEngine.parse(oneSql, false);
                SQLVisitorEngine visitorEngine = new SQLVisitorEngine(sqlType, 
"STATEMENT", true, new Properties());
                SQLStatement sqlStatement = visitorEngine.visit(parseASTNode);
                TableSchema tableSchema = null;
                if (sqlStatement instanceof CreateTableStatement) {
                        CreateTableStatement statement = (CreateTableStatement) 
sqlStatement;
                        Collection<CommentSegment> commentSegments = 
statement.getCommentSegments();
                        // commentSegments  is null
                }


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to