rdblue commented on a change in pull request #2680:
URL: https://github.com/apache/iceberg/pull/2680#discussion_r717693929
##########
File path: core/src/main/java/org/apache/iceberg/io/BaseTaskWriter.java
##########
@@ -216,6 +231,41 @@ public String toString() {
.add("row_offset", rowOffset)
.toString();
}
+
+ @Override
+ public int size() {
+ return 2;
+ }
+
+ @Override
+ public <T> T get(int pos, Class<T> javaClass) {
+ switch (pos) {
+ case 0:
+ return javaClass.cast(path);
+ case 1:
+ return javaClass.cast(rowOffset);
+ default:
+ throw new UnsupportedOperationException("Unknown field ordinal: " +
pos);
+ }
+ }
+
+ private void put(int pos, Object value) {
+ switch (pos) {
+ case 0:
+ this.path = (CharSequence) value;
+ break;
+ case 1:
+ this.rowOffset = (long) value;
+ break;
+ default:
+ throw new UnsupportedOperationException("Unknown field ordinal: " +
pos);
+ }
+ }
+
+ @Override
+ public <T> void set(int pos, T value) {
+ put(pos, value);
Review comment:
Why use a private `put` method instead of moving the switch here in
`set`? Won't this need a `SuppressWarnings` either way?
--
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]