Github user koeninger commented on a diff in the pull request:
https://github.com/apache/spark/pull/14502#discussion_r73713830
--- Diff: core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala ---
@@ -79,12 +79,18 @@ class JdbcRDD[T: ClassTag](
val conn = getConnection()
val stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY)
- // setFetchSize(Integer.MIN_VALUE) is a mysql driver specific way to
force streaming results,
- // rather than pulling entire resultset into memory.
- // see
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html
- if (conn.getMetaData.getURL.matches("jdbc:mysql:.*")) {
+ val url = conn.getMetaData.getURL
+ if (url.matches("jdbc:mysql:.*")) {
+ // setFetchSize(Integer.MIN_VALUE) is a mysql driver specific way to
force streaming results,
+ // rather than pulling entire resultset into memory.
+ // see
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html
+
stmt.setFetchSize(Integer.MIN_VALUE)
logInfo("statement fetch size set to: " + stmt.getFetchSize + " to
force MySQL streaming ")
+ } else if (url.matches("jdbc:postgresql:*")) {
--- End diff --
What I'm saying is that, at least at the time, the mysql driver ignored the
actual number set there, unless it was min value. It only used it to
toggle between "stream results" and "fetch all results", with nothing in
between.
On Fri, Aug 5, 2016 at 10:14 AM, Sean Owen <[email protected]> wrote:
> In core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala
> <https://github.com/apache/spark/pull/14502#discussion_r73708585>:
>
> > stmt.setFetchSize(Integer.MIN_VALUE)
> > logInfo("statement fetch size set to: " + stmt.getFetchSize + "
to force MySQL streaming ")
> > + } else if (url.matches("jdbc:postgresql:*")) {
>
> Yeah that's why the fetch size shouldn't be effectively infinite, but I
> think this mode means fetch one at a time, which is the other extreme.
What
> if this were, say, fetching 100 records at once? if that strikes you as
OK,
> maybe that's better for efficiency.
>
> â
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
>
<https://github.com/apache/spark/pull/14502/files/c45f8212add3ac7ce04edd0ea1b3903ff9782c6d#r73708585>,
> or mute the thread
>
<https://github.com/notifications/unsubscribe-auth/AAGABw12omb-phT0S8N4jjxTx1NGa_Nyks5qc1NwgaJpZM4JdU3L>
> .
>
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]