cloud-fan commented on code in PR #49027:
URL: https://github.com/apache/spark/pull/49027#discussion_r1906714972
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/V1Writes.scala:
##########
@@ -98,16 +98,30 @@ 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 requiredOrdering = write.requiredOrdering.map(rewriteAttributes(_))
Review Comment:
Can we also refactor `V1WriteCommand` to return clustering keys and sort
keys separately? Or wrap them with a `ClusteringSpec` class.
--
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]