You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by hv...@apache.org on 2016/04/03 17:15:20 UTC
spark git commit: [SPARK-14341][SQL] Throw exception on unsupported
create / drop macro ddl
Repository: spark
Updated Branches:
refs/heads/master 1f0c5dceb -> c238cd074
[SPARK-14341][SQL] Throw exception on unsupported create / drop macro ddl
## What changes were proposed in this pull request?
We throw an AnalysisException that looks like this:
```
scala> sqlContext.sql("CREATE TEMPORARY MACRO SIGMOID (x DOUBLE) 1.0 / (1.0 + EXP(-x))")
org.apache.spark.sql.catalyst.parser.ParseException:
Unsupported SQL statement
== SQL ==
CREATE TEMPORARY MACRO SIGMOID (x DOUBLE) 1.0 / (1.0 + EXP(-x))
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.nativeCommand(ParseDriver.scala:66)
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser$$anonfun$parsePlan$1.apply(ParseDriver.scala:56)
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser$$anonfun$parsePlan$1.apply(ParseDriver.scala:53)
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:86)
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:53)
at org.apache.spark.sql.SQLContext.parseSql(SQLContext.scala:198)
at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:749)
... 48 elided
```
## How was this patch tested?
Add test cases in HiveQuerySuite.scala
Author: bomeng <bm...@us.ibm.com>
Closes #12125 from bomeng/SPARK-14341.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c238cd07
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c238cd07
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c238cd07
Branch: refs/heads/master
Commit: c238cd07448f94bbceb661daad90b6a6d597a846
Parents: 1f0c5dc
Author: bomeng <bm...@us.ibm.com>
Authored: Sun Apr 3 17:15:02 2016 +0200
Committer: Herman van Hovell <hv...@questtec.nl>
Committed: Sun Apr 3 17:15:02 2016 +0200
----------------------------------------------------------------------
.../antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 | 3 +++
.../spark/sql/hive/execution/HiveCompatibilitySuite.scala | 6 ++++--
.../org/apache/spark/sql/hive/execution/HiveQuerySuite.scala | 7 +++++++
3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/c238cd07/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
index f34bb06..6cf47b5 100644
--- a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
+++ b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
@@ -173,6 +173,8 @@ unsupportedHiveNativeCommands
| kw1=LOCK kw2=DATABASE
| kw1=UNLOCK kw2=TABLE
| kw1=UNLOCK kw2=DATABASE
+ | kw1=CREATE kw2=TEMPORARY kw3=MACRO
+ | kw1=DROP kw2=TEMPORARY kw3=MACRO
;
createTableHeader
@@ -759,6 +761,7 @@ SNAPSHOT: 'SNAPSHOT';
READ: 'READ';
WRITE: 'WRITE';
ONLY: 'ONLY';
+MACRO: 'MACRO';
IF: 'IF';
http://git-wip-us.apache.org/repos/asf/spark/blob/c238cd07/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
----------------------------------------------------------------------
diff --git a/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala b/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
index d8695bc..4b4f88e 100644
--- a/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
+++ b/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
@@ -363,7 +363,10 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
// Index commands are not supported
"drop_index",
"drop_index_removes_partition_dirs",
- "alter_index"
+ "alter_index",
+
+ // Macro commands are not supported
+ "macro"
)
/**
@@ -733,7 +736,6 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
"load_file_with_space_in_the_name",
"loadpart1",
"louter_join_ppr",
- "macro",
"mapjoin_distinct",
"mapjoin_filter_on_outerjoin",
"mapjoin_mapjoin",
http://git-wip-us.apache.org/repos/asf/spark/blob/c238cd07/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
index 5450368..b951948 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
@@ -1295,6 +1295,13 @@ class HiveQuerySuite extends HiveComparisonTest with BeforeAndAfter {
assertUnsupportedFeature {
sql("ALTER INDEX my_index ON my_table set IDXPROPERTIES (\"prop1\"=\"val1_new\")")}
}
+
+ test("create/drop macro commands are not supported") {
+ assertUnsupportedFeature {
+ sql("CREATE TEMPORARY MACRO SIGMOID (x DOUBLE) 1.0 / (1.0 + EXP(-x))")
+ }
+ assertUnsupportedFeature { sql("DROP TEMPORARY MACRO SIGMOID") }
+ }
}
// for SPARK-2180 test
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org