@Evolving public interface ColumnarBatch
Modifier and Type | Method and Description |
---|---|
ColumnVector |
getColumnVector(int ordinal)
Return the
ColumnVector for the given ordinal in the columnar batch. |
default CloseableIterator<Row> |
getRows() |
StructType |
getSchema() |
int |
getSize() |
default ColumnarBatch |
slice(int start,
int end)
Return a slice of the current batch.
|
default ColumnarBatch |
withDeletedColumnAt(int ordinal)
Return a copy of this
ColumnarBatch with the column at given ordinal
removed. |
default ColumnarBatch |
withNewColumn(int ordinal,
StructField columnSchema,
ColumnVector columnVector)
Return a copy of the
ColumnarBatch with given new column vector inserted at the
given columnVector at given ordinal . |
default ColumnarBatch |
withNewSchema(StructType newSchema)
Generate a copy of this
ColumnarBatch with the given newSchema . |
StructType getSchema()
ColumnVector getColumnVector(int ordinal)
ColumnVector
for the given ordinal in the columnar batch. If the ordinal
is not valid throws error.ordinal
- the ordinal of the column to retrieveColumnVector
for the given ordinal in the columnar batchint getSize()
default ColumnarBatch withNewColumn(int ordinal, StructField columnSchema, ColumnVector columnVector)
ColumnarBatch
with given new column vector inserted at the
given columnVector
at given ordinal
. Shift the existing
ColumnVector
s located at from ordinal
to the end by one position.
The schema of the new ColumnarBatch
will also be changed to reflect the newly
inserted vector.ordinal
- columnSchema
- Column name and schema details of the new column vector.columnVector
- ColumnarBatch
with new vector inserted.IllegalArgumentException
- If the ordinal is not valid (ie less than zero or
greater than the current number of vectors).default ColumnarBatch withDeletedColumnAt(int ordinal)
ColumnarBatch
with the column at given ordinal
removed. All columns after the ordinal
will be shifted to left by one position.ordinal
- Column ordinal to delete.ColumnarBatch
with a column vector deleted.default ColumnarBatch withNewSchema(StructType newSchema)
ColumnarBatch
with the given newSchema
. The data
types of elements in the given new schema and existing schema should be the same. Rest of
the details such as name of the column or column metadata could be different.newSchema
- ColumnarBatch
with given new schema.default ColumnarBatch slice(int start, int end)
start
- Starting record index to include in the returned columnar batchend
- Ending record index (exclusive) to include in the returned columnar batchdefault CloseableIterator<Row> getRows()
Row
s in this batch