[
https://issues.apache.org/jira/browse/FLINK-35935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17871856#comment-17871856
]
Xingcan Cui edited comment on FLINK-35935 at 8/8/24 5:39 AM:
-------------------------------------------------------------
hi [~xuyangzhong] , it looks like this doesn't work for the filesystem
connector. For instance
{code:java}
CREATEOR REPLACE TABLE `default_catalog`.`default_database`.`test` WITH (
'connector' = 'filesystem', 'path' = 'path', 'sink.parallelism' = '1',
'format' = 'json') AS ( SELECT * FROM table WHERE dt = '2024-08-05' LIMIT 10)
{code}
`FETCH NEXT 10 ROWS ONLY` was added twice to the inner query.
{code:java}
Caused by: java.lang.AssertionError: not a query: SELECT * FROM `table`
WHERE `table`.`dt` = '2024-08-05'
FETCH NEXT 10 ROWS ONLY
FETCH NEXT 10 ROWS ONLY
{code}
was (Author: xccui):
hi [~xuyangzhong] , it looks like this doesn't for the filesystem connector.
For instance
{code:java}
CREATEOR REPLACE TABLE `default_catalog`.`default_database`.`test` WITH (
'connector' = 'filesystem', 'path' = 'path', 'sink.parallelism' = '1',
'format' = 'json') AS ( SELECT * FROM table WHERE dt = '2024-08-05' LIMIT 10)
{code}
> CREATE TABLE AS doesn't work with LIMIT
> ---------------------------------------
>
> Key: FLINK-35935
> URL: https://issues.apache.org/jira/browse/FLINK-35935
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.18.1
> Reporter: Xingcan Cui
> Priority: Major
>
> {code:java}
> CREATE TABLE WITH (foo) AS (SELECT * FROM bar LIMIT 5){code}
> The above statement throws "Caused by: java.lang.AssertionError: not a query:
> " exception.
> A workaround is to wrap the query with CTE.
> {code:java}
> CREATE TABLE WITH (foo) AS (WITH R AS (SELECT * FROM bar LIMIT 5) SELECT *
> FROM R){code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)