openinx commented on a change in pull request #3248:
URL: https://github.com/apache/iceberg/pull/3248#discussion_r726920053
##########
File path: data/src/main/java/org/apache/iceberg/data/orc/GenericOrcWriters.java
##########
@@ -531,6 +534,46 @@ public void nonNullWrite(int rowId, Map<K, V> map,
ColumnVector output) {
}
}
+ public abstract static class StructWriter<S> implements OrcValueWriter<S> {
+ private final List<OrcValueWriter<?>> writers;
+
+ protected StructWriter(List<OrcValueWriter<?>> writers) {
+ this.writers = writers;
+ }
+
+ public List<OrcValueWriter<?>> writers() {
+ return writers;
+ }
+
+ @Override
+ public Stream<FieldMetrics<?>> metrics() {
+ return writers.stream().flatMap(OrcValueWriter::metrics);
+ }
+
+ @Override
+ public void nonNullWrite(int rowId, S value, ColumnVector output) {
+ StructColumnVector cv = (StructColumnVector) output;
+ write(rowId, value, c -> cv.fields[c]);
+ }
+
+ // Special case of writing the root struct
+ public void rootNonNullWrite(S value, VectorizedRowBatch output) {
Review comment:
Is it better to rename this name to `writeRow` or `addRow` because it
is adding a new row ( which is `value`) into the VectorizedRowBatch array.
It's no quite clear for me to understand the `rootNonNullWrites` from my first
glance actually.
--
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]