001package gudusoft.gsqlparser.nodes.flink;
002
003import gudusoft.gsqlparser.nodes.TParseTreeNode;
004
005/**
006 * AST node for Flink EXPLAIN statement.
007 *
008 * <p>Syntax:</p>
009 * <pre>
010 * EXPLAIN [([ExplainDetail[, ExplainDetail]*]) | PLAN FOR] &lt;statement&gt;
011 * </pre>
012 *
013 * <p>Where ExplainDetail can be:</p>
014 * <ul>
015 *   <li>ESTIMATED_COST - Shows estimated cost of each physical rel node</li>
016 *   <li>CHANGELOG_MODE - Shows changelog mode of each physical rel node</li>
017 *   <li>PLAN_ADVICE - Provides potential risk warnings and optimization advice</li>
018 *   <li>JSON_EXECUTION_PLAN - Shows JSON-format execution plan</li>
019 * </ul>
020 *
021 * <p>Examples:</p>
022 * <pre>
023 * EXPLAIN SELECT * FROM Orders;
024 * EXPLAIN PLAN FOR SELECT * FROM Orders;
025 * EXPLAIN ESTIMATED_COST, CHANGELOG_MODE SELECT * FROM Orders;
026 * EXPLAIN (ESTIMATED_COST, CHANGELOG_MODE) SELECT * FROM Orders;
027 * </pre>
028 *
029 * @since 3.2.0.0
030 */
031public class TFlinkExplainSqlNode extends TParseTreeNode {
032
033    private TParseTreeNode statementNode;
034
035    private boolean estimatedCost = false;
036    private boolean changelogMode = false;
037    private boolean planAdvice = false;
038    private boolean jsonExecutionPlan = false;
039    private boolean isPlanFor = false;
040
041    public TParseTreeNode getStatementNode() {
042        return statementNode;
043    }
044
045    public boolean isEstimatedCost() {
046        return estimatedCost;
047    }
048
049    public void setEstimatedCost(boolean estimatedCost) {
050        this.estimatedCost = estimatedCost;
051    }
052
053    public boolean isChangelogMode() {
054        return changelogMode;
055    }
056
057    public void setChangelogMode(boolean changelogMode) {
058        this.changelogMode = changelogMode;
059    }
060
061    public boolean isPlanAdvice() {
062        return planAdvice;
063    }
064
065    public void setPlanAdvice(boolean planAdvice) {
066        this.planAdvice = planAdvice;
067    }
068
069    public boolean isJsonExecutionPlan() {
070        return jsonExecutionPlan;
071    }
072
073    public void setJsonExecutionPlan(boolean jsonExecutionPlan) {
074        this.jsonExecutionPlan = jsonExecutionPlan;
075    }
076
077    public boolean isPlanFor() {
078        return isPlanFor;
079    }
080
081    public void setIsPlanFor(boolean isPlanFor) {
082        this.isPlanFor = isPlanFor;
083    }
084
085    /**
086     * Initialize node with just the statement (basic EXPLAIN).
087     * Called as: nf.createNode(ENodeType.T_FlinkExplainSqlNode.getId(), stmt)
088     */
089    public void init(Object arg1) {
090        this.statementNode = (TParseTreeNode) arg1;
091    }
092}