Add example

This commit is contained in:
adevyatova 2021-09-11 02:13:55 +00:00
parent 348dec14a4
commit 1d4f73ac7b
3 changed files with 18 additions and 4 deletions

View File

@ -1563,5 +1563,12 @@ ClickHouse supports reading and writing [MessagePack](https://msgpack.org/) data
| `uint 32` | [DateTime](../sql-reference/data-types/datetime.md) |
| `uint 64` | [DateTime64](../sql-reference/data-types/datetime.md) |
| `fixarray`, `array 16`, `array 32`| [Array](../sql-reference/data-types/array.md) |
Unsupported MsgPack data type: `nil`.
| `nil` | [Nothing](../sql-reference/data-types/special-data-types/nothing.md) |
Example:
```sql
CREATE TABLE msgpack (uint8 UInt8, uint16 UInt16, uint32 UInt32, uint64 UInt64, int8 Int8, int16 Int16, int32 Int32, int64 Int64, float Float32, double Float64, string String, date Date, datetime DateTime, datetime64 DateTime64, array Array(UInt32)) ENGINE = Memory;
INSERT INTO msgpack VALUES (255, 65535, 4294967295, 100000000000, -128, -32768, -2147483648, -100000000000, 2.02, 10000.0000001, 'String', 18980, 1639872000, 1639872000000, [1,2,3,4,5]), (4, 1234, 3244467295, 500000000000, -1, -256, -14741221, -7000000000, 100.1, 14321.032141201, 'Another string', 20000, 1839882000, 1639872891123, [5,4,3,2,1]),(42, 42, 42, 42, 42, 42, 42, 42, 42.42, 42.42, '42', 42, 42, 42, [42]);
SELECT * FROM msgpack INTO OUTFILE 'tmp_msgpac_test_all_types.msgpk' FORMAT MsgPack;
```

View File

@ -1477,5 +1477,12 @@ ClickHouse поддерживает запись и чтение из файло
| `uint 32` | [DateTime](../sql-reference/data-types/datetime.md) |
| `uint 64` | [DateTime64](../sql-reference/data-types/datetime.md) |
| `fixarray`, `array 16`, `array 32`| [Array](../sql-reference/data-types/array.md) |
Неподдерживаемый тип данных: `nil`.
| `nil` | [Nothing](../sql-reference/data-types/special-data-types/nothing.md) |
Пример:
```sql
CREATE TABLE msgpack (uint8 UInt8, uint16 UInt16, uint32 UInt32, uint64 UInt64, int8 Int8, int16 Int16, int32 Int32, int64 Int64, float Float32, double Float64, string String, date Date, datetime DateTime, datetime64 DateTime64, array Array(UInt32)) ENGINE = Memory;
INSERT INTO msgpack VALUES (255, 65535, 4294967295, 100000000000, -128, -32768, -2147483648, -100000000000, 2.02, 10000.0000001, 'String', 18980, 1639872000, 1639872000000, [1,2,3,4,5]), (4, 1234, 3244467295, 500000000000, -1, -256, -14741221, -7000000000, 100.1, 14321.032141201, 'Another string', 20000, 1839882000, 1639872891123, [5,4,3,2,1]),(42, 42, 42, 42, 42, 42, 42, 42, 42.42, 42.42, '42', 42, 42, 42, [42]);
SELECT * FROM msgpack INTO OUTFILE 'tmp_msgpac_test_all_types.msgpk' FORMAT MsgPack;
```

Binary file not shown.