Github user clockfly commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14921#discussion_r77292448
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala
 ---
    @@ -314,12 +314,8 @@ case class DataSource(
       /**
        * Create a resolved [[BaseRelation]] that can be used to read data from 
or write data into this
        * [[DataSource]]
    -   *
    -   * @param checkPathExist A flag to indicate whether to check the 
existence of path or not.
    -   *                       This flag will be set to false when we create 
an empty table (the
    -   *                       path of the table does not exist).
        */
    -  def resolveRelation(checkPathExist: Boolean = true): BaseRelation = {
    +  def resolveRelation(): BaseRelation = {
    --- End diff --
    
    @gatorsmile  I means write path.
    
    When createRelation() is called on a RelationProvider, RelationProvider may 
do some extra check to make sure the options provided are valid. We'd better 
enforce the check when trying to create a managed table.
    
    For example, JdbcRelationProvider will validate the options 
    ```
    class JdbcRelationProvider extends RelationProvider with DataSourceRegister 
{
    
      override def shortName(): String = "jdbc"
    
      /** Returns a new base relation with the given parameters. */
      override def createRelation(
          sqlContext: SQLContext,
          parameters: Map[String, String]): BaseRelation = {
        val jdbcOptions = new JDBCOptions(parameters)
        if (jdbcOptions.partitionColumn != null
          && (jdbcOptions.lowerBound == null
            || jdbcOptions.upperBound == null
            || jdbcOptions.numPartitions == null)) {
          sys.error("Partitioning incompletely specified")
        }
    
        val partitionInfo = if (jdbcOptions.partitionColumn == null) {
          null
        } else {
          JDBCPartitioningInfo(
            jdbcOptions.partitionColumn,
            jdbcOptions.lowerBound.toLong,
            jdbcOptions.upperBound.toLong,
            jdbcOptions.numPartitions.toInt)
        }
        val parts = JDBCRelation.columnPartition(partitionInfo)
        val properties = new Properties() // Additional properties that we will 
pass to getConnection
        parameters.foreach(kv => properties.setProperty(kv._1, kv._2))
        JDBCRelation(jdbcOptions.url, jdbcOptions.table, parts, 
properties)(sqlContext.sparkSession)
      }
    }
    
    ```



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