You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/07/22 08:20:56 UTC
[GitHub] [spark] kupferk commented on a diff in pull request #37251: [SPARK-39838][SQL] Preserve explicit empty column metadata
kupferk commented on code in PR #37251:
URL: https://github.com/apache/spark/pull/37251#discussion_r927412109
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CollapseProjectSuite.scala:
##########
@@ -223,6 +224,24 @@ class CollapseProjectSuite extends PlanTest {
assert(hasMetadata(optimized))
}
+ test("reset top-level alias metadata while collapsing projects") {
+ def hasNoMetadata(logicalPlan: LogicalPlan): Boolean = {
+ !logicalPlan.asInstanceOf[Project].projectList.exists(_.metadata.contains("key"))
+ }
+
+ val metadata = new MetadataBuilder().putLong("key", 1).build()
+ val analyzed =
+ Project(Seq(Alias('a_with_metadata, "b")(explicitMetadata = Some(Metadata.empty))),
+ Project(Seq(Alias('a, "a_with_metadata")(explicitMetadata = Some(metadata))),
+ testRelation.logicalPlan)).analyze
+ require(hasNoMetadata(analyzed))
Review Comment:
In my understanding, inheriting metadata is not intended if explicit metadata is provided. At least this was the case up until Spark 3.2.x. Unpatched Spark 3.3 will also replace the existing childs metadata, if the newly provided metadata is not empty. Only the case when providing an empty metadata does not work as I expect.
--
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