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/20 03:46:00 UTC

[jira] [Closed] (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:all-tabpanel ]

Kurt Young closed FLINK-19649.
------------------------------
    Fix Version/s: 1.12.0
         Assignee: gsralex
       Resolution: Fixed

fixed in 2a647735e9545634ab5829d48086d0ac2dd0dfda

> 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
>            Assignee: gsralex
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.12.0
>
>
> 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)