ilicmarkodb commented on code in PR #50436: URL: https://github.com/apache/spark/pull/50436#discussion_r2021052682
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala: ########## @@ -987,9 +987,17 @@ class SessionCatalog( parser.parseQuery(viewText) } } + // The metadata.viewText contains only the AS query part of CREATE VIEW statement + // and does not include the DEFAULT COLLATION part, resulting in a plan without collation. + val plan = if (metadata.collation.isDefined) { + val newType = StringType(metadata.collation.get) + ResolveDDLCommandStringTypes.transformPlan(parsedPlan, newType) Review Comment: https://github.com/apache/spark/blob/a73ca4766ce65561ee139c0bc1ec9764cdd98c6c/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ViewResolution.scala#L24 When resolving a View, we only resolve its child, meaning the View itself does not go through `ResolveDDLCommandStringTypes`. Also, I think that this is clear way to resolve the problem because we will have correct plan from creating View. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org