fsk119 commented on a change in pull request #15402:
URL: https://github.com/apache/flink/pull/15402#discussion_r603220015
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
##########
@@ -181,7 +183,7 @@ class FlinkPlannerImpl(
queryString: String,
schemaPath: util.List[String],
viewPath: util.List[String])
- : RelRoot = {
+ : RelRoot = {
Review comment:
roll back
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
##########
@@ -94,9 +96,9 @@ class FlinkPlannerImpl(
catalogReader,
typeFactory,
SqlValidator.Config.DEFAULT
- .withIdentifierExpansion(true)
- // Disable implicit type coercion for now.
- .withTypeCoercionEnabled(false))
+ .withIdentifierExpansion(true)
+ // Disable implicit type coercion for now.
+ .withTypeCoercionEnabled(false))
Review comment:
Please use 2 space in scala file.
##########
File path:
flink-table/flink-sql-parser-hive/src/test/java/org/apache/flink/sql/parser/hive/FlinkHiveSqlParserImplTest.java
##########
@@ -482,4 +482,54 @@ public void testShowModules() {
sql("show full modules").ok("SHOW FULL MODULES");
}
+
+ @Test
+ public void testExplain() {
+ String sql = "explain plan for select * from emps";
+ String expected = "EXPLAIN SELECT *\n" + "FROM `EMPS`";
+ this.sql(sql).ok(expected);
+ }
+
+ @Test
+ public void testExplainJsonFormat() {
+ // Don't supported feature. Escape the test.
Review comment:
Unsupported feature.
##########
File path: flink-table/flink-sql-client/src/test/resources/sql/table.q
##########
@@ -204,3 +204,119 @@ drop table `mod`;
show tables;
Empty set
!ok
+
+# ==========================================================================
+# test explain
+# ==========================================================================
+
+CREATE TABLE IF NOT EXISTS orders (
+ `user` BIGINT NOT NULl,
+ product VARCHAR(32),
+ amount INT,
+ ts TIMESTAMP(3),
+ ptime AS PROCTIME(),
+ PRIMARY KEY(`user`) NOT ENFORCED,
+ WATERMARK FOR ts AS ts - INTERVAL '1' SECONDS
Review comment:
please style the DDL as above. Add " " before fields
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/batch/BatchTableEnvironmentTest.scala
##########
@@ -542,6 +542,9 @@ class BatchTableEnvironmentTest extends TableTestBase {
} catch {
case e: TableException =>
assertTrue(e.getMessage.contains("Only default behavior is supported
now"))
Review comment:
Remove this. It seems no one will getinto this branch? In my local
environment, the test passes.
##########
File path:
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/operations/ExplainOperation.java
##########
@@ -21,8 +21,8 @@
import java.util.Collections;
/**
- * Operation to describe an EXPLAIN statement. NOTES: currently, only default
behavior(EXPLAIN PLAN
- * FOR xx) is supported.
+ * Operation to describe an EXPLAIN statement. NOTES: currently, only default
behavior(EXPLAIN [plan
+ * for]* xx) is supported.
Review comment:
nit: Use UPPSER CASE "PLAN FOR"
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/stream/StreamTableEnvironmentTest.scala
##########
@@ -322,6 +322,10 @@ class StreamTableEnvironmentTest extends TableTestBase {
} catch {
case e: TableException =>
assertTrue(e.getMessage.contains("Only default behavior is supported
now"))
Review comment:
Remove this. It seems no one will getinto this branch? In my local
environment, the test passes.
##########
File path:
flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/dql/SqlRichExplain.java
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.sql.parser.dql;
+
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.SqlSpecialOperator;
+import org.apache.calcite.sql.SqlWriter;
+import org.apache.calcite.sql.parser.SqlParserPos;
+
+import java.util.Collections;
+import java.util.List;
+
+/** EXPLAIN (plan for)* STATEMENT sql call. */
Review comment:
Use upper case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]