szehon-ho commented on code in PR #9662:
URL: https://github.com/apache/iceberg/pull/9662#discussion_r1505175057
##########
api/src/main/java/org/apache/iceberg/StructTransform.java:
##########
@@ -51,11 +53,16 @@ class StructTransform implements StructLike, Serializable {
this.transforms = new SerializableFunction[size];
for (int i = 0; i < size; ++i) {
- int sourceFieldId = fieldTransforms.get(i).sourceFieldId();
+ int[] sourceFieldIds = fieldTransforms.get(i).sourceFieldIds();
Transform<?, ?> transform = fieldTransforms.get(i).transform();
- Accessor<StructLike> accessor = schema.accessorForField(sourceFieldId);
+ Accessor<StructLike> accessor = schema.accessorForFields(sourceFieldIds);
Review Comment:
Early question, can we have an array of accessors here? So this.accessors
becomes an array of array, or array of lists.
My thought is, then we can re-use schema.accessorForField() which has some
advantages like caching, and may be simpler than having to implement
schema.accessorForFields() and a 'structProjectionAccessor'?
##########
api/src/main/java/org/apache/iceberg/StructTransform.java:
##########
@@ -51,11 +53,16 @@ class StructTransform implements StructLike, Serializable {
this.transforms = new SerializableFunction[size];
for (int i = 0; i < size; ++i) {
- int sourceFieldId = fieldTransforms.get(i).sourceFieldId();
+ int[] sourceFieldIds = fieldTransforms.get(i).sourceFieldIds();
Transform<?, ?> transform = fieldTransforms.get(i).transform();
- Accessor<StructLike> accessor = schema.accessorForField(sourceFieldId);
+ Accessor<StructLike> accessor = schema.accessorForFields(sourceFieldIds);
+ String sourceFieldsDesc =
+ Arrays.stream(sourceFieldIds)
+ .mapToObj(schema::findField)
+ .map(Types.NestedField::name)
Review Comment:
NestedField already has string, is it necessary to map the name?
--
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]