com.clickzetta.platform.arrow.writer.StructWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickzetta-java Show documentation
Show all versions of clickzetta-java Show documentation
The java SDK for clickzetta's Lakehouse
package com.clickzetta.platform.arrow.writer;
import com.clickzetta.platform.catalyst.data.DataGetters;
import com.clickzetta.platform.catalyst.data.InternalRow;
import org.apache.arrow.vector.complex.StructVector;
import java.util.List;
public class StructWriter extends ArrowFieldWriter {
private StructVector structVector;
private List children;
public StructWriter(StructVector structVector, List children) {
super(structVector);
this.structVector = structVector;
this.children = children;
}
@Override
public void setNull() {
int i = 0;
while (i < children.size()) {
children.get(i).setNull();
children.get(i).count += 1;
i += 1;
}
structVector.setNull(count);
}
@Override
void setDefaultValue() {
int i = 0;
structVector.setIndexDefined(count);
while (i < children.size()) {
children.get(i).setDefaultValue();
children.get(i).count += 1;
i += 1;
}
}
@Override
void setValue(DataGetters row, int ordinal) {
InternalRow internalRow = row.getRow(ordinal, children.size());
int i = 0;
structVector.setIndexDefined(count);
while (i < internalRow.getFieldCount()) {
children.get(i).write(internalRow, i, true);
i += 1;
}
}
@Override
public void finish() {
super.finish();
children.forEach(ArrowFieldWriter::finish);
}
@Override
public void reset() {
super.reset();
children.forEach(ArrowFieldWriter::reset);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy