MsgPack 형식
MsgPack 형식
MsgPack 형식은 ClickHouse에서 MessagePack 데이터 파일의 읽기와 쓰기를 지원해요. MessagePack은 효율적인 바이너리 직렬화 형식으로, 다양한 데이터 타입을 지원합니다.
출처: 문서
본문
| Input | Output | Alias |
|---|---|---|
| ✔ | ✔ |
설명 (Description)
ClickHouse는 MessagePack 데이터 파일의 읽기와 쓰기를 지원합니다.
데이터 타입 매칭 (Data types matching)
| MessagePack data type ( INSERT ) | ClickHouse data type | MessagePack data type ( SELECT ) |
|---|---|---|
| uint N , positive fixint | UIntN | uint N |
| int N , negative fixint | IntN | int N |
| bool | UInt8 | uint 8 |
| fixstr , str 8 , str 16 , str 32 , bin 8 , bin 16 , bin 32 | String | bin 8 , bin 16 , bin 32 |
| fixstr , str 8 , str 16 , str 32 , bin 8 , bin 16 , bin 32 | FixedString | bin 8 , bin 16 , bin 32 |
| float 32 | Float32 | float 32 |
| float 64 | Float64 | float 64 |
| uint 16 | Date | uint 16 |
| int 32 | Date32 | int 32 |
| uint 32 | DateTime | uint 32 |
| uint 64 | DateTime64 | uint 64 |
| fixarray , array 16 , array 32 | Array / Tuple | fixarray , array 16 , array 32 |
| fixmap , map 16 , map 32 | Map | fixmap , map 16 , map 32 |
| uint 32 | IPv4 | uint 32 |
| bin 8 | String | bin 8 |
| int 8 | Enum8 | int 8 |
| bin 8 | (U)Int128 / (U)Int256 | bin 8 |
| int 32 | Decimal32 | int 32 |
| int 64 | Decimal64 | int 64 |
| bin 8 | Decimal128 / Decimal256 | bin 8 |
사용 예시 (Example usage)
".msgpk" 파일에 쓰기:
$ clickhouse-client --query="CREATE TABLE msgpack (array Array(UInt8)) ENGINE = Memory;"
$ clickhouse-client --query="INSERT INTO msgpack VALUES ([0, 1, 2, 3, 42, 253, 254, 255]), ([255, 254, 253, 42, 3, 2, 1, 0])";
$ clickhouse-client --query="SELECT * FROM msgpack FORMAT MsgPack" > tmp_msgpack.msgpk;
형식 설정 (Format settings)
| Setting | Description | Default |
|---|---|---|
| input_format_msgpack_number_of_columns | 삽입된 MsgPack 데이터의 컬럼 수. 데이터의 자동 스키마 추론에 사용됨. | 0 |
| output_format_msgpack_uuid_representation | MsgPack 형식에서 UUID를 출력하는 방법. | EXT |