You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ja...@apache.org on 2019/03/04 02:36:51 UTC
[flink] 01/01: [FLINK-11801] [table-common] Port SqlParserException
to flink-table-common
This is an automated email from the ASF dual-hosted git repository.
jark pushed a commit to branch sql-parse-exception
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 5ba73ca0b7a3c66f866ba6ad18f1caba73523c5e
Author: Jark Wu <im...@gmail.com>
AuthorDate: Mon Mar 4 10:36:23 2019 +0800
[FLINK-11801] [table-common] Port SqlParserException to flink-table-common
---
.../apache/flink/table/api/SqlParserException.java | 38 ++++++++++++++++++++++
.../org/apache/flink/table/api/exceptions.scala | 12 -------
.../flink/table/calcite/FlinkPlannerImpl.scala | 4 +--
3 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/SqlParserException.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/SqlParserException.java
new file mode 100644
index 0000000..c4b7d4a
--- /dev/null
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/SqlParserException.java
@@ -0,0 +1,38 @@
+/*
+ * 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.table.api;
+
+import org.apache.flink.annotation.PublicEvolving;
+
+/**
+ * Exception for all errors occurring during sql parsing.
+ *
+ * <p>This exception indicates that the SQL parse failed.
+ */
+@PublicEvolving
+public class SqlParserException extends RuntimeException {
+
+ public SqlParserException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public SqlParserException(String message) {
+ super(message);
+ }
+}
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/exceptions.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/exceptions.scala
index 7fc7de5..d2f32b5 100644
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/exceptions.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/exceptions.scala
@@ -29,18 +29,6 @@ import _root_.scala.collection.JavaConverters._
case class ExpressionParserException(msg: String) extends RuntimeException(msg)
/**
- * Exception for all errors occurring during sql parsing.
- */
-case class SqlParserException(
- msg: String,
- cause: Throwable)
- extends RuntimeException(msg, cause) {
-
- def this(msg: String) = this(msg, null)
-
-}
-
-/**
* Exception for unwanted method calling on unresolved expression.
*/
case class UnresolvedException(msg: String) extends RuntimeException(msg)
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
index 400279d..66e1e3c 100644
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
@@ -91,7 +91,7 @@ class FlinkPlannerImpl(
sqlNode
} catch {
case e: CSqlParseException =>
- throw SqlParserException(s"SQL parse failed. ${e.getMessage}", e)
+ throw new SqlParserException(s"SQL parse failed. ${e.getMessage}", e)
}
}
@@ -154,7 +154,7 @@ class FlinkPlannerImpl(
}
catch {
case e: CSqlParseException =>
- throw SqlParserException(s"SQL parse failed. ${e.getMessage}", e)
+ throw new SqlParserException(s"SQL parse failed. ${e.getMessage}", e)
}
val catalogReader: CalciteCatalogReader = createCatalogReader(false)
.withSchemaPath(schemaPath)