[ https://issues.apache.org/jira/browse/SPARK-5472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14299633#comment-14299633
]
Anand Mohan Tumuluri commented on SPARK-5472:
---------------------------------------------
Pardon my ignorance but I think
JdbcRdd can be given a ResultSet to case class mapper which will yield a RDD[case class]
Any RDD[case class] (RDD[Product]) can be converted into a SchemaRDD by using createSchemaRDD
method of SQL/HiveContext. This SchemaRDD can then be registered as a temp table within Spark
SQL through registerTempTable and then can be joined to other Spark SQL tables.
This solves the use case of loading data from a JDBC data source, isn't it? Am I missing something.
Ofcourse this requires Scala and Spark-shell, meaning it cant be done from spark-sql or thriftserver2.
Howeer there currently is no easy way of saving a RDD into a JDBC data sink. (DbOutputFormat
is way too rigid).
This PR, providing a generic mechanism for saving SchemaRDD into a RDBMS table, will be very
valuable for us.
> Add support for reading from and writing to a JDBC database
> -----------------------------------------------------------
>
> Key: SPARK-5472
> URL: https://issues.apache.org/jira/browse/SPARK-5472
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Reporter: Tor Myklebust
> Assignee: Tor Myklebust
> Priority: Blocker
>
> It would be nice to be able to make a table in a JDBC database appear as a table in Spark
SQL. This would let users, for instance, perform a JOIN between a DataFrame in Spark SQL
with a table in a Postgres database.
> It might also be nice to be able to go the other direction -- save a DataFrame to a database
-- for instance in an ETL job.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org
|