Skip to content

Commit

Permalink
Fix EXPLAIN(TYPE VALIDATE) of EXPLAIN queries
Browse files Browse the repository at this point in the history
Previously queries like `EXPLAIN (TYPE VALIDATE) EXPLAIN (TYPE IO)
SELECT 1`  would fail with the error "Non analyze explain should be
rewritten to Query". This adds proper support for such queries.
  • Loading branch information
rschlussel committed Aug 22, 2023
1 parent 8499cd3 commit 7edd2c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected Node visitExplain(Explain node, Void context)
throws SemanticException
{
if (isTypeValidate(node)) {
return node.getStatement();
return process(node.getStatement());
}

if (node.isAnalyze()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2564,6 +2564,14 @@ public void testExplainOfExplainAnalyze()
assertEquals(getOnlyElement(result.getOnlyColumnAsSet()), getExplainPlan("EXPLAIN ", query, LOGICAL));
}

@Test
public void testExplainValidateOfExplain()
{
String query = "EXPLAIN SELECT 1";
MaterializedResult result = computeActual("EXPLAIN (TYPE VALIDATE) " + query);
assertEquals(result.getOnlyValue(), true);
}

@Test
public void testExplainDdl()
{
Expand Down

0 comments on commit 7edd2c2

Please sign in to comment.