Hisoka-X commented on code in PR #42763:
URL: https://github.com/apache/spark/pull/42763#discussion_r1351138719


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala:
##########
@@ -455,6 +457,19 @@ object TableOutputResolver {
     }
   }
 
+  def suitableForByNameCheck(
+      byName: Boolean,
+      expected: Seq[Attribute],
+      queryOutput: Seq[Attribute]): Unit = {
+    if (!byName && expected.size == queryOutput.size &&
+      expected.forall(e => queryOutput.exists(p => conf.resolver(p.name, 
e.name))) &&
+      expected.zip(queryOutput).exists(e => !conf.resolver(e._1.name, 
e._2.name))) {
+      logWarning("The query columns and the table columns have same names but 
different " +
+        "orders. You can use INSERT [INTO | OVERWRITE] BY NAME to reorder the 
query columns to " +
+        "align with the table columns.")

Review Comment:
   In the situation you metioned, the warning message will not show up. It only 
work when all field name equals but field name order mismatch.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to