[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-18 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/15073


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-17 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79286493
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
@@ -316,6 +316,9 @@ class SparkSqlAstBuilder(conf: SQLConf) extends 
AstBuilder {
 }
 val options = 
Option(ctx.tablePropertyList).map(visitPropertyKeyValues).getOrElse(Map.empty)
 val provider = ctx.tableProvider.qualifiedName.getText
+if (provider.toLowerCase == "hive") {
+  throw new AnalysisException(s"Failed to find data source: $provider")
--- End diff --

Done. : )


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-17 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79281497
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
@@ -316,6 +316,9 @@ class SparkSqlAstBuilder(conf: SQLConf) extends 
AstBuilder {
 }
 val options = 
Option(ctx.tablePropertyList).map(visitPropertyKeyValues).getOrElse(Map.empty)
 val provider = ctx.tableProvider.qualifiedName.getText
+if (provider.toLowerCase == "hive") {
+  throw new AnalysisException(s"Failed to find data source: $provider")
--- End diff --

we should follow error message in other places: `Cannot create hive serde 
table with CREATE TABLE USING`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-16 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79275825
  
--- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/MetastoreDataSourcesSuite.scala
 ---
@@ -1151,6 +1152,56 @@ class MetastoreDataSourcesSuite extends QueryTest 
with SQLTestUtils with TestHiv
 }
   }
 
+  test("save API - format hive") {
+withTempDir { dir =>
+  val path = dir.getCanonicalPath
+  val e = intercept[AnalysisException] {
+
spark.range(10).write.format("hive").mode(SaveMode.Ignore).save(path)
+  }.getMessage
+  assert(e.contains("Failed to find data source: hive"))
+}
+  }
+
+  test("saveAsTable API - format hive") {
+val tableName = "tab1"
+withTable(tableName) {
+  val e = intercept[AnalysisException] {
+
spark.range(10).write.format("hive").mode(SaveMode.Overwrite).saveAsTable(tableName)
+  }.getMessage
+  assert(e.contains("Failed to find data source: hive"))
--- End diff --

Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-16 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79275783
  
--- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/MetastoreDataSourcesSuite.scala
 ---
@@ -1151,6 +1152,56 @@ class MetastoreDataSourcesSuite extends QueryTest 
with SQLTestUtils with TestHiv
 }
   }
 
+  test("save API - format hive") {
--- End diff --

uh... I see. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-16 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79122430
  
--- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/MetastoreDataSourcesSuite.scala
 ---
@@ -1151,6 +1152,56 @@ class MetastoreDataSourcesSuite extends QueryTest 
with SQLTestUtils with TestHiv
 }
   }
 
+  test("save API - format hive") {
+withTempDir { dir =>
+  val path = dir.getCanonicalPath
+  val e = intercept[AnalysisException] {
+
spark.range(10).write.format("hive").mode(SaveMode.Ignore).save(path)
+  }.getMessage
+  assert(e.contains("Failed to find data source: hive"))
+}
+  }
+
+  test("saveAsTable API - format hive") {
+val tableName = "tab1"
+withTable(tableName) {
+  val e = intercept[AnalysisException] {
+
spark.range(10).write.format("hive").mode(SaveMode.Overwrite).saveAsTable(tableName)
+  }.getMessage
+  assert(e.contains("Failed to find data source: hive"))
--- End diff --

after we address 
https://github.com/apache/spark/pull/15073/files#r79122288, we should follow 
https://github.com/apache/spark/pull/15073/files#diff-463cb1b0f60d87ada075a820f18e1104R262
 to generate error message for this case


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-16 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79122288
  
--- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/MetastoreDataSourcesSuite.scala
 ---
@@ -1151,6 +1152,56 @@ class MetastoreDataSourcesSuite extends QueryTest 
with SQLTestUtils with TestHiv
 }
   }
 
+  test("save API - format hive") {
--- End diff --

Oh sorry I missed this one, what I was asking is, we should only check the 
provider in `saveAsTable`, so that the `save` API is totally untounched.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-15 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79102224
  
--- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/MetastoreDataSourcesSuite.scala
 ---
@@ -1151,6 +1152,56 @@ class MetastoreDataSourcesSuite extends QueryTest 
with SQLTestUtils with TestHiv
 }
   }
 
+  test("save API - format hive") {
--- End diff --

Sure, change all of them to the message `Failed to find data source: hive`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-15 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/15073#discussion_r79102198
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala ---
@@ -80,6 +80,9 @@ final class DataFrameWriter[T] private[sql](ds: 
Dataset[T]) {
* @since 1.4.0
*/
   def format(source: String): DataFrameWriter[T] = {
+if (source.toLowerCase == "hive") {
--- End diff --

Done. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #15073: [SPARK-17518] [SQL] Block Users to Specify the In...

2016-09-12 Thread gatorsmile
GitHub user gatorsmile opened a pull request:

https://github.com/apache/spark/pull/15073

[SPARK-17518] [SQL] Block Users to Specify the Internal Data Source 
Provider Hive

### What changes were proposed in this pull request?
In Spark 2.1, we introduced a new internal provider `hive` for telling Hive 
serde tables from data source tables. This PR is to block users to specify this 
in `DataFrameWriter` and SQL APIs.  

### How was this patch tested?
Added a test case

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gatorsmile/spark formatHive

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/15073.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #15073


commit ef0fe2e644f121ae9e5a61d691d96c51b715b551
Author: gatorsmile 
Date:   2016-09-13T06:44:02Z

block users to provide the format hive.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org