use of io.trino.parquet.writer.repdef.DefLevelIterable in project trino by trinodb.
the class StructColumnWriter method writeBlock.
@Override
public void writeBlock(ColumnChunk columnChunk) throws IOException {
ColumnarRow columnarRow = toColumnarRow(columnChunk.getBlock());
checkArgument(columnarRow.getFieldCount() == columnWriters.size(), "ColumnarRow field size %s is not equal to columnWriters size %s", columnarRow.getFieldCount(), columnWriters.size());
List<DefLevelIterable> defLevelIterables = ImmutableList.<DefLevelIterable>builder().addAll(columnChunk.getDefLevelIterables()).add(DefLevelIterables.of(columnarRow, maxDefinitionLevel)).build();
List<RepLevelIterable> repLevelIterables = ImmutableList.<RepLevelIterable>builder().addAll(columnChunk.getRepLevelIterables()).add(RepLevelIterables.of(columnChunk.getBlock())).build();
for (int i = 0; i < columnWriters.size(); ++i) {
ColumnWriter columnWriter = columnWriters.get(i);
Block block = columnarRow.getField(i);
columnWriter.writeBlock(new ColumnChunk(block, defLevelIterables, repLevelIterables));
}
}
use of io.trino.parquet.writer.repdef.DefLevelIterable in project trino by trinodb.
the class MapColumnWriter method writeBlock.
@Override
public void writeBlock(ColumnChunk columnChunk) throws IOException {
ColumnarMap columnarMap = ColumnarMap.toColumnarMap(columnChunk.getBlock());
ImmutableList<DefLevelIterable> defLevelIterables = ImmutableList.<DefLevelIterable>builder().addAll(columnChunk.getDefLevelIterables()).add(DefLevelIterables.of(columnarMap, maxDefinitionLevel)).build();
ImmutableList<RepLevelIterable> repLevelIterables = ImmutableList.<RepLevelIterable>builder().addAll(columnChunk.getRepLevelIterables()).add(RepLevelIterables.of(columnarMap, maxRepetitionLevel)).build();
keyWriter.writeBlock(new ColumnChunk(columnarMap.getKeysBlock(), defLevelIterables, repLevelIterables));
valueWriter.writeBlock(new ColumnChunk(columnarMap.getValuesBlock(), defLevelIterables, repLevelIterables));
}
Aggregations