Java Code Examples for org.apache.arrow.vector.IntVector#setInitialCapacity()

The following examples show how to use org.apache.arrow.vector.IntVector#setInitialCapacity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Twister2ArrowFileWriter.java    From twister2 with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends FieldVector> void generate(T intVector1, int from, int items, int isSet) {
  IntVector intVector = (IntVector) intVector1;
  intVector.setInitialCapacity(items);
  intVector.allocateNew();
  for (int i = 0; i < items; i++) {
    intVector.setSafe(i, isSet, (int) dataList.get(from + i));
  }
  intVector.setValueCount(items);
}
 
Example 2
Source File: SFArrowResultSetIT.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
private void writeIntToField(FieldVector fieldVector, Object[] data,
                             int startIndex, int rowsToAppend)
{
  IntVector intVector = (IntVector) fieldVector;
  intVector.setInitialCapacity(rowsToAppend);
  intVector.allocateNew();
  for (int i = 0; i < rowsToAppend; i++)
  {
    intVector.setSafe(i, 1, (int) data[startIndex + i]);
  }
  // how many are set
  fieldVector.setValueCount(rowsToAppend);
}