|
42 | 42 | #define DBMS_MIN_REVISION_WITH_DISTRIBUTED_DEPTH 54448
|
43 | 43 | #define DBMS_MIN_REVISION_WITH_INITIAL_QUERY_START_TIME 54449
|
44 | 44 | #define DBMS_MIN_REVISION_WITH_INCREMENTAL_PROFILE_EVENTS 54451
|
| 45 | +#define DBMS_MIN_REVISION_WITH_PARALLEL_REPLICAS 54453 |
| 46 | +#define DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION 54454 |
45 | 47 |
|
46 |
| -#define REVISION DBMS_MIN_REVISION_WITH_INCREMENTAL_PROFILE_EVENTS |
| 48 | +#define REVISION DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION |
47 | 49 |
|
48 | 50 | namespace clickhouse {
|
49 | 51 |
|
@@ -552,7 +554,19 @@ bool Client::Impl::ReadBlock(InputStream& input, Block* block) {
|
552 | 554 | return false;
|
553 | 555 | }
|
554 | 556 |
|
| 557 | + uint8_t has_custom_serialization = 0; |
| 558 | + if (REVISION >= DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION) { |
| 559 | + if (!WireFormat::ReadFixed(input, &has_custom_serialization)) { |
| 560 | + return false; |
| 561 | + } |
| 562 | + } |
| 563 | + |
555 | 564 | if (ColumnRef col = CreateColumnByType(type, create_column_settings)) {
|
| 565 | + |
| 566 | + if (has_custom_serialization) { |
| 567 | + col->LoadSerializationKind(&input); |
| 568 | + } |
| 569 | + |
556 | 570 | if (num_rows && !col->Load(&input, num_rows)) {
|
557 | 571 | throw ProtocolError("can't load column '" + name + "' of type " + type);
|
558 | 572 | }
|
@@ -708,6 +722,16 @@ void Client::Impl::SendQuery(const Query& query) {
|
708 | 722 | throw UnimplementedError(std::string("Can't send open telemetry tracing context to a server, server version is too old"));
|
709 | 723 | }
|
710 | 724 | }
|
| 725 | + |
| 726 | + if (server_info_.revision >= DBMS_MIN_REVISION_WITH_PARALLEL_REPLICAS) |
| 727 | + { |
| 728 | + // collaborate_with_initiator |
| 729 | + WireFormat::WriteUInt64 (*output_, 0u); |
| 730 | + // count_participating_replicas |
| 731 | + WireFormat::WriteUInt64 (*output_, 0u); |
| 732 | + // number_of_current_replica |
| 733 | + WireFormat::WriteUInt64 (*output_, 0u); |
| 734 | + } |
711 | 735 | }
|
712 | 736 |
|
713 | 737 | /// Per query settings
|
@@ -757,6 +781,17 @@ void Client::Impl::WriteBlock(const Block& block, OutputStream& output) {
|
757 | 781 | WireFormat::WriteString(output, bi.Name());
|
758 | 782 | WireFormat::WriteString(output, bi.Type()->GetName());
|
759 | 783 |
|
| 784 | + bool has_custom = bi.Column()->HasCustomSerialization(); |
| 785 | + if (server_info_.revision >= DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION) { |
| 786 | + WireFormat::WriteFixed(output, static_cast<uint8_t>(has_custom)); |
| 787 | + if (has_custom) { |
| 788 | + bi.Column()->SaveSerializationKind(&output); |
| 789 | + } |
| 790 | + } else { |
| 791 | + // Current implementation works only for server version >= v22.1.2.2-stable |
| 792 | + throw UnimplementedError(std::string("Can't send column with custom serialisation to a server, server version is too old")); |
| 793 | + } |
| 794 | + |
760 | 795 | // Empty columns are not serialized and occupy exactly 0 bytes.
|
761 | 796 | // ref https://github.com/ClickHouse/ClickHouse/blob/39b37a3240f74f4871c8c1679910e065af6bea19/src/Formats/NativeWriter.cpp#L163
|
762 | 797 | const bool containsData = block.GetRowCount() > 0;
|
|
0 commit comments