com.clickzetta.platform.arrow.writer.ArrayWriter 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.InternalArray;
import org.apache.arrow.vector.complex.ListVector;
public class ArrayWriter extends ArrowFieldWriter {
private ListVector listVector;
private ArrowFieldWriter elementWriter;
public ArrayWriter(ListVector listVector, ArrowFieldWriter elementWriter) {
super(listVector);
this.listVector = listVector;
this.elementWriter = elementWriter;
}
@Override
public void setNull() {
listVector.setNull(count);
}
@Override
void setDefaultValue() {
listVector.startNewValue(count);
listVector.endValue(count, 0);
}
@Override
void setValue(DataGetters row, int ordinal) {
InternalArray array = row.getArray(ordinal);
int length = array.size();
listVector.startNewValue(count);
int i = 0;
while (i < length) {
elementWriter.write(array, i, true);
i += 1;
}
listVector.endValue(count, length);
}
@Override
public void finish() {
super.finish();
elementWriter.finish();
}
@Override
public void reset() {
super.reset();
elementWriter.reset();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy