This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new a41d0ae79b43 [SPARK-48176][SQL] Adjust name of FIELD_ALREADY_EXISTS 
error condition
a41d0ae79b43 is described below

commit a41d0ae79b432e2757379fc56a0ad2755f02e871
Author: Nicholas Chammas <nicholas.cham...@gmail.com>
AuthorDate: Fri May 10 12:23:34 2024 +0900

    [SPARK-48176][SQL] Adjust name of FIELD_ALREADY_EXISTS error condition
    
    ### What changes were proposed in this pull request?
    
    Rename `FIELDS_ALREADY_EXISTS` to `FIELD_ALREADY_EXISTS`.
    
    ### Why are the changes needed?
    
    Though it's not meant to be a proper English sentence, 
`FIELDS_ALREADY_EXISTS` is grammatically incorrect. It should either be "fields 
already exist[]" or "field[] already exists". I opted for the latter.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, it changes the name of an error condition.
    
    ### How was this patch tested?
    
    CI only.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #46510 from nchammas/SPARK-48176-field-exists-error.
    
    Authored-by: Nicholas Chammas <nicholas.cham...@gmail.com>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 common/utils/src/main/resources/error/error-conditions.json           | 2 +-
 .../src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala      | 4 ++--
 .../scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala  | 2 +-
 .../test/scala/org/apache/spark/sql/connector/AlterTableTests.scala   | 4 ++--
 .../apache/spark/sql/connector/V2CommandsCaseSensitivitySuite.scala   | 4 ++--
 .../sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala     | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/common/utils/src/main/resources/error/error-conditions.json 
b/common/utils/src/main/resources/error/error-conditions.json
index 8a64c4c590e8..7c9886c749b9 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -1339,7 +1339,7 @@
     ],
     "sqlState" : "54001"
   },
-  "FIELDS_ALREADY_EXISTS" : {
+  "FIELD_ALREADY_EXISTS" : {
     "message" : [
       "Cannot <op> column, because <fieldNames> already exists in <struct>."
     ],
diff --git 
a/connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala
 
b/connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala
index c80fbfc748dd..b60107f90283 100644
--- 
a/connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala
+++ 
b/connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala
@@ -107,7 +107,7 @@ private[v2] trait V2JDBCTest extends SharedSparkSession 
with DockerIntegrationFu
         exception = intercept[AnalysisException] {
           sql(s"ALTER TABLE $catalogName.alt_table ADD COLUMNS (C3 DOUBLE)")
         },
-        errorClass = "FIELDS_ALREADY_EXISTS",
+        errorClass = "FIELD_ALREADY_EXISTS",
         parameters = Map(
           "op" -> "add",
           "fieldNames" -> "`C3`",
@@ -179,7 +179,7 @@ private[v2] trait V2JDBCTest extends SharedSparkSession 
with DockerIntegrationFu
         exception = intercept[AnalysisException] {
           sql(s"ALTER TABLE $catalogName.alt_table RENAME COLUMN ID1 TO ID2")
         },
-        errorClass = "FIELDS_ALREADY_EXISTS",
+        errorClass = "FIELD_ALREADY_EXISTS",
         parameters = Map(
           "op" -> "rename",
           "fieldNames" -> "`ID2`",
diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
index e55f23b6aa86..e18f4d1b36e1 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
@@ -1403,7 +1403,7 @@ trait CheckAnalysis extends PredicateHelper with 
LookupCatalog with QueryErrorsB
       if (struct.findNestedField(
           fieldNames, includeCollections = true, 
alter.conf.resolver).isDefined) {
         alter.failAnalysis(
-          errorClass = "FIELDS_ALREADY_EXISTS",
+          errorClass = "FIELD_ALREADY_EXISTS",
           messageParameters = Map(
             "op" -> op,
             "fieldNames" -> toSQLId(fieldNames),
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTableTests.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTableTests.scala
index 996d7acb1148..28605958c71d 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTableTests.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTableTests.scala
@@ -466,7 +466,7 @@ trait AlterTableTests extends SharedSparkSession with 
QueryErrorsBase {
           exception = intercept[AnalysisException] {
             sql(s"ALTER TABLE $t ADD COLUMNS $field double")
           },
-          errorClass = "FIELDS_ALREADY_EXISTS",
+          errorClass = "FIELD_ALREADY_EXISTS",
           parameters = expectedParameters,
           context = ExpectedContext(
             fragment = s"ALTER TABLE $t ADD COLUMNS $field double",
@@ -1116,7 +1116,7 @@ trait AlterTableTests extends SharedSparkSession with 
QueryErrorsBase {
           exception = intercept[AnalysisException] {
             sql(s"ALTER TABLE $t RENAME COLUMN $field TO $newName")
           },
-          errorClass = "FIELDS_ALREADY_EXISTS",
+          errorClass = "FIELD_ALREADY_EXISTS",
           parameters = Map(
             "op" -> "rename",
             "fieldNames" -> s"${toSQLId(expectedName)}",
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/V2CommandsCaseSensitivitySuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/V2CommandsCaseSensitivitySuite.scala
index ee71bd3af1e0..3ab7edb78439 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/V2CommandsCaseSensitivitySuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/V2CommandsCaseSensitivitySuite.scala
@@ -306,7 +306,7 @@ class V2CommandsCaseSensitivitySuite
           None,
           Some(UnresolvedFieldPosition(ColumnPosition.after("id"))),
           None))),
-      "FIELDS_ALREADY_EXISTS",
+      "FIELD_ALREADY_EXISTS",
       Map(
         "op" -> "add",
         "fieldNames" -> "`ID`",
@@ -317,7 +317,7 @@ class V2CommandsCaseSensitivitySuite
   test("SPARK-36381: Check column name exist case sensitive and insensitive 
when rename column") {
     alterTableErrorClass(
       RenameColumn(table, 
UnresolvedFieldName(Array("id").toImmutableArraySeq), "DATA"),
-      "FIELDS_ALREADY_EXISTS",
+      "FIELD_ALREADY_EXISTS",
       Map(
         "op" -> "rename",
         "fieldNames" -> "`DATA`",
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
index f4e7921e88bc..daf5d8507ecc 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
@@ -200,7 +200,7 @@ class JDBCTableCatalogSuite extends QueryTest with 
SharedSparkSession {
         exception = intercept[AnalysisException] {
           sql(s"ALTER TABLE $tableName ADD COLUMNS (c3 DOUBLE)")
         },
-        errorClass = "FIELDS_ALREADY_EXISTS",
+        errorClass = "FIELD_ALREADY_EXISTS",
         parameters = Map(
           "op" -> "add",
           "fieldNames" -> "`c3`",
@@ -239,7 +239,7 @@ class JDBCTableCatalogSuite extends QueryTest with 
SharedSparkSession {
         exception = intercept[AnalysisException] {
           sql(s"ALTER TABLE $tableName RENAME COLUMN C TO C0")
         },
-        errorClass = "FIELDS_ALREADY_EXISTS",
+        errorClass = "FIELD_ALREADY_EXISTS",
         parameters = Map(
           "op" -> "rename",
           "fieldNames" -> "`C0`",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to