wdick closed pull request #23362: [MINOR][DOCS]Document subquery support for 
the `table` parameter
URL: https://github.com/apache/spark/pull/23362
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
index 9751528654ffb..cd5798d389863 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
@@ -235,6 +235,19 @@ class DataFrameReader private[sql](sparkSession: 
SparkSession) extends Logging {
    * Construct a `DataFrame` representing the database table accessible via 
JDBC URL
    * url named table and connection properties.
    *
+   * The `table` parameter can be based on a derived table, which is generated 
within the scope of
+   * a query FROM clause. For example, you could use this subquery as `table:
+   * {{{
+   *    "(SELECT * FROM customers WHERE ...) AS tmp"
+   * }}}
+   *
+   * @param url JDBC database url of the form `jdbc:subprotocol:subname`.
+   * @param table Name of the table in the external database.
+   * @param properties JDBC database connection arguments, a list of arbitrary 
string
+   *                             tag/value. Normally at least a "user" and 
"password" property
+   *                             should be included. "fetchsize" can be used 
to control the
+   *                             number of rows per fetch and "queryTimeout" 
can be used to wait
+   *                             for a Statement object to execute to the 
given number of seconds.
    * @since 1.4.0
    */
   def jdbc(url: String, table: String, properties: Properties): DataFrame = {
@@ -251,6 +264,13 @@ class DataFrameReader private[sql](sparkSession: 
SparkSession) extends Logging {
    * url named table. Partitions of the table will be retrieved in parallel 
based on the parameters
    * passed to this function.
    *
+   * The `table` parameter can be based on a derived table, which is generated 
within the scope of
+   * a query FROM clause. For example, you could use this subquery as `table:
+   * {{{
+   *    "(SELECT * FROM customers WHERE ...) AS tmp"
+   * }}}
+   *
+   *
    * Don't create too many partitions in parallel on a large cluster; 
otherwise Spark might crash
    * your external database systems.
    *


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to