cloud-fan commented on code in PR #49027:
URL: https://github.com/apache/spark/pull/49027#discussion_r1908137575
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/V1Writes.scala:
##########
@@ -98,16 +98,27 @@ object V1Writes extends Rule[LogicalPlan] with
SQLConfHelper {
assert(empty2NullPlan.output.length == query.output.length)
val attrMap = AttributeMap(query.output.zip(empty2NullPlan.output))
- // Rewrite the attribute references in the required ordering to use the
new output.
- val requiredOrdering = write.requiredOrdering.map(_.transform {
- case a: Attribute => attrMap.getOrElse(a, a)
- }.asInstanceOf[SortOrder])
+ // Rewrite the attribute references to use the new output.
+ def rewriteAttributes[T <: Expression](expr: T): T = {
+ expr.transform {
+ case a: Attribute => attrMap.getOrElse(a, a)
+ }.asInstanceOf[T]
+ }
+ val clusteringSpec = write.clusteringSpec.map { spec =>
+ ClusteringSpec(
+ clusteringKeys = spec.clusteringKeys.map(rewriteAttributes),
+ sortKeys = spec.sortKeys.map(rewriteAttributes)
+ )
+ }
+ val clusteringExpressions =
clusteringSpec.map(_.expressions).getOrElse(Seq.empty)
Review Comment:
OK it was the previous behavior, but it seems wrong?
--
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]