gengliangwang commented on a change in pull request #24806: [SPARK-27856][SQL] 
Only allow type upcasting when inserting table
URL: https://github.com/apache/spark/pull/24806#discussion_r292077331
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala
 ##########
 @@ -356,8 +358,28 @@ case class PreprocessTableInsertion(conf: SQLConf) 
extends Rule[LogicalPlan] {
           s"including ${staticPartCols.size} partition column(s) having 
constant value(s).")
     }
 
-    val newQuery = DDLPreprocessingUtils.castAndRenameQueryOutput(
-      insert.query, expectedColumns, conf)
+    val newQuery = if 
(conf.getConf(SQLConf.LEGACY_INSERT_TABLE_TYPE_COERCION)) {
+      DDLPreprocessingUtils.castAndRenameQueryOutput(insert.query, 
expectedColumns, conf)
+    } else {
+      val errors = new mutable.ArrayBuffer[String]()
 
 Review comment:
   I check and I think it is workable. I will try moving it into the 
`ResolveOutputRelation` rule.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to