[ https://issues.apache.org/jira/browse/CALCITE-6046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17775755#comment-17775755 ]
xiaogang zhou commented on CALCITE-6046: ---------------------------------------- Hi [~julianhyde] , The behavior I thought was wrong is when I use below code {code:java} // code placeholder SqlParser.Config parserConfig = getCurrentSqlParserConfig(sqlDialect); SqlParser sqlParser = SqlParser.create(sqlContent, parserConfig); SqlNodeList sqlNodeList = sqlParser.parseStmtList(); sqlParser.parse(sqlNodeList.get(0)); {code} to parse {code:java} // code placeholder CREATE TABLE source ( a BIGINT ) comment '测试test' WITH ( 'connector' = 'test' ); {code} then unparse it , I will get {code:java} // code placeholder CREATE TABLE `source` ( `a` BIGINT ) COMMENT u&'\5218\51eftest' WITH ( 'connector' = 'test' ) {code} which is not parsable by FLINK sql template {code:java} // code placeholder [ <COMMENT> <QUOTED_STRING> { String p = SqlParserUtil.parseString(token.image); comment = SqlLiteral.createCharString(p, getPos()); }] {code} Since you mentioned '&u' is Standard SQL DIALECT, I think there is nothing wrong in CALCITE. If the statement above makes sense to you, we can just close this CALCITE issue, and I will follow it in FLINK issue with FLINK TEAM. > QuoteStringLiteralUnicode returns unparsed string with u&' prefix, which will > cause the SqlLiteral > -------------------------------------------------------------------------------------------------- > > Key: CALCITE-6046 > URL: https://issues.apache.org/jira/browse/CALCITE-6046 > Project: Calcite > Issue Type: Improvement > Components: core > Affects Versions: 1.35.0 > Reporter: xiaogang zhou > Priority: Major > Fix For: 1.36.0 > > > quoteStringLiteralUnicode returns unparsed string with u&' prefix, which will > cause the SqlLiteral > > for example with a SQL > > {code:java} > // code placeholder > CREATE TABLE source ( > a BIGINT > ) comment '测试test' > WITH ( > 'connector' = 'test' > ); {code} > with a parsed Sqlnode, the toString will create a SQL like below, which is > not parsable again. > > {code:java} > // code placeholder > CREATE TABLE `source` ( > `a` BIGINT > ) > COMMENT u&'\5218\51eftest' WITH ( > 'connector' = 'test' > ) {code} > I think this is caused by > {code:java} > // code placeholder > public void quoteStringLiteralUnicode(StringBuilder buf, String val) { > buf.append("u&'"); {code} > not sure if I misconfigured something. Is it possiable to remove the > buf.append("u&'"); ? -- This message was sent by Atlassian Jira (v8.20.10#820010)