maropu commented on a change in pull request #31639:
URL: https://github.com/apache/spark/pull/31639#discussion_r582449149
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
##########
@@ -874,13 +874,29 @@ class SessionCatalog(
// the extra columns that we don't require), with UpCast (to make sure the
type change is
// safe) and Alias (to respect user-specified view column names) according
to the view schema
// in the catalog.
- val projectList = viewColumnNames.zip(metadata.schema).map { case (name,
field) =>
- Alias(UpCast(UnresolvedAttribute.quoted(name), field.dataType),
field.name)(
- explicitMetadata = Some(field.metadata))
+ val projectList = if (isTempView) {
+ viewColumnNames.zip(metadata.schema).map { case (name, field) =>
+ Alias(UpCast(UnresolvedAttribute.quoted(name), field.dataType),
field.name)(
+ explicitMetadata = Some(field.metadata))
+ }
+ } else {
+ viewColumnNames.zip(metadata.schema).
Review comment:
Could you leave some comments here about why we need this handling?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]