Package io.delta.kernel.data
Class FilteredColumnarBatch
Object
io.delta.kernel.data.FilteredColumnarBatch
Represents a filtered version of
ColumnarBatch. Contains original ColumnarBatch
with an optional selection vector to select only a subset of rows for the original columnar
batch.
The selection vector is of type boolean and has the same size as the data in the corresponding
ColumnarBatch. For each row index, a value of true in the selection vector indicates the
row at the same index in the data ColumnarBatch is valid; a value of false indicates the
row should be ignored. If there is no selection vector then all the rows are valid.
- Since:
- 3.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionFilteredColumnarBatch(ColumnarBatch data, Optional<ColumnVector> selectionVector) FilteredColumnarBatch(ColumnarBatch data, Optional<ColumnVector> selectionVector, String filePath, int preComputedNumSelectedRows) -
Method Summary
Modifier and TypeMethodDescriptiongetData()Return the data asColumnarBatch.Returns the file path from which the data originates, if available.getRows()Iterator of rows that survived the filter.Optional selection vector containing one entry for each row in data indicating whether a row is selected or not selected.
-
Constructor Details
-
FilteredColumnarBatch
-
FilteredColumnarBatch
public FilteredColumnarBatch(ColumnarBatch data, Optional<ColumnVector> selectionVector, String filePath, int preComputedNumSelectedRows)
-
-
Method Details
-
getData
Return the data asColumnarBatch. Not all rows in the data are valid for this result. An optional selectionVector determines which rows are selected. If there is no selection vector that means all rows in this columnar batch are valid for this result.- Returns:
- all the data read from the file
-
getFilePath
Returns the file path from which the data originates, if available.Note: The file path may not be present. It is only set if explicitly provided in the constructor.
- Returns:
- an
Optionalcontaining the file path if available, otherwise an empty Optional
-
getSelectionVector
Optional selection vector containing one entry for each row in data indicating whether a row is selected or not selected. If there is no selection vector then all the rows are valid.- Returns:
- an optional
ColumnVectorindicating which rows are valid
-
getRows
Iterator of rows that survived the filter.- Returns:
- Closeable iterator of rows that survived the filter. It is responsibility of the caller to the close the iterator.
-
getPreComputedNumSelectedRows
- Returns:
- an
Optionalcontaining the pre-computed number of selected rows, if available.If present, this value was computed ahead of time and can be used without incurring any additional cost. This occurs in two cases:
- When the selection vector is absent, which implies that all rows are selected — in this case, the number of selected rows is equal to the batch size.
- When the number of selected rows was explicitly pre-computed and passed in.
If empty, the caller must compute the number of selected rows manually from the selection vector.
-