You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yueqianzhu <gi...@git.apache.org> on 2015/11/06 05:55:07 UTC

[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

GitHub user yueqianzhu opened a pull request:

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

    [SPARK-11547] set fetchSize default value in JDBCRDD

    if I do not set any properties manual for jdbc, when I show the data in the table, it will throw an exception like below:
    Exception in thread "main" java.lang.NullPointerException
    	at java.util.Hashtable.putAll(Hashtable.java:522)
    	at org.apache.spark.sql.DataFrameReader.jdbc(DataFrameReader.scala:205)
    	at org.apache.spark.sql.DataFrameReader.jdbc(DataFrameReader.scala:130)
    
    my test code:
    //sqlContext : An existing SparkContext
        val df1 = sqlContext.read.jdbc("jdbc:mysql://IP:PORT/XXX?user=XXX&password=XXX","tablename",null)
        df1.show
    
    This PR Makes it easier to operate, especially for a novice.
    https://issues.apache.org/jira/browse/SPARK-11547

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

    $ git pull https://github.com/yueqianzhu/spark my_change

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

    https://github.com/apache/spark/pull/9515.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 #9515
    
----
commit 7a1b8223c1c4adf88e26e03d99ac2380532c4055
Author: yueqian_zhu <yu...@163.com>
Date:   2015-11-06T03:35:59Z

    set fetchSize in file JDBCRDD.scala default value to "10"

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by yueqianzhu <gi...@git.apache.org>.
Github user yueqianzhu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9515#discussion_r44112438
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala ---
    @@ -369,7 +369,7 @@ private[sql] class JDBCRDD(
         val sqlText = s"SELECT $columnList FROM $fqTable $myWhereClause"
         val stmt = conn.prepareStatement(sqlText,
             ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    -    val fetchSize = properties.getProperty("fetchsize", "0").toInt
    +    val fetchSize = properties.getProperty("fetchsize", "10").toInt
    --- End diff --
    
    Yes, my mistake. It's due to null properties object.
    Is this better to provide a jdbc API like below:
    def jdbc(url: String, table: String): DataFrame = {
        jdbc(url, table, new Properties())
      }
    I think "properties" meaning is a non essential,so I always use null to test first time.
    
    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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9515#issuecomment-154285807
  
    Can one of the admins verify this patch?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9515#discussion_r44109540
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala ---
    @@ -369,7 +369,7 @@ private[sql] class JDBCRDD(
         val sqlText = s"SELECT $columnList FROM $fqTable $myWhereClause"
         val stmt = conn.prepareStatement(sqlText,
             ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    -    val fetchSize = properties.getProperty("fetchsize", "0").toInt
    +    val fetchSize = properties.getProperty("fetchsize", "10").toInt
    --- End diff --
    
    It's not clear it's efficient to limit this to 10 by default. How does this relate to the NPE though? it's due to a null properties object.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9515#discussion_r44147597
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala ---
    @@ -369,7 +369,7 @@ private[sql] class JDBCRDD(
         val sqlText = s"SELECT $columnList FROM $fqTable $myWhereClause"
         val stmt = conn.prepareStatement(sqlText,
             ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    -    val fetchSize = properties.getProperty("fetchsize", "0").toInt
    +    val fetchSize = properties.getProperty("fetchsize", "10").toInt
    --- End diff --
    
    I'm not sure I understand. This change is unrelated to the problem you're discussing. Are you going to update or close them?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by yueqianzhu <gi...@git.apache.org>.
Github user yueqianzhu closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by yueqianzhu <gi...@git.apache.org>.
Github user yueqianzhu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9515#discussion_r44114822
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala ---
    @@ -369,7 +369,7 @@ private[sql] class JDBCRDD(
         val sqlText = s"SELECT $columnList FROM $fqTable $myWhereClause"
         val stmt = conn.prepareStatement(sqlText,
             ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    -    val fetchSize = properties.getProperty("fetchsize", "0").toInt
    +    val fetchSize = properties.getProperty("fetchsize", "10").toInt
    --- End diff --
    
    It's not an error,I just provide a simplest API if no any properties supplied.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-11547] set fetchSize default value in J...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9515#discussion_r44112875
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala ---
    @@ -369,7 +369,7 @@ private[sql] class JDBCRDD(
         val sqlText = s"SELECT $columnList FROM $fqTable $myWhereClause"
         val stmt = conn.prepareStatement(sqlText,
             ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    -    val fetchSize = properties.getProperty("fetchsize", "0").toInt
    +    val fetchSize = properties.getProperty("fetchsize", "10").toInt
    --- End diff --
    
    I think you could either change this to throw a more explicit error with `require`, or make a new object if none is supplied.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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