Search in sources :

Example 1 with RepLevelIterable

use of io.trino.parquet.writer.repdef.RepLevelIterable 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));
    }
}
Also used : ColumnarRow.toColumnarRow(io.trino.spi.block.ColumnarRow.toColumnarRow) ColumnarRow(io.trino.spi.block.ColumnarRow) DefLevelIterable(io.trino.parquet.writer.repdef.DefLevelIterable) Block(io.trino.spi.block.Block) RepLevelIterable(io.trino.parquet.writer.repdef.RepLevelIterable)

Example 2 with RepLevelIterable

use of io.trino.parquet.writer.repdef.RepLevelIterable 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));
}
Also used : DefLevelIterable(io.trino.parquet.writer.repdef.DefLevelIterable) ColumnarMap(io.trino.spi.block.ColumnarMap) RepLevelIterable(io.trino.parquet.writer.repdef.RepLevelIterable)

Aggregations

DefLevelIterable (io.trino.parquet.writer.repdef.DefLevelIterable)2 RepLevelIterable (io.trino.parquet.writer.repdef.RepLevelIterable)2 Block (io.trino.spi.block.Block)1 ColumnarMap (io.trino.spi.block.ColumnarMap)1 ColumnarRow (io.trino.spi.block.ColumnarRow)1 ColumnarRow.toColumnarRow (io.trino.spi.block.ColumnarRow.toColumnarRow)1