public static ParquetValue fromBytes()

in c3r-sdk-parquet/src/main/java/com/amazonaws/c3r/data/ParquetValue.java [78:99]


    public static ParquetValue fromBytes(final ParquetDataType type, final byte[] bytes) {
        // asPrimitiveType() is guaranteed to work here because ParquetDataType.isSupportedType only
        // returns true for a subset of primitive types

        switch (type.getParquetType().asPrimitiveType().getPrimitiveTypeName()) {
            case BOOLEAN:
                return new Boolean(type, ValueConverter.Boolean.fromBytes(bytes));
            case INT32:
                return new Int32(type, ValueConverter.Int.fromBytes(bytes));
            case INT64:
                return new Int64(type, ValueConverter.BigInt.fromBytes(bytes));
            case FLOAT:
                return new Float(type, ValueConverter.Float.fromBytes(bytes));
            case FIXED_LEN_BYTE_ARRAY:
            case BINARY:
                return new Binary(type, (bytes != null) ? org.apache.parquet.io.api.Binary.fromReusedByteArray(bytes) : null);
            case DOUBLE:
                return new Double(type, ValueConverter.Double.fromBytes(bytes));
            default:
                throw new C3rIllegalArgumentException("Unrecognized data type: " + type);
        }
    }