diff --git a/flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl b/flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl index 7a32234dda6a00..2c7220a34b1ddd 100644 --- a/flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl +++ b/flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl @@ -166,7 +166,7 @@ SqlAlterCatalog SqlAlterCatalog() : SqlParserPos startPos; SqlIdentifier catalogName; SqlNodeList propertyList = SqlNodeList.EMPTY; - SqlCharStringLiteral comment = null; + SqlNode comment = null; } { { startPos = getPos(); } @@ -188,13 +188,12 @@ SqlAlterCatalog SqlAlterCatalog() : propertyList); } | - + + comment = StringLiteral() { - String p = SqlParserUtil.parseString(token.image); - comment = SqlLiteral.createCharString(p, getPos()); return new SqlAlterCatalogComment(startPos.plus(getPos()), - catalogName, - comment); + catalogName, + comment); } ) } diff --git a/flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterCatalogComment.java b/flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterCatalogComment.java index dfb6d5d28ee33d..02ee45a53016a2 100644 --- a/flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterCatalogComment.java +++ b/flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterCatalogComment.java @@ -24,7 +24,6 @@ import org.apache.calcite.sql.SqlWriter; import org.apache.calcite.sql.parser.SqlParserPos; import org.apache.calcite.util.ImmutableNullableList; -import org.apache.calcite.util.NlsString; import java.util.List; @@ -33,10 +32,10 @@ /** ALTER CATALOG catalog_name COMMENT 'comment'. */ public class SqlAlterCatalogComment extends SqlAlterCatalog { - private final SqlCharStringLiteral comment; + private final SqlNode comment; public SqlAlterCatalogComment( - SqlParserPos position, SqlIdentifier catalogName, SqlCharStringLiteral comment) { + SqlParserPos position, SqlIdentifier catalogName, SqlNode comment) { super(position, catalogName); this.comment = requireNonNull(comment, "comment cannot be null"); } @@ -46,8 +45,8 @@ public List getOperandList() { return ImmutableNullableList.of(catalogName, comment); } - public String getComment() { - return comment.getValueAs(NlsString.class).getValue(); + public SqlNode getComment() { + return comment; } @Override diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlAlterCatalogCommentConverter.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlAlterCatalogCommentConverter.java index 71fd042a6846fa..fced0bc5fe9bd4 100644 --- a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlAlterCatalogCommentConverter.java +++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SqlAlterCatalogCommentConverter.java @@ -22,6 +22,9 @@ import org.apache.flink.table.operations.Operation; import org.apache.flink.table.operations.ddl.AlterCatalogCommentOperation; +import org.apache.calcite.sql.SqlCharStringLiteral; +import org.apache.calcite.util.NlsString; + /** A converter for {@link SqlAlterCatalogComment}. */ public class SqlAlterCatalogCommentConverter implements SqlNodeConverter { @@ -29,6 +32,9 @@ public class SqlAlterCatalogCommentConverter implements SqlNodeConverter