aokolnychyi commented on a change in pull request #3763:
URL: https://github.com/apache/iceberg/pull/3763#discussion_r773299403
##########
File path:
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkDistributionAndOrderingUtil.java
##########
@@ -96,6 +100,44 @@ public static Distribution
buildCopyOnWriteDistribution(Table table, Command com
}
}
+ public static Distribution buildPositionDeltaDistribution(Table table,
Command command,
+ DistributionMode
distributionMode) {
+ if (command == DELETE) {
+ return positionDeleteDistribution(distributionMode);
+ } else {
+ throw new IllegalArgumentException("Only position deletes are currently
supported");
+ }
+ }
+
+ private static Distribution positionDeleteDistribution(DistributionMode
distributionMode) {
+ switch (distributionMode) {
+ case NONE:
+ return Distributions.unspecified();
+
+ case HASH:
+ Expression[] clustering = new Expression[]{SPEC_ID, PARTITION};
+ return Distributions.clustered(clustering);
+
+ case RANGE:
+ SortOrder[] ordering = new SortOrder[]{SPEC_ID_ORDER, PARTITION_ORDER,
FILE_PATH_ORDER};
+ return Distributions.ordered(ordering);
+
+ default:
+ throw new IllegalArgumentException("Unsupported distribution mode: " +
distributionMode);
+ }
+ }
+
+ public static SortOrder[] buildPositionDeltaOrdering(Table table, Command
command, Distribution distribution) {
+ // the spec requires position delete files to be sorted by file and pos
+ SortOrder[] deleteOrdering = new SortOrder[]{SPEC_ID_ORDER,
PARTITION_ORDER, FILE_PATH_ORDER, ROW_POSITION_ORDER};
Review comment:
It will be used in branches below once we support other commands but I
removed for now.
--
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]