kupferk commented on code in PR #37251:
URL: https://github.com/apache/spark/pull/37251#discussion_r927528208
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/AliasHelper.scala:
##########
@@ -98,10 +98,15 @@ trait AliasHelper {
protected def trimNonTopLevelAliases[T <: Expression](e: T): T = {
val res = e match {
case a: Alias =>
- val metadata = if (a.metadata == Metadata.empty) {
- None
- } else {
- Some(a.metadata)
+ val metadata = a.explicitMetadata match {
+ // SPARK-39838 Preserve explicit metadata, even if it is empty
+ case Some(metadata) => Some(metadata)
+ case None =>
+ if (a.metadata == Metadata.empty) {
+ None
+ } else {
+ Some(a.metadata)
+ }
Review Comment:
Thanks, your suggestion indeed is much simplier to read and understand :)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]