imback82 commented on a change in pull request #33676:
URL: https://github.com/apache/spark/pull/33676#discussion_r684720046



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -940,26 +940,33 @@ trait CheckAnalysis extends PredicateHelper with 
LookupCatalog {
    * Validates the options used for alter table commands after table and 
columns are resolved.
    */
   private def checkAlterTableCommand(alter: AlterTableCommand): Unit = {
-    def checkColumnNotExists(
-      op: String, fieldNames: Seq[String], struct: StructType, r: Resolver): 
Unit = {
-      if (struct.findNestedField(fieldNames, includeCollections = true, 
r).isDefined) {
+    def checkColumnNotExists(op: String, fieldNames: Seq[String], struct: 
StructType): Unit = {
+      if (struct.findNestedField(
+          fieldNames, includeCollections = true, 
alter.conf.resolver).isDefined) {

Review comment:
       capturing resolver directly from `alter` variable to simplify.

##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/connector/V2CommandsCaseSensitivitySuite.scala
##########
@@ -316,17 +316,34 @@ class V2CommandsCaseSensitivitySuite extends 
SharedSparkSession with AnalysisTes
     }
   }
 
+  test("SPARK-36449: Replacing columns with duplicate name should not be 
allowed") {
+    alterTableTest(
+      () => ReplaceColumns(

Review comment:
       need to create a new `ReplaceColumns`. Otherwise, `analyzed` will be set 
to true after the first iteration.




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