jbonofre commented on code in PR #12897:
URL: https://github.com/apache/iceberg/pull/12897#discussion_r2931251311
##########
api/src/main/java/org/apache/iceberg/PartitionField.java:
##########
@@ -19,26 +19,42 @@
package org.apache.iceberg;
import java.io.Serializable;
+import java.util.List;
import org.apache.iceberg.relocated.com.google.common.base.Objects;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.transforms.Transform;
/** Represents a single field in a {@link PartitionSpec}. */
public class PartitionField implements Serializable {
- private final int sourceId;
+ private final List<Integer> sourceIds;
private final int fieldId;
private final String name;
private final Transform<?, ?> transform;
PartitionField(int sourceId, int fieldId, String name, Transform<?, ?>
transform) {
- this.sourceId = sourceId;
+ this(ImmutableList.of(sourceId), fieldId, name, transform);
+ }
+
+ PartitionField(List<Integer> sourceIds, int fieldId, String name,
Transform<?, ?> transform) {
+ this.sourceIds = ImmutableList.copyOf(sourceIds);
this.fieldId = fieldId;
this.name = name;
this.transform = transform;
}
/** Returns the field id of the source field in the {@link PartitionSpec
spec's} table schema. */
public int sourceId() {
- return sourceId;
+ return sourceIds.get(0);
Review Comment:
I added an accessor where I added a `Preconditions.checkState()`:
```
public int sourceId() {
Preconditions.checkState(
sourceIds.size() == 1,
"Use sourceIds() for multi-argument transforms, found %s source
ids",
sourceIds.size());
return sourceIds.get(0);
}
```
--
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]