diff options
author | AlexSm <alex@ydb.tech> | 2024-01-19 17:48:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 17:48:10 +0100 |
commit | 5722bbf18aa2f471fc5491834c6c877b524e8795 (patch) | |
tree | 0bfe53383cc4dc38261e3e0086af199f39777801 /library/cpp | |
parent | 610b3da211be5d7cfd27077f22b876aedaa2dc29 (diff) | |
download | ydb-5722bbf18aa2f471fc5491834c6c877b524e8795.tar.gz |
Library update 9 (#1163)
* Right libs import scripts
* Library update 9
* Add contrib/libs/cxxsupp/libcxx/include/memory_resource
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/clickhouse/client/client.cpp | 25 | ||||
-rw-r--r-- | library/cpp/clickhouse/client/client.h | 2 |
2 files changed, 14 insertions, 13 deletions
diff --git a/library/cpp/clickhouse/client/client.cpp b/library/cpp/clickhouse/client/client.cpp index 576731ed760..d91ea551946 100644 --- a/library/cpp/clickhouse/client/client.cpp +++ b/library/cpp/clickhouse/client/client.cpp @@ -64,7 +64,7 @@ namespace NClickHouse { void ExecuteQuery(TQuery query); - void Insert(const TString& table_name, const TBlock& block, const TString& query_id); + void Insert(const TString& table_name, const TBlock& block, const TString& query_id, const TString& deduplication_token); void Ping(); @@ -75,7 +75,7 @@ namespace NClickHouse { bool ReceivePacket(ui64* server_packet = nullptr); - void SendQuery(const TString& query, const TString& query_id); + void SendQuery(const TString& query, const TString& query_id, const TString& deduplication_token = ""); void SendData(const TBlock& block); @@ -195,7 +195,7 @@ namespace NClickHouse { } } - void TClient::TImpl::Insert(const TString& table_name, const TBlock& block, const TString& query_id) { + void TClient::TImpl::Insert(const TString& table_name, const TBlock& block, const TString& query_id, const TString& deduplication_token) { if (Options_.PingBeforeQuery) { RetryGuard([this]() { Ping(); }); } @@ -216,7 +216,7 @@ namespace NClickHouse { } } - SendQuery("INSERT INTO " + table_name + " ( " + fields_section + " ) VALUES", query_id); + SendQuery("INSERT INTO " + table_name + " ( " + fields_section + " ) VALUES", query_id, deduplication_token); ui64 server_packet(0); // Receive data packet. @@ -536,7 +536,7 @@ namespace NClickHouse { return exception_received; } - void TClient::TImpl::SendQuery(const TString& query, const TString& query_id) { + void TClient::TImpl::SendQuery(const TString& query, const TString& query_id, const TString& deduplication_token) { TWireFormat::WriteUInt64(&Output_, ClientCodes::Query); TWireFormat::WriteString(&Output_, query_id); @@ -567,11 +567,12 @@ namespace NClickHouse { TWireFormat::WriteString(&Output_, info.QuotaKey); } - /// Per query settings. - //if (settings) - // settings->serialize(*out); - //else - TWireFormat::WriteString(&Output_, TString()); + if (!deduplication_token.empty()) { + static const TString insert_deduplication_token_setting_name = "insert_deduplication_token"; + TWireFormat::WriteString(&Output_, insert_deduplication_token_setting_name); + TWireFormat::WriteString(&Output_, deduplication_token); + } + TWireFormat::WriteString(&Output_, TString()); // Empty string is a marker of end SETTINGS section TWireFormat::WriteUInt64(&Output_, Stages::Complete); TWireFormat::WriteUInt64(&Output_, Compression_); @@ -752,8 +753,8 @@ namespace NClickHouse { Execute(query); } - void TClient::Insert(const TString& table_name, const TBlock& block, const TString& query_id) { - Impl_->Insert(table_name, block, query_id); + void TClient::Insert(const TString& table_name, const TBlock& block, const TString& query_id, const TString& deduplication_token) { + Impl_->Insert(table_name, block, query_id, deduplication_token); } void TClient::Ping() { diff --git a/library/cpp/clickhouse/client/client.h b/library/cpp/clickhouse/client/client.h index b008ef99a56..e8497f7ab87 100644 --- a/library/cpp/clickhouse/client/client.h +++ b/library/cpp/clickhouse/client/client.h @@ -87,7 +87,7 @@ namespace NClickHouse { void Select(const TQuery& query); /// Intends for insert block of data into a table \p table_name. - void Insert(const TString& table_name, const TBlock& block, const TString& query_id = ""); + void Insert(const TString& table_name, const TBlock& block, const TString& query_id = "", const TString& deduplication_token = ""); /// Ping server for aliveness. void Ping(); |