aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorYin Huai <yhuai@databricks.com>2015-10-13 18:21:24 -0700
committerYin Huai <yhuai@databricks.com>2015-10-13 18:21:24 -0700
commitce3f9a80657751ee0bc0ed6a9b6558acbb40af4f (patch)
tree80a2712b2be85bd21e3462d526532a9f873a4b7f /sql/hive
parent15ff85b3163acbe8052d4489a00bcf1d2332fcf0 (diff)
downloadspark-ce3f9a80657751ee0bc0ed6a9b6558acbb40af4f.tar.gz
spark-ce3f9a80657751ee0bc0ed6a9b6558acbb40af4f.tar.bz2
spark-ce3f9a80657751ee0bc0ed6a9b6558acbb40af4f.zip
[SPARK-11091] [SQL] Change spark.sql.canonicalizeView to spark.sql.nativeView.
https://issues.apache.org/jira/browse/SPARK-11091 Author: Yin Huai <yhuai@databricks.com> Closes #9103 from yhuai/SPARK-11091.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala2
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala2
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala14
3 files changed, 9 insertions, 9 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
index cf59bc0d59..1f8223e1ff 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
@@ -591,7 +591,7 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
case p: LogicalPlan if p.resolved => p
case CreateViewAsSelect(table, child, allowExisting, replace, sql) =>
- if (conf.canonicalizeView) {
+ if (conf.nativeView) {
if (allowExisting && replace) {
throw new AnalysisException(
"It is not allowed to define a view with both IF NOT EXISTS and OR REPLACE.")
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
index 250c232856..1d50501940 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
@@ -537,7 +537,7 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
serde = None,
viewText = Some(originalText))
- // We need to keep the original SQL string so that if `spark.sql.canonicalizeView` is
+ // We need to keep the original SQL string so that if `spark.sql.nativeView` is
// false, we can fall back to use hive native command later.
// We can remove this when parser is configurable(can access SQLConf) in the future.
val sql = context.getTokenRewriteStream
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
index 51b63f3688..6aa34605b0 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
@@ -1282,7 +1282,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
}
test("correctly parse CREATE VIEW statement") {
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("jt") {
val df = (1 until 10).map(i => i -> i).toDF("i", "j")
df.write.format("json").saveAsTable("jt")
@@ -1299,7 +1299,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
}
test("correctly handle CREATE VIEW IF NOT EXISTS") {
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("jt", "jt2") {
sqlContext.range(1, 10).write.format("json").saveAsTable("jt")
sql("CREATE VIEW testView AS SELECT id FROM jt")
@@ -1316,7 +1316,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
}
test("correctly handle CREATE OR REPLACE VIEW") {
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("jt", "jt2") {
sqlContext.range(1, 10).write.format("json").saveAsTable("jt")
sql("CREATE OR REPLACE VIEW testView AS SELECT id FROM jt")
@@ -1339,7 +1339,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
}
test("correctly handle ALTER VIEW") {
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("jt", "jt2") {
sqlContext.range(1, 10).write.format("json").saveAsTable("jt")
sql("CREATE VIEW testView AS SELECT id FROM jt")
@@ -1357,7 +1357,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
test("create hive view for json table") {
// json table is not hive-compatible, make sure the new flag fix it.
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("jt") {
sqlContext.range(1, 10).write.format("json").saveAsTable("jt")
sql("CREATE VIEW testView AS SELECT id FROM jt")
@@ -1369,7 +1369,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
test("create hive view for partitioned parquet table") {
// partitioned parquet table is not hive-compatible, make sure the new flag fix it.
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("parTable") {
val df = Seq(1 -> "a").toDF("i", "j")
df.write.format("parquet").partitionBy("i").saveAsTable("parTable")
@@ -1382,7 +1382,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
test("create hive view for joined tables") {
// make sure the new flag can handle some complex cases like join and schema change.
- withSQLConf(SQLConf.CANONICALIZE_VIEW.key -> "true") {
+ withSQLConf(SQLConf.NATIVE_VIEW.key -> "true") {
withTable("jt1", "jt2") {
sqlContext.range(1, 10).toDF("id1").write.format("json").saveAsTable("jt1")
sqlContext.range(1, 10).toDF("id2").write.format("json").saveAsTable("jt2")