public final class RowSetBuilder extends Object
| Constructor and Description |
|---|
RowSetBuilder(BufferAllocator allocator,
BatchSchema schema)
Deprecated.
Use
RowSetBuilder(BufferAllocator, TupleMetadata) instead. |
RowSetBuilder(BufferAllocator allocator,
TupleMetadata schema) |
RowSetBuilder(BufferAllocator allocator,
TupleMetadata schema,
int capacity) |
| Modifier and Type | Method and Description |
|---|---|
RowSetBuilder |
addRow(Object... values)
Add a new row using column values passed as variable-length arguments.
|
RowSetBuilder |
addSelection(boolean selected,
Object... values) |
RowSetBuilder |
addSingleCol(boolean selected,
Object value) |
RowSetBuilder |
addSingleCol(Object value)
The
addRow(Object...) method uses Java variable-length arguments to
pass a row of values. |
RowSet.SingleRowSet |
build() |
static RowSet |
emptyBatch(BufferAllocator allocator,
TupleMetadata schema) |
RowSetBuilder |
withSv2()
Build the row set with a selection vector 2.
|
RowSetWriter |
writer() |
@Deprecated public RowSetBuilder(BufferAllocator allocator, BatchSchema schema)
RowSetBuilder(BufferAllocator, TupleMetadata) instead.RowSetBuilder. Since BatchSchema does not handle complex types well, this has been deprecated in favor of the other constructors.allocator - An allocator.schema - A BatchSchema.public RowSetBuilder(BufferAllocator allocator, TupleMetadata schema)
public RowSetBuilder(BufferAllocator allocator, TupleMetadata schema, int capacity)
public static RowSet emptyBatch(BufferAllocator allocator, TupleMetadata schema)
public RowSetWriter writer()
public RowSetBuilder addRow(Object... values)
values - column values in column index orderIllegalStateException - if the batch, or any vector in the batch,
becomes full. This method is designed to be used in tests where we will
seldom create a full vector of data.public RowSetBuilder addSelection(boolean selected, Object... values)
public RowSetBuilder addSingleCol(Object value)
addRow(Object...) method uses Java variable-length arguments to
pass a row of values. But, when the row consists of a single array, Java
gets confused: is that an array for variable-arguments or is it the value
of the first argument? This method clearly states that the single value
(including an array) is meant to be the value of the first (and only)
column.
Examples:
RowSetBuilder twoColsBuilder = ...
// Fine, second item is an array of strings for a repeated Varchar
// column.
twoColsBuilder.add("First", new String[] {"a", "b", "c"});
...
RowSetBuilder oneColBuilder = ...
// Ambiguous: is this a varargs array of three items?
// That is how Java will perceive it.
oneColBuilder.add(new String[] {"a", "b", "c"});
// Unambiguous: this is a single column value for the
// repeated Varchar column.
oneColBuilder.addSingleCol(new String[] {"a", "b", "c"});
value - value of the first column, which may be an array for a
repeated columnpublic RowSetBuilder addSingleCol(boolean selected, Object value)
public RowSetBuilder withSv2()
public RowSet.SingleRowSet build()
Copyright © 2021 The Apache Software Foundation. All rights reserved.