ClickHouse/docs/en/formats/capnproto.md
BayoNet 13d9a4eebe Sources for english documentation switched to Markdown.
Edit page link is fixed too for both language versions of documentation.
2017-12-28 18:13:23 +03:00

893 B

CapnProto

Cap'n Proto is a binary message format similar to Protocol Buffers and Thrift, but not like JSON or MessagePack.

Cap'n Proto messages are strictly typed and not self-describing, meaning they need an external schema description. The schema is applied on the fly and cached for each query.

SELECT SearchPhrase, count() AS c FROM test.hits
       GROUP BY SearchPhrase FORMAT CapnProto SETTINGS schema = 'schema:Message'

Where schema.capnp looks like this:

struct Message {
  SearchPhrase @0 :Text;
  c @1 :Uint64;
}

Schema files are in the file that is located in the directory specified in format_schema_path in the server configuration.

Deserialization is effective and usually doesn't increase the system load.