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

Jark Wu edited comment on FLINK-19670 at 5/10/21, 7:26 AM:
-----------------------------------------------------------

[~yr], you can copy {{SqlSnapshot}} to Flink under directory 
{{flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/sql}} 
and apply the fix in this commit [1].
You can also have a look at {{LogicalTableScan}} which we copied from Calcite. 
Note: the modification should be annotated with {{BEGIN FLINK MODIFICATION}} 
and {{END FLINK MODIFICATION}}, and explain the modification reason and Calcite 
JIRA issue.

Besides, you should also add tests (e.g. the example in this issue description) 
to verify this problem is resolved. 

[1]: 
https://github.com/apache/flink/blob/c6147f2df2e81c1b1db6aa43b3a827a8c4148af1/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/rel/logical/LogicalTableScan.java#L101



was (Author: jark):
[~yr], you can copy {{SqlSnapshot}} to Flink under directory 
{{flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/sql}} 
and apply the fix in this commit [1].
You can also have a look at {{LogicalTableScan}} which we copied from Calcite. 
Note: the modification should be annotated with {{BEGIN FLINK MODIFICATION}} 
and {{END FLINK MODIFICATION}}, and the modification reason and Calcite JIRA 
issue.

Besides, you should also add tests (e.g. the example in this issue description) 
to verify this problem is resolved. 

[1]: 
https://github.com/apache/flink/blob/c6147f2df2e81c1b1db6aa43b3a827a8c4148af1/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/rel/logical/LogicalTableScan.java#L101


> Query on a view of temporal join throws ParseException
> ------------------------------------------------------
>
>                 Key: FLINK-19670
>                 URL: https://issues.apache.org/jira/browse/FLINK-19670
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.11.1
>            Reporter: simenliuxing
>            Priority: Major
>              Labels: stale-major
>
> When I run a sql task with flink1.11.1 and blink planner, the following 
> syntax error appears, sql is as follows:
> {code:java}
> CREATE TABLE orders (
>   order_id INT,
>   product_id INT,
>   proctime AS PROCTIME()
> ) WITH (
>   'connector' = 'kafka',
>   'topic' = 'test',
>   'properties.bootstrap.servers' = 'localhost:9092',
>   'format' = 'json'
> );
> create table products(
>   pro_id  INT ,
>   product_name STRING,
>   PRIMARY  KEY (pro_id) NOT ENFORCED
> ) WITH  (
>   'connector'='jdbc',
>   'url'='jdbc:mysql://localhost:3306/test',
>   'username'='root',
>   'password'='root',
>   'table-name'='result4'
> );
> CREATE TABLE orders_info (
>   order_id INT,
>   pro_id INT,
>   product_name STRING
> ) WITH (
>     'connector' = 'print'
> );
> create view orders_view
> as
> SELECT
>     order_id,
>     pro_id,
>     product_name
> FROM orders
> LEFT JOIN products FOR SYSTEM_TIME AS OF orders.proctime
> ON orders.product_id = products.pro_id;
> INSERT INTO orders_info SELECT * FROM orders_view;
> {code}
> The error is as follows:
> {code:java}
> Caused by: org.apache.flink.sql.parser.impl.ParseException: Encountered "FOR" 
> at line 3, column 73.
> Was expecting one of:
>     <EOF> 
>     "EXCEPT" ...
>     "FETCH" ...
>     "GROUP" ...
>     "HAVING" ...
>     "INTERSECT" ...
>     "LIMIT" ...
>     "OFFSET" ...
>     "ON" ...
>     "ORDER" ...
>     "MINUS" ...
>     "TABLESAMPLE" ...
>     "UNION" ...
>     "USING" ...
>     "WHERE" ...
>     "WINDOW" ...
>     "(" ...
>     "NATURAL" ...
>     "JOIN" ...
>     "INNER" ...
>     "LEFT" ...
>     "RIGHT" ...
>     "FULL" ...
>     "CROSS" ...
>     "," ...
>     "OUTER" ...
>     
>       at 
> org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.generateParseException(FlinkSqlParserImpl.java:36086)
>       at 
> org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.jj_consume_token(FlinkSqlParserImpl.java:35900)
>       at 
> org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlStmtEof(FlinkSqlParserImpl.java:3801)
>       at 
> org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.parseSqlStmtEof(FlinkSqlParserImpl.java:248)
>       at 
> org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:161)
>       ... 25 more
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to