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

    https://github.com/apache/spark/pull/18266#discussion_r135025945
  
    --- 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 --
    
    OK, I'll ask user to specified all the columns.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to