You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Kurt Young (Jira)" <ji...@apache.org> on 2020/10/15 06:38:00 UTC
[jira] [Commented] (FLINK-19649) In Flink's module
flink-sql-parser/sqlCreateTable/unparse, the tables without columns are
not supported.
[ https://issues.apache.org/jira/browse/FLINK-19649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17214466#comment-17214466 ]
Kurt Young commented on FLINK-19649:
------------------------------------
Good catch, feel free to open a pull request [~gsralex]
> In Flink's module flink-sql-parser/sqlCreateTable/unparse, the tables without columns are not supported.
> ---------------------------------------------------------------------------------------------------------
>
> Key: FLINK-19649
> URL: https://issues.apache.org/jira/browse/FLINK-19649
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.11.2
> Reporter: gsralex
> Priority: Minor
>
> In Flink's module flink-sql-parser, the sqlCreateTable.class unparse method
> The create table statement does not match the new rules of the print connector.
> The print connector supports this:
> {code:java}
> CREATE TABLE table_print WITH ('connector' = 'print') LIKE table (EXCLUDING ALL){code}
> When a print table is created without any columns, the parentheses must be omitted.
> However, the unparse generated statements in SqlCreateTable contain parentheses. This will affect the SqlCreateTable.toString() ,SqlCreateTable.toSqlString() methods.
> {code:java}
> CREATE TABLE table_print() WITH ('connector' = 'print') LIKE table (EXCLUDING ALL)
> {code}
> Might need to add the following to the unparse method for columnList.size > 0.
>
> {code:java}
> if (columnList.size() > 0) {
> SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.create("sds"), "(", ")");
> for (SqlNode column : columnList) {
> printIndent(writer);
> if (column instanceof SqlBasicCall) {
> SqlCall call = (SqlCall) column;
> SqlCall newCall = call.getOperator().createCall(
> SqlParserPos.ZERO,
> call.operand(1),
> call.operand(0));
> newCall.unparse(writer, leftPrec, rightPrec);
> } else {
> column.unparse(writer, leftPrec, rightPrec);
> }
> }
> if (tableConstraints.size() > 0) {
> for (SqlTableConstraint constraint : tableConstraints) {
> printIndent(writer);
> constraint.unparse(writer, leftPrec, rightPrec);
> }
> }
> if (watermark != null) {
> printIndent(writer);
> watermark.unparse(writer, leftPrec, rightPrec);
> }
> writer.newlineAndIndent();
> writer.endList(frame);
> }
> {code}
>
> My English isn't very good. I hope I've made myself clear. Thanks.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)