Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCSUP-16819: Add CapnProto output format #31405

Conversation

sevirov
Copy link
Contributor

@sevirov sevirov commented Nov 14, 2021

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category:

Задокументировал формат CapnProto.
@robot-clickhouse robot-clickhouse added the pr-documentation Documentation PRs for the specific code PR label Nov 14, 2021
Поправил ссылку.
Добавил ссылки.
sevirov and others added 3 commits November 19, 2021 20:02
Co-authored-by: gyuton <40863448+gyuton@users.noreply.github.com>
Добавил ссылку.
@sevirov sevirov marked this pull request as ready for review November 20, 2021 12:22
@sevirov
Copy link
Contributor Author

sevirov commented Nov 20, 2021

@Avogar Please, review this PR.

@Avogar Avogar self-assigned this Nov 20, 2021

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.
Copy link
Member

@Avogar Avogar Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's about Parquet format, it's not true for CapnProto. Remove it


``` bash
$ cat capnproto_messages.bin | clickhouse-client --query "INSERT INTO test.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'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remain table test.hits, because we also show an examle of using the schema with fields from this table

@@ -1109,9 +1147,13 @@ struct Message {
}
```

Deserialization is effective and usually does not increase the system load.
To insert data into [Nested](../sql-reference/data-types/nested-data-structures/nested.md) columns as an array of structs values you must enable the [input_format_parquet_import_nested](../operations/settings/settings.md#input_format_parquet_import_nested) setting.
Copy link
Member

@Avogar Avogar Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not connected with CapnProto format at all, remove it

You can select data from a ClickHouse table and save them into some file in the CapnProto format by the following command:

``` bash
$ clickhouse-client --query = "SELECT * FROM capnp_tuples FORMAT CapnProto SETTINGS format_schema = '$CLIENT_SCHEMADIR/02030_capnp_tuples:Message'"
Copy link
Member

@Avogar Avogar Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ clickhouse-client --query = "SELECT * FROM capnp_tuples FORMAT CapnProto SETTINGS format_schema = '$CLIENT_SCHEMADIR/02030_capnp_tuples:Message'"
$ clickhouse-client --query = "SELECT * FROM test.hits FORMAT CapnProto SETTINGS format_schema = 'schema:Message'"

Let's use an example with test.hits and corresponding schema from the previous example.

Поправил согласно комментариям разработчика.
@Avogar Avogar merged commit aaf3488 into ClickHouse:master Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-documentation Documentation PRs for the specific code PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants