aokolnychyi commented on code in PR #6304:
URL: https://github.com/apache/iceberg/pull/6304#discussion_r1034126627


##########
api/src/main/java/org/apache/iceberg/ScanTaskGroup.java:
##########
@@ -26,6 +26,24 @@
  * @param <T> the type of scan tasks
  */
 public interface ScanTaskGroup<T extends ScanTask> extends ScanTask {
+  /**
+   * Returns a grouping key for this task group.
+   *
+   * <p>Tasks may produce records that belong to a specific group of data 
(e.g. partition). It may
+   * be beneficial to preserve that grouping while combining tasks into groups 
if query engines can
+   * leverage that information to avoid shuffles. Grouping keys indicate how 
data is split between
+   * different task groups. The grouping key type is determined at planning 
time and is identical
+   * across all task groups produced by a scan.
+   *
+   * <p>All records produced by tasks in this group are guaranteed to have the 
reported grouping
+   * key. Implementations should return an empty struct if the data grouping 
is random or unknown.
+   *
+   * @return a grouping key for this task group
+   */
+  default StructLike groupingKey() {

Review Comment:
   I also considered calling it `partitionKey`. However, I went for 
`groupingKey`:
   - It is more generic. We may expose grouping on non-partition attributes in 
the future.
   - It matches `Partitioning$groupingKeyType`, which is inspired by 
`KeyGroupedPartitioning` in Spark.
   - It avoids confusion between `partitionKey` and `partition` (reported by 
`PartitionScanTask`).
   - Calling it `partitionKey` may be misleading as we consider only non-void 
transforms.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to