Java Code Examples for org.apache.arrow.vector.FieldVector#allocateNew()

The following examples show how to use org.apache.arrow.vector.FieldVector#allocateNew() . 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: VectorizedProbe.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Project the build data (including keys from the probe)
 * @param offsetAddr
 * @param count
 */
private void projectBuild(final long offsetAddr, final int count){
  buildCopyWatch.start();
  if (buildCopiers.size() == 0) {
    // No data in build side
    final List<FieldVector> buildOutputs = this.buildOutputs;
    for (FieldVector fieldVector : buildOutputs) {
      fieldVector.allocateNew();
    }
  } else {
    for (FieldBufferCopier c : buildCopiers) {
      c.copy(offsetAddr, count);
    }
  }
  buildCopyWatch.stop();
}
 
Example 2
Source File: UserDefinedFunctionHandlerTest.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
private void writeData(Block block, int numOfRows)
{
    for (FieldVector fieldVector : block.getFieldVectors()) {
        fieldVector.setInitialCapacity(numOfRows);
        fieldVector.allocateNew();
        fieldVector.setValueCount(numOfRows);

        for (int idx = 0; idx < numOfRows; ++idx) {
            writeColumn(fieldVector, idx);
        }
    }
}
 
Example 3
Source File: ArrowUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an {@link ArrowWriter} for the specified {@link VectorSchemaRoot}.
 */
public static ArrowWriter<Row> createRowArrowWriter(VectorSchemaRoot root, RowType rowType) {
	ArrowFieldWriter<Row>[] fieldWriters = new ArrowFieldWriter[root.getFieldVectors().size()];
	List<FieldVector> vectors = root.getFieldVectors();
	for (int i = 0; i < vectors.size(); i++) {
		FieldVector vector = vectors.get(i);
		vector.allocateNew();
		fieldWriters[i] = createRowArrowFieldWriter(vector, rowType.getTypeAt(i));
	}

	return new ArrowWriter<>(root, fieldWriters);
}
 
Example 4
Source File: ArrowUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an {@link ArrowWriter} for blink planner for the specified {@link VectorSchemaRoot}.
 */
public static ArrowWriter<RowData> createRowDataArrowWriter(VectorSchemaRoot root, RowType rowType) {
	ArrowFieldWriter<RowData>[] fieldWriters = new ArrowFieldWriter[root.getFieldVectors().size()];
	List<FieldVector> vectors = root.getFieldVectors();
	for (int i = 0; i < vectors.size(); i++) {
		FieldVector vector = vectors.get(i);
		vector.allocateNew();
		fieldWriters[i] = createArrowFieldWriterForRow(vector, rowType.getTypeAt(i));
	}

	return new ArrowWriter<>(root, fieldWriters);
}