Github user marmbrus commented on the pull request:

    https://github.com/apache/spark/pull/9202#issuecomment-152648785
  
    You have to put the subquery in parentheses so it results in valid SQL.
    On Oct 30, 2015 9:06 PM, "Rick Hillegas" <notificati...@github.com> wrote:
    
    > Thanks for that feedback, Michael. To answer your question:
    >
    > MA> I haven't looked closely at the implementation, but one high level
    > question is whether this is breaking the use case where a users gives a
    > subquery instead of a table name (i.e. dbtable = (SELECT ...).) This is an
    > important part of the API that we can't break.
    >
    > Reynold posed the same question at
    > 
https://issues.apache.org/jira/browse/SPARK-10857?focusedCommentId=14967827&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14967827
    > and I replied at
    > 
https://issues.apache.org/jira/browse/SPARK-10857?focusedCommentId=14967930&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14967930
    >
    > Can you give me an example of the syntax you have in mind which might trip
    > this problem? I tried the following experiment...
    >
    > val jdbcDF = sqlContext.read.format("jdbc").options(
    > Map("url" -> "jdbc:derby:/Users/rhillegas/derby/databases/derby1",
    > "dbtable" -> "select * from app.t")).load()
    >
    > ...but that statement doesn't tickle JdbcDialect.getTableExistsQuery().
    > Instead, the statement fails because the following ungrammatical query is
    > sent to the database:
    >
    > SELECT * FROM select * from app.t WHERE 1=0
    >
    > That, in turn, is because JDBCRDD.resolveTable() has its own hard-coded
    > query which probes for the existence of a table. I have logged
    > https://issues.apache.org/jira/browse/SPARK-11426 to track this issue.
    > The header comment on JDBCRDD.resolveTable() indicates that the method
    > expects a table name and not an arbitrary query.
    >
    > Thanks,
    > -Rick
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/9202#issuecomment-152638711>.
    >



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

Reply via email to