Search in sources :

Example 1 with WritableBytesVector

use of org.apache.flink.table.data.columnar.vector.writable.WritableBytesVector in project flink by apache.

the class FixedLenBytesColumnReader method readBatchFromDictionaryIds.

@Override
protected void readBatchFromDictionaryIds(int rowId, int num, VECTOR column, WritableIntVector dictionaryIds) {
    if (ParquetSchemaConverter.is32BitDecimal(precision)) {
        WritableIntVector intVector = (WritableIntVector) column;
        for (int i = rowId; i < rowId + num; ++i) {
            if (!intVector.isNullAt(i)) {
                Binary v = dictionary.decodeToBinary(dictionaryIds.getInt(i));
                intVector.setInt(i, (int) heapBinaryToLong(v));
            }
        }
    } else if (ParquetSchemaConverter.is64BitDecimal(precision)) {
        WritableLongVector longVector = (WritableLongVector) column;
        for (int i = rowId; i < rowId + num; ++i) {
            if (!longVector.isNullAt(i)) {
                Binary v = dictionary.decodeToBinary(dictionaryIds.getInt(i));
                longVector.setLong(i, heapBinaryToLong(v));
            }
        }
    } else {
        WritableBytesVector bytesVector = (WritableBytesVector) column;
        for (int i = rowId; i < rowId + num; ++i) {
            if (!bytesVector.isNullAt(i)) {
                byte[] v = dictionary.decodeToBinary(dictionaryIds.getInt(i)).getBytes();
                bytesVector.appendBytes(i, v, 0, v.length);
            }
        }
    }
}
Also used : WritableBytesVector(org.apache.flink.table.data.columnar.vector.writable.WritableBytesVector) Binary(org.apache.parquet.io.api.Binary) WritableIntVector(org.apache.flink.table.data.columnar.vector.writable.WritableIntVector) WritableLongVector(org.apache.flink.table.data.columnar.vector.writable.WritableLongVector)

Aggregations

WritableBytesVector (org.apache.flink.table.data.columnar.vector.writable.WritableBytesVector)1 WritableIntVector (org.apache.flink.table.data.columnar.vector.writable.WritableIntVector)1 WritableLongVector (org.apache.flink.table.data.columnar.vector.writable.WritableLongVector)1 Binary (org.apache.parquet.io.api.Binary)1