ulysses-you commented on code in PR #49027:
URL: https://github.com/apache/spark/pull/49027#discussion_r1871317698
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/V1Writes.scala:
##########
@@ -107,7 +107,11 @@ object V1Writes extends Rule[LogicalPlan] with
SQLConfHelper {
if (orderingMatched) {
empty2NullPlan
} else {
- Sort(requiredOrdering, global = false, empty2NullPlan)
+ // Preserve the requiredOrdering and append any missing elements from
outputOrdering.
+ val newOrder = requiredOrdering ++ outputOrdering.filterNot {
outputOrder =>
+ requiredOrdering.exists(_.child.semanticEquals(outputOrder.child))
Review Comment:
A confused case is: if people do `sort by col1, part1`, then only the `col1`
will be added. However, the final data ordering is `part1, col1` rather than
`col1, part1`, which still breaks people 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: [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]