You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2026/05/26 09:58:56 UTC

Re: [PR] [SPARK-57054][SQL] Make view collation sticky across ALTER SCHEMA DEFAULT COLLATION [spark]

cloud-fan commented on code in PR #56100:
URL: https://github.com/apache/spark/pull/56100#discussion_r3302928992


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/AlterViewAsSuite.scala:
##########
@@ -45,11 +44,10 @@ class AlterViewAsSuite extends command.AlterViewAsSuiteBase with ViewCommandSuit
       sql(s"ALTER VIEW $view AS SELECT 'x' AS c1, 'y' AS c2")
 
       val stored = viewCatalog.getStoredView(Array(namespace), viewName)
-      assert(stored.properties().get(TableCatalog.PROP_COLLATION) == "UTF8_LCASE")
-      // Read-time the view body's literal types reflect the inherited collation.
+      assert(Option(stored.properties().get(TableCatalog.PROP_COLLATION)).isEmpty)
       val df = spark.table(view)
-      assert(df.schema("c1").dataType === StringType("UTF8_LCASE"))
-      assert(df.schema("c2").dataType === StringType("UTF8_LCASE"))
+      assert(df.schema("c1").dataType === StringType)
+      assert(df.schema("c2").dataType === StringType)
     }
   }

Review Comment:
   Optional follow-up: the V2 test only covers the case where the view is created *without* a default collation. The V1 side has a sibling case via `testAlterViewWithSchemaLevelCollation(alterSchemaCollation = true)` in `DefaultCollationTestSuite` (around L1644) where the view is created with the namespace's default collation, the namespace default is then changed, and ALTER VIEW AS is verified to keep the original collation on the new body literals. Consider adding the V2 equivalent here — it would exercise the V2 persistence path (`PROP_COLLATION` carried through `AlterV2ViewExec`) on top of the analyzer fix, which is currently untested at the V2 layer.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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