Поправил ссылку.
This commit is contained in:
Dmitriy 2021-11-14 21:11:20 +03:00
parent caf2aec7b8
commit f4d01eecf9
2 changed files with 14 additions and 6 deletions

View File

@ -1116,20 +1116,26 @@ The table below shows supported data types and how they match ClickHouse [data t
| `INT64` | [Int64](../sql-reference/data-types/int-uint.md), [DateTime64](../sql-reference/data-types/datetime.md) | `INT64` |
| `FLOAT32` | [Float32](../sql-reference/data-types/float.md) | `FLOAT32` |
| `FLOAT64` | [Float64](../sql-reference/data-types/float.md) | `FLOAT64` |
| `Text, Data` | [String](../sql-reference/data-types/string.md), [FixedString](../sql-reference/data-types/fixedstring.md) | `Text, Data` |
| `TEXT, DATA` | [String](../sql-reference/data-types/string.md), [FixedString](../sql-reference/data-types/fixedstring.md) | `TEXT, DATA` |
| `union(T, Void), union(Void, T)` | [Nullable(T)](../sql-reference/data-types/date.md) | `union(T, Void), union(Void, T)` |
| `Enum` | [Enum(8\|16)](../sql-reference/data-types/enum.md) | `Enum` |
| `ENUM` | [Enum(8\|16)](../sql-reference/data-types/enum.md) | `ENUM` |
| `LIST` | [Array](../sql-reference/data-types/array.md) | `LIST` |
| `STRUCT` | [Tuple](../sql-reference/data-types/tuple.md) | `STRUCT` |
For working with `Enum` in CapnProto format use the [format_capn_proto_enum_comparising_mode](../operarions/settings/settings.md#format-capn-proto-enum-comparising-mode) setting.
For working with `Enum` in CapnProto format use the [format_capn_proto_enum_comparising_mode](../operations/settings/settings.md#format-capn-proto-enum-comparising-mode) setting.
Arrays can be nested and can have a value of the `Nullable` type as an argument. `Tuple` type also can be nested.
Unsupported CapnProto data types: `TIME32`, `FIXED_SIZE_BINARY`, `JSON`, `UUID`.
Data types of ClickHouse table columns can differ from the corresponding fields of the Parquet data inserted. When inserting data, ClickHouse interprets data types according to the table above and then [cast](../sql-reference/functions/type-conversion-functions/#type_conversion_function-cast) the data to that data type which is set for the ClickHouse table column.
### Inserting and Selecting Data {#inserting-and-selecting-data-capnproto}
You can insert CapnProto data from a file into ClickHouse table by the following command:
``` bash
$ cat capnproto_messages.bin | clickhouse-client --query "INSERT INTO db.hits FORMAT CapnProto SETTINGS format_schema = 'schema:Message'"
$ cat capnproto_messages.bin | clickhouse-client --query "INSERT INTO {some_table} FORMAT CapnProto SETTINGS format_schema = 'schema:Message'"
```
Where `schema.capnp` looks like this:
@ -1141,6 +1147,8 @@ struct Message {
}
```
To insert data into [Nested](../sql-reference/data-types/nested-data-structures/nested.md) columns as an array of structs values you must switch on the [input_format_parquet_import_nested](../operations/settings/settings.md#input_format_parquet_import_nested) setting.
You can select data from a ClickHouse table and save them into some file in the CapnProto format by the following command:
``` bash

View File

@ -4051,11 +4051,11 @@ Default value: `0`.
## format_capn_proto_enum_comparising_mode {#format-capn-proto-enum-comparising-mode}
Determines how to map ClickHouse Enum and CapnProto Enum from schema.
Determines how to map ClickHouse `Enum` data type and CapnProto `Enum` data type from schema.
Possible values:
- `'by_values'` — Values in Enums should be the same, names can be different.
- `'by_values'` — Values in enums should be the same, names can be different.
- `'by_names'` — Names in enums should be the same, values can be different.
- `'by_name_case_insensitive'` — Names in enums should be the same case-insensitive, values can be different.