sunchao commented on a change in pull request #2276:
URL: https://github.com/apache/iceberg/pull/2276#discussion_r591138040
##########
File path: api/src/main/java/org/apache/iceberg/util/StructProjection.java
##########
@@ -39,9 +39,32 @@
*/
public static StructProjection create(Schema schema, Set<Integer> ids) {
StructType structType = schema.asStruct();
+ return create(structType, ids);
+ }
+
+ /**
+ * Creates a projecting wrapper for {@link StructLike} rows.
+ * <p>
+ * This projection does not work with repeated types like lists and maps.
+ *
+ * @param structType struct type of rows wrapped by this projection
+ * @param ids field ids from the row schema to project
+ * @return a wrapper to project rows
+ */
+ public static StructProjection create(StructType structType, Set<Integer>
ids) {
return new StructProjection(structType, TypeUtil.select(structType, ids));
}
+ /**
+ * Creates a projecting wrapper for {@link StructLike} rows by copying from
`other`.
+ *
+ * @param other the projection wrapper to copy from
+ * @return a wrapper to project rows
+ */
+ public static StructProjection create(StructProjection other) {
Review comment:
I'm fine with either. I chose to follow the `create`-style because it
might make it easier to find by looking at all the overloaded `create` methods.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]