private static VarLengthColumnPageBase getVarLengthColumnPage(TableSpec.ColumnSpec columnSpec,
byte[] lvEncodedBytes, DataType dataType, int lvLength, int rowId, ColumnPage rowOffset,
int offset, String compressorName) throws MemoryException {
int lvEncodedOffset;
int length;
int numRows = rowId;
VarLengthColumnPageBase page;
int inputDataLength = offset;
if (unsafe) {
page = new UnsafeDecimalColumnPage(
new ColumnPageEncoderMeta(columnSpec, dataType, compressorName), numRows,
inputDataLength);
} else {
page = new SafeDecimalColumnPage(
new ColumnPageEncoderMeta(columnSpec, dataType, compressorName), numRows);
}
page.totalLength = offset;
page.rowOffset.freeMemory();
page.rowOffset = rowOffset;
lvEncodedOffset = 0;
for (int i = 0; i < numRows; i++) {
length = rowOffset.getInt(i + 1) - rowOffset.getInt(i);
page.putBytes(i, lvEncodedBytes, lvEncodedOffset + lvLength, length);
lvEncodedOffset += lvLength + length;
}
return page;
}