infvg commented on code in PR #13199:
URL: https://github.com/apache/gluten/pull/13199#discussion_r4186300238
##########
gluten-iceberg/src/main/scala/org/apache/iceberg/spark/source/IcebergWriteUtil.scala:
##########
@@ -114,7 +114,14 @@ object IcebergWriteUtil {
}
def getSortOrder(write: Write): SortOrder = {
- getTable(write).sortOrder()
+ // SparkWrite requests the table sort order (with partition clustering)
unless the write
+ // disables distribution and ordering. In that case, do not label unsorted
files with the
+ // table's default sort order merely because the table defines one.
+ if (write.asInstanceOf[SparkWrite].requiredOrdering().nonEmpty) {
+ getTable(write).sortOrder()
+ } else {
+ SortOrder.unsorted()
Review Comment:
Validation checks supportsWrite before this helper is reached so this isn't
an issue
--
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]