[jira] [Created] (FLINK-19670) Create view error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-19670) Create view error

Shang Yuanchun (Jira)
simenliuxing created FLINK-19670:
------------------------------------

             Summary: Create view error
                 Key: FLINK-19670
                 URL: https://issues.apache.org/jira/browse/FLINK-19670
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 1.11.1
            Reporter: simenliuxing
             Fix For: 1.11.2


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)