[ 
https://issues.apache.org/jira/browse/FLINK-20200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17493097#comment-17493097
 ] 

godfrey he commented on FLINK-20200:
------------------------------------

https://www.mail-archive.com/user-zh@flink.apache.org/msg10502.html
https://www.mail-archive.com/user-zh@flink.apache.org/msg14632.html

The above fix is incomplete. Because class {{SqlTableRef}} is not copied to 
legacy planner, once both planner jars are in the lib directory, and the 
classloader loads the classes in legacy planner first (the class 
{{SqlTableRef}} in Calcite will be loaded, which is unexpected), the exception 
will occur. 
The solution is: copy {{SqlTableRef}} class in blink planner to legacy planner.

> SQL Hints are not supported in  "Create View" syntax
> ----------------------------------------------------
>
>                 Key: FLINK-20200
>                 URL: https://issues.apache.org/jira/browse/FLINK-20200
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.11.2
>            Reporter: shizhengchao
>            Assignee: godfrey he
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.3, 1.12.0
>
>
> 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:
> {code:java}
> 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)
> {code}
> The sql code is as follows:
> {code:java}
> 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;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to