From a1d771a36ea09da2d2e3b08248ab0b8398e4b094 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Thu, 22 Aug 2024 18:28:08 +0000 Subject: [PATCH] Fixes --- cmake/common.cmake | 3 ++ examples/vector_index/CMakeLists.txt | 4 +-- include/ydb-cpp-sdk/client/topic/errors.h | 2 +- .../ydb-cpp-sdk/client/topic/retry_policy.h | 2 +- .../library/yql_common/issue/yql_issue_id.h | 2 +- include/ydb-cpp-sdk/type_switcher.h | 14 +++++--- src/api/protos/ydb_issue_message.proto | 2 +- .../kqp_session_common/CMakeLists.txt | 2 +- src/client/persqueue_public/impl/common.h | 2 +- .../persqueue_public/ut/basic_usage_ut.cpp | 2 +- src/client/persqueue_public/ut/common_ut.cpp | 2 +- .../ut/compress_executor_ut.cpp | 2 +- .../persqueue_public/ut/compression_ut.cpp | 2 +- .../persqueue_public/ut/read_session_ut.cpp | 8 ++--- .../persqueue_public/ut/retry_policy_ut.cpp | 2 +- .../ut/ut_utils/data_plane_helpers.h | 2 +- .../ut/ut_utils/sdk_test_setup.h | 2 +- .../ut/ut_utils/test_server.h | 2 +- .../persqueue_public/ut/ut_utils/ut_utils.h | 10 +++--- src/client/proto/CMakeLists.txt | 2 +- src/client/table/impl/CMakeLists.txt | 2 +- src/client/topic/ut/basic_usage_ut.cpp | 12 +++---- src/client/topic/ut/describe_topic_ut.cpp | 8 ++--- src/client/topic/ut/local_partition_ut.cpp | 12 +++---- src/client/topic/ut/topic_to_table_ut.cpp | 2 +- src/client/topic/ut/trace_ut.cpp | 2 +- .../topic/ut/ut_utils/topic_sdk_test_setup.h | 4 +-- src/client/topic/ut/ut_utils/trace.cpp | 2 +- src/client/topic/ut/ut_utils/trace.h | 2 +- .../oauth2_token_exchange/credentials.cpp | 2 +- .../oauth2_token_exchange/from_file.cpp | 2 +- src/library/json_value/ydb_json_value.cpp | 2 +- src/library/retry/retry.h | 2 +- src/library/yql_common/issue/CMakeLists.txt | 32 ++++++++++--------- src/library/yql_common/issue/out.cpp | 22 ++++++++++++- .../yql_common/issue/yql_issue_message.cpp | 2 +- tests/unit/library/yql_common/CMakeLists.txt | 8 ++--- .../library/yql_common/issue/yql_issue_ut.cpp | 2 +- 38 files changed, 109 insertions(+), 80 deletions(-) diff --git a/cmake/common.cmake b/cmake/common.cmake index dea372f162..546ce4e81f 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -198,6 +198,9 @@ function(_ydb_sdk_add_library Tgt) $ $ ) + target_compile_definitions(${Tgt} ${includeMode} + YDB_SDK_USE_STD_STRING + ) endfunction() function(_ydb_sdk_validate_public_headers) diff --git a/examples/vector_index/CMakeLists.txt b/examples/vector_index/CMakeLists.txt index e3afbd3601..cd836a00b4 100644 --- a/examples/vector_index/CMakeLists.txt +++ b/examples/vector_index/CMakeLists.txt @@ -2,7 +2,7 @@ add_executable(vector_index) target_link_libraries(vector_index PUBLIC yutil - library-getopt + getopt YDB-CPP-SDK::Table ) @@ -15,7 +15,7 @@ vcs_info(vector_index) if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") target_link_libraries(vector_index PUBLIC - library-cpuid_check + cpuid_check ) endif() diff --git a/include/ydb-cpp-sdk/client/topic/errors.h b/include/ydb-cpp-sdk/client/topic/errors.h index de86fcb379..e8790061c7 100644 --- a/include/ydb-cpp-sdk/client/topic/errors.h +++ b/include/ydb-cpp-sdk/client/topic/errors.h @@ -3,7 +3,7 @@ #include #include -#include +#include namespace NYdb::NTopic { diff --git a/include/ydb-cpp-sdk/client/topic/retry_policy.h b/include/ydb-cpp-sdk/client/topic/retry_policy.h index 255c3b4681..8aef9f3556 100644 --- a/include/ydb-cpp-sdk/client/topic/retry_policy.h +++ b/include/ydb-cpp-sdk/client/topic/retry_policy.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include namespace NYdb::NTopic { diff --git a/include/ydb-cpp-sdk/library/yql_common/issue/yql_issue_id.h b/include/ydb-cpp-sdk/library/yql_common/issue/yql_issue_id.h index 5520e4a090..88111b104e 100644 --- a/include/ydb-cpp-sdk/library/yql_common/issue/yql_issue_id.h +++ b/include/ydb-cpp-sdk/library/yql_common/issue/yql_issue_id.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace NYql { diff --git a/include/ydb-cpp-sdk/type_switcher.h b/include/ydb-cpp-sdk/type_switcher.h index 8e90d9474f..107c259a39 100644 --- a/include/ydb-cpp-sdk/type_switcher.h +++ b/include/ydb-cpp-sdk/type_switcher.h @@ -1,13 +1,17 @@ #pragma once -#ifdef YDB_SDK_USE_TSTRING -#include +#ifdef YDB_SDK_USE_STD_STRING + +#include namespace NYdb { -using TStringType = TString; +using TStringType = std::string; } + #else -#include + +#include namespace NYdb { -using TStringType = std::string; +using TStringType = TString; } + #endif diff --git a/src/api/protos/ydb_issue_message.proto b/src/api/protos/ydb_issue_message.proto index 652007b0ab..534111d4e3 100644 --- a/src/api/protos/ydb_issue_message.proto +++ b/src/api/protos/ydb_issue_message.proto @@ -16,7 +16,7 @@ message IssueMessage { string message = 2; Position end_position = 3; uint32 issue_code = 4; - // Severity values from ydb/public/sdk/cpp/src/library/yql_common/issue/protos/issue_severity.proto + // Severity values from src/library/yql_common/issue/protos/issue_severity.proto // FATAL = 0; // ERROR = 1; // WARNING = 2; diff --git a/src/client/impl/ydb_internal/kqp_session_common/CMakeLists.txt b/src/client/impl/ydb_internal/kqp_session_common/CMakeLists.txt index 48eb9fcb9e..405cbd9653 100644 --- a/src/client/impl/ydb_internal/kqp_session_common/CMakeLists.txt +++ b/src/client/impl/ydb_internal/kqp_session_common/CMakeLists.txt @@ -3,7 +3,7 @@ _ydb_sdk_add_library(impl-ydb_internal-kqp_session_common) target_link_libraries(impl-ydb_internal-kqp_session_common PUBLIC yutil threading-future - lib-operation_id-protos + library-operation_id client-impl-ydb_endpoints ) diff --git a/src/client/persqueue_public/impl/common.h b/src/client/persqueue_public/impl/common.h index 3e7d591aa6..945b411e73 100644 --- a/src/client/persqueue_public/impl/common.h +++ b/src/client/persqueue_public/impl/common.h @@ -2,7 +2,7 @@ #include -#include +#include namespace NYdb::NPersQueue { ERetryErrorClass GetRetryErrorClass(EStatus status); diff --git a/src/client/persqueue_public/ut/basic_usage_ut.cpp b/src/client/persqueue_public/ut/basic_usage_ut.cpp index f4434fe210..a7fad7491b 100644 --- a/src/client/persqueue_public/ut/basic_usage_ut.cpp +++ b/src/client/persqueue_public/ut/basic_usage_ut.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/src/client/persqueue_public/ut/common_ut.cpp b/src/client/persqueue_public/ut/common_ut.cpp index f970073f5f..07115d62e0 100644 --- a/src/client/persqueue_public/ut/common_ut.cpp +++ b/src/client/persqueue_public/ut/common_ut.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/src/client/persqueue_public/ut/compress_executor_ut.cpp b/src/client/persqueue_public/ut/compress_executor_ut.cpp index 9c8b20fa07..baed9bd81a 100644 --- a/src/client/persqueue_public/ut/compress_executor_ut.cpp +++ b/src/client/persqueue_public/ut/compress_executor_ut.cpp @@ -1,4 +1,4 @@ -#include +#include namespace NYdb::NPersQueue::NTests { diff --git a/src/client/persqueue_public/ut/compression_ut.cpp b/src/client/persqueue_public/ut/compression_ut.cpp index 8d86ba9f64..6119a4b8a9 100644 --- a/src/client/persqueue_public/ut/compression_ut.cpp +++ b/src/client/persqueue_public/ut/compression_ut.cpp @@ -1,4 +1,4 @@ -#include +#include namespace NYdb::NPersQueue::NTests { diff --git a/src/client/persqueue_public/ut/read_session_ut.cpp b/src/client/persqueue_public/ut/read_session_ut.cpp index ac573bb2e0..4cab328fa6 100644 --- a/src/client/persqueue_public/ut/read_session_ut.cpp +++ b/src/client/persqueue_public/ut/read_session_ut.cpp @@ -1,11 +1,11 @@ -#include +#include #define INCLUDE_YDB_INTERNAL_H -#include +#include #undef INCLUDE_YDB_INTERNAL_H -#include -#include +#include +#include #include #include diff --git a/src/client/persqueue_public/ut/retry_policy_ut.cpp b/src/client/persqueue_public/ut/retry_policy_ut.cpp index ec26f55d29..819c43f6b8 100644 --- a/src/client/persqueue_public/ut/retry_policy_ut.cpp +++ b/src/client/persqueue_public/ut/retry_policy_ut.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/src/client/persqueue_public/ut/ut_utils/data_plane_helpers.h b/src/client/persqueue_public/ut/ut_utils/data_plane_helpers.h index 48f90c03f6..8d6f782e4d 100644 --- a/src/client/persqueue_public/ut/ut_utils/data_plane_helpers.h +++ b/src/client/persqueue_public/ut/ut_utils/data_plane_helpers.h @@ -2,7 +2,7 @@ #include #include -#include +#include namespace NKikimr::NPersQueueTests { diff --git a/src/client/persqueue_public/ut/ut_utils/sdk_test_setup.h b/src/client/persqueue_public/ut/ut_utils/sdk_test_setup.h index 58e26ab5b3..b65bbfd80d 100644 --- a/src/client/persqueue_public/ut/ut_utils/sdk_test_setup.h +++ b/src/client/persqueue_public/ut/ut_utils/sdk_test_setup.h @@ -1,6 +1,6 @@ #pragma once #include "test_server.h" -#include +#include #include #include diff --git a/src/client/persqueue_public/ut/ut_utils/test_server.h b/src/client/persqueue_public/ut/ut_utils/test_server.h index 4e5600e8f1..bd4790d978 100644 --- a/src/client/persqueue_public/ut/ut_utils/test_server.h +++ b/src/client/persqueue_public/ut/ut_utils/test_server.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #include diff --git a/src/client/persqueue_public/ut/ut_utils/ut_utils.h b/src/client/persqueue_public/ut/ut_utils/ut_utils.h index 7da4f7b7f3..c850d891d4 100644 --- a/src/client/persqueue_public/ut/ut_utils/ut_utils.h +++ b/src/client/persqueue_public/ut/ut_utils/ut_utils.h @@ -1,11 +1,11 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include -#include +#include using namespace NKikimr; using namespace NKikimr::NPersQueueTests; diff --git a/src/client/proto/CMakeLists.txt b/src/client/proto/CMakeLists.txt index b5dcd5e654..e240c9962a 100644 --- a/src/client/proto/CMakeLists.txt +++ b/src/client/proto/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries(client-ydb_proto PUBLIC api-grpc api-grpc-draft api-protos - lib-operation_id-protos + library-operation_id client-ydb_params client-ydb_value yql-public-issue-protos diff --git a/src/client/table/impl/CMakeLists.txt b/src/client/table/impl/CMakeLists.txt index 9cb4ba9547..343b00fcde 100644 --- a/src/client/table/impl/CMakeLists.txt +++ b/src/client/table/impl/CMakeLists.txt @@ -6,7 +6,7 @@ target_link_libraries(client-ydb_table-impl threading-future api-protos api-grpc - lib-operation_id-protos + library-operation_id client-impl-ydb_endpoints impl-ydb_internal-session_pool client-ydb_table-query_stats diff --git a/src/client/topic/ut/basic_usage_ut.cpp b/src/client/topic/ut/basic_usage_ut.cpp index d3b935adb9..2743f13775 100644 --- a/src/client/topic/ut/basic_usage_ut.cpp +++ b/src/client/topic/ut/basic_usage_ut.cpp @@ -1,15 +1,15 @@ #include "ut_utils/managed_executor.h" #include "ut_utils/topic_sdk_test_setup.h" -#include +#include #include -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/src/client/topic/ut/describe_topic_ut.cpp b/src/client/topic/ut/describe_topic_ut.cpp index 938c59d441..75258d97c7 100644 --- a/src/client/topic/ut/describe_topic_ut.cpp +++ b/src/client/topic/ut/describe_topic_ut.cpp @@ -1,12 +1,12 @@ #include "ut_utils/topic_sdk_test_setup.h" #include -#include +#include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/src/client/topic/ut/local_partition_ut.cpp b/src/client/topic/ut/local_partition_ut.cpp index 841d0d2233..68f391e315 100644 --- a/src/client/topic/ut/local_partition_ut.cpp +++ b/src/client/topic/ut/local_partition_ut.cpp @@ -2,16 +2,16 @@ #include -#include +#include -#include +#include #include -#include +#include -#include +#include -#include -#include +#include +#include #include #include diff --git a/src/client/topic/ut/topic_to_table_ut.cpp b/src/client/topic/ut/topic_to_table_ut.cpp index c8a883cf79..2196fbc25e 100644 --- a/src/client/topic/ut/topic_to_table_ut.cpp +++ b/src/client/topic/ut/topic_to_table_ut.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/client/topic/ut/trace_ut.cpp b/src/client/topic/ut/trace_ut.cpp index 133bfb3e65..4272e57e77 100644 --- a/src/client/topic/ut/trace_ut.cpp +++ b/src/client/topic/ut/trace_ut.cpp @@ -1,6 +1,6 @@ #include -#include +#include namespace NYdb::NTopic::NTests { diff --git a/src/client/topic/ut/ut_utils/topic_sdk_test_setup.h b/src/client/topic/ut/ut_utils/topic_sdk_test_setup.h index 0d188cdcd5..0dc2eb744c 100644 --- a/src/client/topic/ut/ut_utils/topic_sdk_test_setup.h +++ b/src/client/topic/ut/ut_utils/topic_sdk_test_setup.h @@ -1,8 +1,8 @@ #pragma once -#include +#include -#include +#include namespace NYdb::NTopic::NTests { diff --git a/src/client/topic/ut/ut_utils/trace.cpp b/src/client/topic/ut/ut_utils/trace.cpp index a2bebdb1b8..8b76f2dcd3 100644 --- a/src/client/topic/ut/ut_utils/trace.cpp +++ b/src/client/topic/ut/ut_utils/trace.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "library/cpp/testing/unittest/registar.h" diff --git a/src/client/topic/ut/ut_utils/trace.h b/src/client/topic/ut/ut_utils/trace.h index fe45738e1d..8035e4ff80 100644 --- a/src/client/topic/ut/ut_utils/trace.h +++ b/src/client/topic/ut/ut_utils/trace.h @@ -1,6 +1,6 @@ #pragma once -#include "ydb/public/sdk/cpp/src/client/topic/common/trace_lazy.h" +#include "src/client/topic/common/trace_lazy.h" #include "library/cpp/logger/backend.h" #include "library/cpp/logger/record.h" diff --git a/src/client/types/credentials/oauth2_token_exchange/credentials.cpp b/src/client/types/credentials/oauth2_token_exchange/credentials.cpp index f363dbafa8..a780fa8e68 100644 --- a/src/client/types/credentials/oauth2_token_exchange/credentials.cpp +++ b/src/client/types/credentials/oauth2_token_exchange/credentials.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/client/types/credentials/oauth2_token_exchange/from_file.cpp b/src/client/types/credentials/oauth2_token_exchange/from_file.cpp index 5586a114be..c4b23569c8 100644 --- a/src/client/types/credentials/oauth2_token_exchange/from_file.cpp +++ b/src/client/types/credentials/oauth2_token_exchange/from_file.cpp @@ -250,7 +250,7 @@ TOauth2TokenExchangeParams ReadOauth2ConfigJson(const std::string& configJson, c } TOauth2TokenExchangeParams ReadOauth2ConfigFile(const std::string& configFilePath, const std::string& tokenEndpoint) { - return ReadOauth2ConfigJson(TFileInput(TStringType{configFilePath}).ReadAll(), tokenEndpoint); + return ReadOauth2ConfigJson(TFileInput(TString{configFilePath}).ReadAll(), tokenEndpoint); } } // namespace diff --git a/src/library/json_value/ydb_json_value.cpp b/src/library/json_value/ydb_json_value.cpp index 0797a4ea85..e4f50d1f43 100644 --- a/src/library/json_value/ydb_json_value.cpp +++ b/src/library/json_value/ydb_json_value.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/src/library/retry/retry.h b/src/library/retry/retry.h index 24ff8eb4e3..24b0440a1d 100644 --- a/src/library/retry/retry.h +++ b/src/library/retry/retry.h @@ -3,7 +3,7 @@ #include #include "utils.h" -#include +#include #include #include diff --git a/src/library/yql_common/issue/CMakeLists.txt b/src/library/yql_common/issue/CMakeLists.txt index 63ab398c01..e8f0e1df09 100644 --- a/src/library/yql_common/issue/CMakeLists.txt +++ b/src/library/yql_common/issue/CMakeLists.txt @@ -2,23 +2,25 @@ add_subdirectory(protos) _ydb_sdk_add_library(yql-public-issue) -target_link_libraries(yql-public-issue PUBLIC - yutil - protobuf::libprotobuf - colorizer - resource - api-protos - yql-public-issue-protos - yql-utils - enum_serialization_runtime - string_utils-misc +target_link_libraries(yql-public-issue + PUBLIC + yutil + protobuf::libprotobuf + colorizer + resource + api-protos + yql-public-issue-protos + yql-utils + enum_serialization_runtime + string_utils-misc ) -target_sources(yql-public-issue PRIVATE - yql_issue_id.cpp - yql_issue_message.cpp - yql_issue.cpp - out.cpp +target_sources(yql-public-issue + PRIVATE + yql_issue_id.cpp + yql_issue_message.cpp + yql_issue.cpp + out.cpp ) _ydb_sdk_install_targets(TARGETS yql-public-issue) diff --git a/src/library/yql_common/issue/out.cpp b/src/library/yql_common/issue/out.cpp index daba5eb062..620198fe9d 100644 --- a/src/library/yql_common/issue/out.cpp +++ b/src/library/yql_common/issue/out.cpp @@ -1,9 +1,29 @@ -#include +#include +#include #include #include +#include + +Y_DECLARE_OUT_SPEC(, Ydb::Issue::IssueMessage, stream, value) { + google::protobuf::TextFormat::Printer printer; + printer.SetSingleLineMode(true); + printer.SetUseUtf8StringEscaping(true); + + NYdb::TStringType str; + printer.PrintToString(value, &str); + + // Copied from text_format.h + // Single line mode currently might have an extra space at the end. + if (str.size() > 0 && str[str.size() - 1] == ' ') { + str.resize(str.size() - 1); + } + + stream << "{ " << str << " }"; +} + Y_DECLARE_OUT_SPEC(, NYql::NIssue::NProto::IssueMessage, stream, value) { google::protobuf::TextFormat::Printer printer; printer.SetSingleLineMode(true); diff --git a/src/library/yql_common/issue/yql_issue_message.cpp b/src/library/yql_common/issue/yql_issue_message.cpp index d9b8a5c5de..3bbef566d1 100644 --- a/src/library/yql_common/issue/yql_issue_message.cpp +++ b/src/library/yql_common/issue/yql_issue_message.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include diff --git a/tests/unit/library/yql_common/CMakeLists.txt b/tests/unit/library/yql_common/CMakeLists.txt index a9c769490f..af67643777 100644 --- a/tests/unit/library/yql_common/CMakeLists.txt +++ b/tests/unit/library/yql_common/CMakeLists.txt @@ -1,6 +1,6 @@ add_ydb_test(NAME yql-utils_ut SOURCES - utf8_ut.cpp + utils/utf8_ut.cpp LINK_LIBRARIES yutil cpp-testing-unittest_main @@ -11,7 +11,7 @@ add_ydb_test(NAME yql-utils_ut add_ydb_test(NAME yql-public-issue_ut SOURCES - yql_issue_ut.cpp + issue/yql_issue_ut.cpp LINK_LIBRARIES yutil cpp-testing-unittest_main @@ -23,7 +23,7 @@ add_ydb_test(NAME yql-public-issue_ut add_ydb_test(NAME yql-public-decimal_ut SOURCES - yql_decimal_ut.cpp + decimal/yql_decimal_ut.cpp LINK_LIBRARIES yutil cpp-testing-unittest_main @@ -34,7 +34,7 @@ add_ydb_test(NAME yql-public-decimal_ut add_ydb_test(NAME yql-public-wide_int_ut SOURCES - yql_wide_int_ut.cpp + decimal/yql_wide_int_ut.cpp LINK_LIBRARIES yutil cpp-testing-unittest_main diff --git a/tests/unit/library/yql_common/issue/yql_issue_ut.cpp b/tests/unit/library/yql_common/issue/yql_issue_ut.cpp index 8fd87bb1c5..f7451c006d 100644 --- a/tests/unit/library/yql_common/issue/yql_issue_ut.cpp +++ b/tests/unit/library/yql_common/issue/yql_issue_ut.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include