You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2016/10/08 00:59:28 UTC

spark git commit: [HOTFIX][BUILD] Do not use contains in Option in JdbcRelationProvider

Repository: spark
Updated Branches:
  refs/heads/master 94b24b84a -> 24850c941


[HOTFIX][BUILD] Do not use contains in Option in JdbcRelationProvider

## What changes were proposed in this pull request?

This PR proposes the fix the use of `contains` API which only exists from Scala 2.11.

## How was this patch tested?

Manually checked:

```scala
scala> val o: Option[Boolean] = None
o: Option[Boolean] = None

scala> o == Some(false)
res17: Boolean = false

scala> val o: Option[Boolean] = Some(true)
o: Option[Boolean] = Some(true)

scala> o == Some(false)
res18: Boolean = false

scala> val o: Option[Boolean] = Some(false)
o: Option[Boolean] = Some(false)

scala> o == Some(false)
res19: Boolean = true
```

Author: hyukjinkwon <gu...@gmail.com>

Closes #15393 from HyukjinKwon/hotfix.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/24850c94
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/24850c94
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/24850c94

Branch: refs/heads/master
Commit: 24850c9415bfe18dc1edf66e5a7b4c554fff4f23
Parents: 94b24b8
Author: hyukjinkwon <gu...@gmail.com>
Authored: Fri Oct 7 17:59:24 2016 -0700
Committer: Reynold Xin <rx...@databricks.com>
Committed: Fri Oct 7 17:59:24 2016 -0700

----------------------------------------------------------------------
 .../sql/execution/datasources/jdbc/JdbcRelationProvider.scala      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/24850c94/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
index 3a8a197..b1a061b 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
@@ -70,7 +70,7 @@ class JdbcRelationProvider extends CreatableRelationProvider
       if (tableExists) {
         mode match {
           case SaveMode.Overwrite =>
-            if (isTruncate && isCascadingTruncateTable(url).contains(false)) {
+            if (isTruncate && isCascadingTruncateTable(url) == Some(false)) {
               // In this case, we should truncate table and then load.
               truncateTable(conn, table)
               saveTable(df, url, table, props)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org