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


##########
core/src/main/java/org/apache/iceberg/Partitioning.java:
##########
@@ -215,11 +225,15 @@ public Void alwaysNull(int fieldId, String sourceName, 
int sourceId) {
    * that have the same field ID but use a void transform under the hood. Such 
fields cannot be part
    * of the grouping key as void transforms always return null.
    *
+   * <p>If the provided schema is not null, this method will only take into 
account partition fields
+   * on top of columns present in the schema. Otherwise, all partition fields 
will be considered.
+   *
+   * @param schema a schema specifying a set of source columns to consider 
(null to consider all)
    * @param specs one or many specs
    * @return the constructed grouping key type
    */
-  public static StructType groupingKeyType(Collection<PartitionSpec> specs) {
-    return buildPartitionProjectionType("grouping key", specs, 
commonActiveFieldIds(specs));
+  public static StructType groupingKeyType(Schema schema, 
Collection<PartitionSpec> specs) {
+    return buildPartitionProjectionType("grouping key", specs, 
commonActiveFieldIds(schema, specs));

Review Comment:
   If a table has multiple specs but we scan only tasks that belong to one 
spec, we should take into account only the one that is being queried. 



-- 
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