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

    https://github.com/apache/spark/pull/13409#discussion_r65193366
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveTable.scala
 ---
    @@ -170,6 +170,13 @@ case class InsertIntoHiveTable(
         val partitionColumns = 
fileSinkConf.getTableInfo.getProperties.getProperty("partition_columns")
         val partitionColumnNames = 
Option(partitionColumns).map(_.split("/")).getOrElse(Array.empty)
     
    +    // All column names in the format of "<column name 1>,<column name 
2>,..."
    +    val columnsCnt = 
tableDesc.getProperties.getProperty("columns").split(",").size
    +
    +    if (columnsCnt + numDynamicPartitions != child.output.size) {
    +      throw new 
SparkException(ErrorMsg.TARGET_TABLE_COLUMN_MISMATCH.getMsg)
    --- End diff --
    
    - This check only catches cases when number of columns are different.  The 
error message would not be precise as it would say `column number/types are 
different`. 
    
    - You could also add other info to the exception: table names and column 
counts


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