[GitHub] spark pull request #18864: [SPARK-21648] [SQL] Fix confusing assert failure ...

2017-08-07 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 #18864: [SPARK-21648] [SQL] Fix confusing assert failure ...

2017-08-07 Thread dongjoon-hyun
Github user dongjoon-hyun commented on a diff in the pull request:

https://github.com/apache/spark/pull/18864#discussion_r131685410
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
 ---
@@ -29,17 +29,22 @@ class JdbcRelationProvider extends 
CreatableRelationProvider
   override def createRelation(
   sqlContext: SQLContext,
   parameters: Map[String, String]): BaseRelation = {
+import JDBCOptions._
+
 val jdbcOptions = new JDBCOptions(parameters)
 val partitionColumn = jdbcOptions.partitionColumn
 val lowerBound = jdbcOptions.lowerBound
 val upperBound = jdbcOptions.upperBound
 val numPartitions = jdbcOptions.numPartitions
 
 val partitionInfo = if (partitionColumn.isEmpty) {
-  assert(lowerBound.isEmpty && upperBound.isEmpty)
--- End diff --

Thank you for pinging me, @gatorsmile .


---
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 #18864: [SPARK-21648] [SQL] Fix confusing assert failure ...

2017-08-06 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/18864#discussion_r131574704
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
 ---
@@ -29,17 +29,22 @@ class JdbcRelationProvider extends 
CreatableRelationProvider
   override def createRelation(
   sqlContext: SQLContext,
   parameters: Map[String, String]): BaseRelation = {
+import JDBCOptions._
+
 val jdbcOptions = new JDBCOptions(parameters)
 val partitionColumn = jdbcOptions.partitionColumn
 val lowerBound = jdbcOptions.lowerBound
 val upperBound = jdbcOptions.upperBound
 val numPartitions = jdbcOptions.numPartitions
 
 val partitionInfo = if (partitionColumn.isEmpty) {
-  assert(lowerBound.isEmpty && upperBound.isEmpty)
--- End diff --

cc @dongjoon-hyun 


---
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 #18864: [SPARK-21648] [SQL] Fix confusing assert failure ...

2017-08-06 Thread gatorsmile
GitHub user gatorsmile opened a pull request:

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

[SPARK-21648] [SQL] Fix confusing assert failure in JDBC source when 
parallel fetching parameters are not properly provided.

### What changes were proposed in this pull request?
```SQL
CREATE TABLE mytesttable1 
USING org.apache.spark.sql.jdbc 
  OPTIONS ( 
  url 
'jdbc:mysql://${jdbcHostname}:${jdbcPort}/${jdbcDatabase}?user=${jdbcUsername}&password=${jdbcPassword}',
 
  dbtable 'mytesttable1', 
  paritionColumn 'state_id', 
  lowerBound '0', 
  upperBound '52', 
  numPartitions '53', 
  fetchSize '1' 
)
```

The above option name `paritionColumn` is wrong. That mean, users did not 
provide the value for `partitionColumn`. In such case, users hit a confusing 
error.

```
AssertionError: assertion failed
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:156)
at 
org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:39)
at 
org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:312)
```


### 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 jdbcPartCol

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

https://github.com/apache/spark/pull/18864.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 #18864


commit e4aac502d58972063a1ab25f17a1c217abe97b97
Author: gatorsmile 
Date:   2017-08-05T05:38:15Z

improve message.




---
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