Ramin Gharib created FLINK-39957:
------------------------------------

             Summary: Support EXPLAIN CREATE [OR ALTER] MATERIALIZED TABLE 
statements
                 Key: FLINK-39957
                 URL: https://issues.apache.org/jira/browse/FLINK-39957
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API, Table SQL / Planner
            Reporter: Ramin Gharib
            Assignee: Ramin Gharib


h2. Problem

Running {{EXPLAIN}} against a {{CREATE [OR ALTER] MATERIALIZED TABLE ... AS 
SELECT}} statement fails with a parse error, blocking the ability to inspect 
query plans for materialized table definitions.
h2. Steps to reproduce

Run the following statement:
{code:java}
EXPLAIN CREATE OR ALTER MATERIALIZED TABLE mt     
  AS SELECT a, b, c     
  FROM t1;{code}
h2. Actual result

The statement fails with:
{quote}SQL parse failed. Unsupported CREATE OR REPLACE statement for EXPLAIN. 
The statement must define a query using the AS clause (i.e. CTAS/RTAS 
statements).
{quote}
This is misleading — the statement above does define a query using an {{AS}} 
clause, so the error message does not reflect what is actually happening.
h2. Expected result

{{EXPLAIN}} should be supported for {{CREATE [OR ALTER] MATERIALIZED TABLE ... 
AS SELECT}} statements and return the query plan, consistent with how it works 
for CTAS/RTAS.
h2. Impact

Without {{EXPLAIN}} support, users cannot inspect or validate query plans 
before creating materialized tables, which makes debugging and tuning 
materialized table definitions difficult.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to