Class ColumnBlockConversions
Blocks, avoiding the per-element overhead
of Block.Builder when the source data is already in columnar form.
Used by format readers (ORC, and future Parquet ColumnReader) that produce data as typed arrays. Three fast paths are provided for each type:
- Repeating: a single value broadcast to all positions via constant block.
- No nulls: bulk array copy + direct vector wrap (no builder, no per-element dispatch).
- With nulls: bulk array copy + null bitmap conversion + array block.
The longColumn and doubleColumn entry points expose a copyValues
parameter: callers such as ORC that recycle their column buffers across batches pass
true, while callers that transfer ownership of a freshly allocated array (e.g. the
Parquet reader) pass false to avoid the extra copy. The remaining entry points
convert between primitive types and always allocate a fresh target array.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BlockbooleanColumnFromLongs(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull) Converts along[]column to aBlock(BOOLEAN data type).static BlockdoubleColumn(BlockFactory blockFactory, double[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull, boolean copyValues) Converts adouble[]column to aBlock(DOUBLE data type).static BlockdoubleColumnFromLongs(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull) Converts along[]column to aBlock(DOUBLE data type) by widening.static BlockintColumnFromLongs(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull) Converts along[]column to aBlock(INTEGER data type) by downcasting.static BlocklongColumn(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull, boolean copyValues) Converts along[]column to aBlock(LONG data type).static BitSettoBitSet(boolean[] isNull, int length) Converts aboolean[]null-flag array to aBitSet.
-
Method Details
-
longColumn
public static Block longColumn(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull, boolean copyValues) Converts along[]column to aBlock(LONG data type).Pass
copyValues = truewhen the caller reusesvaluesacross batches (e.g. ORC'sColumnVector), andfalsewhen the caller transfers ownership of a freshly allocated array. -
intColumnFromLongs
public static Block intColumnFromLongs(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull) Converts along[]column to aBlock(INTEGER data type) by downcasting. -
doubleColumn
public static Block doubleColumn(BlockFactory blockFactory, double[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull, boolean copyValues) Converts adouble[]column to aBlock(DOUBLE data type).Pass
copyValues = truewhen the caller reusesvaluesacross batches (e.g. ORC'sColumnVector), andfalsewhen the caller transfers ownership of a freshly allocated array. -
booleanColumnFromLongs
public static Block booleanColumnFromLongs(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull) Converts along[]column to aBlock(BOOLEAN data type). ORC stores booleans as longs where 0 = false. -
doubleColumnFromLongs
public static Block doubleColumnFromLongs(BlockFactory blockFactory, long[] values, int rowCount, boolean noNulls, boolean isRepeating, BitSet isNull) Converts along[]column to aBlock(DOUBLE data type) by widening. Used for ORC DECIMAL types that arrive asLongColumnVector. -
toBitSet
Converts aboolean[]null-flag array to aBitSet. Returnsnullwhen the input isnull, so callers can forward an absent null mask throughColumnBlockConversionsentry points without a separate guard.
-