All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clickzetta.platform.arrow.writer.BinaryWriter Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.clickzetta.platform.arrow.writer;

import com.clickzetta.platform.catalyst.data.DataGetters;
import org.apache.arrow.vector.VarBinaryVector;

public class BinaryWriter extends ArrowFieldWriter {

  private static final byte[] EMPTY_BINARY = new byte[0];
  private VarBinaryVector varBinaryVector;

  public BinaryWriter(VarBinaryVector varBinaryVector) {
    super(varBinaryVector);
    this.varBinaryVector = varBinaryVector;
  }

  @Override
  public void setNull() {
    varBinaryVector.setNull(count);
  }

  @Override
  void setDefaultValue() {
    varBinaryVector.setSafe(count, EMPTY_BINARY, 0, EMPTY_BINARY.length);
  }

  @Override
  void setValue(DataGetters row, int ordinal) {
    byte[] bytes = row.getBinary(ordinal);
    varBinaryVector.setSafe(count, bytes, 0, bytes.length);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy