Ramin Gharib created FLINK-38081:
------------------------------------

             Summary: FLIP-528: Support EXPLAIN EXECUTE STATEMENT SET Syntax in 
Flink SQL
                 Key: FLINK-38081
                 URL: https://issues.apache.org/jira/browse/FLINK-38081
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Planner
            Reporter: Ramin Gharib


Apache Flink supports the {{STATEMENT SET}}  syntax to group and optimize 
multiple SQL statements, which is especially useful for reusing intermediate 
results in {{INSERT INTO}}  statements. Currently, a user can write and execute 
such a block using:
{panel}
{panel}
|{{EXECUTE}} {{STATEMENT }}{{SET}}
{{BEGIN}}
{{   }}{{INSERT}} {{INTO}} {{`sales` }}{{SELECT}} {{...;}}
{{   }}{{INSERT}} {{INTO}} {{`products` }}{{SELECT}} {{...;}}
{{{}END{}}}{{{};{}}}|

However, if a user wants to preview or debug the execution plan of such a block 
using {{{}EXPLAIN{}}}, the syntax must drop the {{EXECUTE}} keyword:
{panel}
{panel}
|{{EXPLAIN STATEMENT }}{{SET}}
{{BEGIN}}
{{   }}{{INSERT}} {{INTO}} {{`sales` }}{{SELECT}} {{...;}}
{{   }}{{INSERT}} {{INTO}} {{`products` }}{{SELECT}} {{...;}}
{{{}END{}}}{{{};{}}}|

This behavior is inconsistent and counterintuitive. Typically, {{EXPLAIN}} can 
be prepended to most SQL operations (e.g., {{{}EXPLAIN INSERT{}}}, {{{}EXPLAIN 
CREATE TABLE AS SELECT{}}}) without any syntactic modification. Requiring users 
to remove {{EXECUTE}} breaks this convention and leads to confusion.

This FLIP proposes extending Flink SQL to support the syntax {{EXPLAIN EXECUTE 
STATEMENT SET}}  to improve usability and consistency.

More details can be found under the 
[FLIP-528|https://cwiki.apache.org/confluence/display/FLINK/FLIP-528%3A+Support+EXPLAIN+EXECUTE+STATEMENT+SET+Syntax+in+Flink+SQL].



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

Reply via email to