Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-17955

Use the same read path in DataFrameReader.jdbc and DataFrameReader.format("jdbc")

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 2.1.0
    • SQL
    • None

    Description

      It seems APIs in DataFrameReader/DataFrameWriter share format("...").load() or format("...").save() APIs for json(...)/csv(...) and etc.

      We can share this within DataFrameReader.jdbc(...) too consistently with other APIs.

      -    // connectionProperties should override settings in extraOptions.
      -    val params = extraOptions.toMap ++ connectionProperties.asScala.toMap
      -    val options = new JDBCOptions(url, table, params)
      -    val relation = JDBCRelation(parts, options)(sparkSession)
      -    sparkSession.baseRelationToDataFrame(relation)
      +    // connectionProperties should override settings in extraOptions
      +    this.extraOptions = this.extraOptions ++ (connectionProperties.asScala)
      +    // explicit url and dbtable should override all
      +    this.extraOptions += ("url" -> url, "dbtable" -> table)
      +    format("jdbc").load()
      

      Attachments

        Activity

          People

            gurwls223 Hyukjin Kwon
            gurwls223 Hyukjin Kwon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: