You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2025/11/20 18:59:26 UTC

(spark) branch master updated: [SPARK-54436][SQL] Fix error formatting for incompatible table metadata checks

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

dongjoon 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 8cab0745e404 [SPARK-54436][SQL] Fix error formatting for incompatible table metadata checks
8cab0745e404 is described below

commit 8cab0745e4042dd99df5c483d1391d2c52b94ec6
Author: Anton Okolnychyi <ao...@apache.org>
AuthorDate: Thu Nov 20 10:59:14 2025 -0800

    [SPARK-54436][SQL] Fix error formatting for incompatible table metadata checks
    
    ### What changes were proposed in this pull request?
    
    This PR fixes error formatting for recently added incompatible table metadata checks.
    
    ### Why are the changes needed?
    
    These changes are needed to avoid unnecessary empty lines.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Existing tests.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #53115 from aokolnychyi/spark-53924-54157-followup.
    
    Authored-by: Anton Okolnychyi <ao...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 .../spark/sql/errors/QueryCompilationErrors.scala  |  8 +++----
 .../sql/connector/DataSourceV2DataFrameSuite.scala | 28 ++++++++++------------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
index f741c5c3975e..77b775f6c49f 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
@@ -2140,7 +2140,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
       errorClass = "INCOMPATIBLE_TABLE_CHANGE_AFTER_ANALYSIS.COLUMNS_MISMATCH",
       messageParameters = Map(
         "tableName" -> toSQLId(tableName),
-        "errors" -> errors.mkString("\n- ", "\n- ", "")))
+        "errors" -> errors.mkString("- ", "\n- ", "")))
   }
 
   def metadataColumnsChangedAfterAnalysis(
@@ -2150,7 +2150,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
       errorClass = "INCOMPATIBLE_TABLE_CHANGE_AFTER_ANALYSIS.METADATA_COLUMNS_MISMATCH",
       messageParameters = Map(
         "tableName" -> toSQLId(tableName),
-        "errors" -> errors.mkString("\n- ", "\n- ", "")))
+        "errors" -> errors.mkString("- ", "\n- ", "")))
   }
 
   def numberOfPartitionsNotAllowedWithUnspecifiedDistributionError(): Throwable = {
@@ -4477,7 +4477,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
         "viewName" -> toSQLId(viewName),
         "tableName" -> toSQLId(tableName),
         "colType" -> "data",
-        "errors" -> errors.mkString("\n- ", "\n- ", "")))
+        "errors" -> errors.mkString("- ", "\n- ", "")))
   }
 
   def metadataColumnsChangedAfterViewWithPlanCreation(
@@ -4490,6 +4490,6 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
         "viewName" -> toSQLId(viewName),
         "tableName" -> toSQLId(tableName),
         "colType" -> "metadata",
-        "errors" -> errors.mkString("\n- ", "\n- ", "")))
+        "errors" -> errors.mkString("- ", "\n- ", "")))
   }
 }
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2DataFrameSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2DataFrameSuite.scala
index 205fa561a5b0..d41af4f1465e 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2DataFrameSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2DataFrameSuite.scala
@@ -1117,7 +1117,7 @@ class DataSourceV2DataFrameSuite
         condition = "INCOMPATIBLE_TABLE_CHANGE_AFTER_ANALYSIS.COLUMNS_MISMATCH",
         parameters = Map(
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
-          "errors" -> "\n- `extra` STRING has been removed"))
+          "errors" -> "- `extra` STRING has been removed"))
     }
   }
 
@@ -1141,8 +1141,7 @@ class DataSourceV2DataFrameSuite
         parameters = Map(
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "errors" ->
-            """
-              |- `new_col1` INT has been added
+            """- `new_col1` INT has been added
               |- `new_col2` INT has been added""".stripMargin))
     }
   }
@@ -1167,8 +1166,7 @@ class DataSourceV2DataFrameSuite
         parameters = Map(
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "errors" ->
-            """
-              |- `col4` STRING has been removed
+            """- `col4` STRING has been removed
               |- `col5` INT has been added""".stripMargin))
     }
   }
@@ -1195,9 +1193,7 @@ class DataSourceV2DataFrameSuite
           "viewName" -> "`v`",
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "colType" -> "data",
-          "errors" ->
-            """
-              |- `extra` INT has been added""".stripMargin))
+          "errors" -> "- `extra` INT has been added"))
     }
   }
 
@@ -1220,7 +1216,7 @@ class DataSourceV2DataFrameSuite
         parameters = Map(
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "errors" ->
-            ("\n- `person` type has changed from STRUCT<name: STRING, age: INT> " +
+            ("- `person` type has changed from STRUCT<name: STRING, age: INT> " +
               "to STRUCT<name: STRING, age: INT, city: STRING>")))
     }
   }
@@ -1270,7 +1266,7 @@ class DataSourceV2DataFrameSuite
         condition = "INCOMPATIBLE_TABLE_CHANGE_AFTER_ANALYSIS.COLUMNS_MISMATCH",
         parameters = Map(
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
-          "errors" -> "\n- `extra` STRING has been added"))
+          "errors" -> "- `extra` STRING has been added"))
 
       // DataFrame execution before joins must have pinned used versions
       // subsequent version refreshes must not be visible in original DataFrames
@@ -1400,7 +1396,7 @@ class DataSourceV2DataFrameSuite
           "viewName" -> "`v`",
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "colType" -> "data",
-          "errors" -> "\n- `age` INT has been added"))
+          "errors" -> "- `age` INT has been added"))
     }
   }
 
@@ -1424,7 +1420,7 @@ class DataSourceV2DataFrameSuite
           "viewName" -> "`v`",
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "colType" -> "data",
-          "errors" -> "\n- `age` INT has been removed"))
+          "errors" -> "- `age` INT has been removed"))
     }
   }
 
@@ -1448,7 +1444,7 @@ class DataSourceV2DataFrameSuite
           "viewName" -> "`v`",
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "colType" -> "data",
-          "errors" -> "\n- `data` type has changed from STRING NOT NULL to STRING"))
+          "errors" -> "- `data` type has changed from STRING NOT NULL to STRING"))
     }
   }
 
@@ -1537,7 +1533,7 @@ class DataSourceV2DataFrameSuite
           "viewName" -> "`v`",
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "colType" -> "data",
-          "errors" -> "\n- `age` INT has been added"))
+          "errors" -> "- `age` INT has been added"))
     }
   }
 
@@ -1566,7 +1562,7 @@ class DataSourceV2DataFrameSuite
             "viewName" -> "`v`",
             "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
             "colType" -> "data",
-            "errors" -> "\n- `age` INT has been added"))
+            "errors" -> "- `age` INT has been added"))
       }
     }
   }
@@ -1591,7 +1587,7 @@ class DataSourceV2DataFrameSuite
           "viewName" -> "`v`",
           "tableName" -> "`testcat`.`ns1`.`ns2`.`tbl`",
           "colType" -> "data",
-          "errors" -> "\n- `name` type has changed from VARCHAR(10) to VARCHAR(20)"))
+          "errors" -> "- `name` type has changed from VARCHAR(10) to VARCHAR(20)"))
     }
   }
 


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