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

    https://github.com/apache/spark/pull/18266#discussion_r134797984
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
 ---
    @@ -768,6 +769,25 @@ object JdbcUtils extends Logging {
       }
     
       /**
    +   * Parses the user specified customDataFrameColumnTypes option value 
string, and returns
    +   */
    +  def parseUserSpecifiedColumnTypes(
    +       schema: StructType,
    +       columnTypes: String,
    +       nameEquality: Resolver): StructType = {
    +    val userSchema = CatalystSqlParser.parseTableSchema(columnTypes)
    +    // This is resolved by names, only check the column names.
    +    userSchema.fieldNames.foreach { col =>
    +      schema.find(f => nameEquality(f.name, col)).getOrElse {
    +        throw new AnalysisException(
    +          s"${JDBCOptions.JDBC_CUSTOM_DATAFRAME_COLUMN_TYPES} option 
column $col not found in " +
    +            s"schema ${schema.catalogString}")
    +      }
    +    }
    +    userSchema
    --- End diff --
    
    What is your expected behaviors when users-specified schema does not 
include all the columns of the underlying table schema?


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