diff --git a/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ExplainRewrite.java b/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ExplainRewrite.java index 0bc7de7b9e80..24a91125be39 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ExplainRewrite.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ExplainRewrite.java @@ -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()) { diff --git a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java index 84131b828b09..1c0fd8ccdab7 100644 --- a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java +++ b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java @@ -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() {