Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-20200

SQL Hints are not supported in "Create View" syntax

    XMLWordPrintableJSON

Details

    Description

      I have aready set the config option `table.dynamic-table-options.enabled` to be true, but "SQL Hints" are not supported in View syntax. I got an error:

      Exception in thread "main" java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlSyntax$6: SPECIAL
      	at org.apache.calcite.util.Util.needToImplement(Util.java:967)
      	at org.apache.calcite.sql.SqlSyntax$6.unparse(SqlSyntax.java:116)
      	at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:333)
      	at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:470)
      	at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:101)
      	at org.apache.calcite.sql.SqlSelectOperator.unparse(SqlSelectOperator.java:176)
      	at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:470)
      	at org.apache.calcite.sql.SqlSelect.unparse(SqlSelect.java:246)
      	at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:151)
      	at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:173)
      	at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:182)
      	at org.apache.flink.table.planner.operations.SqlToOperationConverter.getQuotedSqlString(SqlToOperationConverter.java:784)
      	at org.apache.flink.table.planner.utils.Expander$Expanded.substitute(Expander.java:169)
      	at org.apache.flink.table.planner.operations.SqlToOperationConverter.convertViewQuery(SqlToOperationConverter.java:694)
      	at org.apache.flink.table.planner.operations.SqlToOperationConverter.convertCreateView(SqlToOperationConverter.java:665)
      	at org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:228)
      	at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:78)
      	at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:684)
      

      The sql code is as follows:

      drop table if exists SourceA;
      create table SourceA (
        id    string,
        name  string
      ) with (
        'connector' = 'kafka-0.11',
        'topic' = 'MyTopic',
        'properties.bootstrap.servers' = 'localhost:9092',
        'properties.group.id' = 'Test',
        'scan.startup.mode' = 'group-offsets',
        'format' = 'csv'
      );
      
      drop table if exists print;
      create table print (
        id    string,
        name  string
      ) with (
        'connector' = 'print'
      );
      
      drop view if exists test_view;
      create view test_view as
      select
        *
      from SourceA /*+ OPTIONS('properties.group.id'='NewGroup') */;
      
      insert into print
      select * from test_view;
      

      Attachments

        Issue Links

          Activity

            People

              godfreyhe godfrey he
              tinny shizhengchao
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: