clickhouse-native 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/clickhouse_native/client.cpp +847 -0
- data/ext/clickhouse_native/extconf.rb +101 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.clang-format +11 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.git +1 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitattributes +63 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/CODEOWNERS +1 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/linux.yml +139 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/macos.yml +87 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_mingw.yml +102 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_msvc.yml +74 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitignore +280 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/.travis.yml +62 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/CMakeLists.txt +157 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/LICENSE +206 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/README.md +260 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/CMakeLists.txt +246 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/buffer.h +10 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.cpp +258 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.h +48 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.cpp +20 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.h +34 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.cpp +96 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.h +103 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/open_telemetry.h +23 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.cpp +119 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.h +142 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.cpp +1 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.h +33 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/projected_iterator.h +55 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/singleton.h +11 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.cpp +489 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.h +177 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.cpp +307 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.h +111 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_utils.h +28 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_view.h +142 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/uuid.h +10 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.cpp +177 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.h +79 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.cpp +134 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.h +114 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.cpp +1269 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.h +320 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.cpp +175 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.h +321 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.cpp +24 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.h +107 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.cpp +365 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.h +245 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.cpp +255 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.h +50 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.cpp +123 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.h +65 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.cpp +285 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.h +14 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.cpp +108 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.h +79 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.cpp +117 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.h +71 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.cpp +108 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.h +66 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.cpp +101 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.h +86 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.cpp +527 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.h +221 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinalityadaptor.h +63 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.cpp +87 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.h +257 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nothing.h +87 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.cpp +109 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.h +153 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.cpp +126 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.h +88 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.cpp +333 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.h +145 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.cpp +155 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.h +118 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.cpp +106 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.h +178 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/utils.h +41 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.cpp +80 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.h +58 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/error_codes.h +595 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/exceptions.h +66 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/protocol.h +54 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.cpp +25 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.h +246 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/server_exception.h +16 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.cpp +314 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.h +89 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.cpp +484 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.h +397 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/version.h +14 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findcityhash.cmake +26 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findlz4.cmake +39 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findzstd.cmake +39 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/cpp17.cmake +8 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/openssl.cmake +8 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/subdirs.cmake +5 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/version.cmake +87 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/CMakeLists.txt +9 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/attributes.h +682 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/config.h +714 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/internal/bits.h +219 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/macros.h +147 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/optimization.h +241 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/options.h +238 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/policy_checks.h +111 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/port.h +26 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.cc +390 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.h +1092 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_have_intrinsic.inc +302 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_no_intrinsic.inc +308 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/BUCK +13 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/CMakeLists.txt +7 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/COPYING +19 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.cc +469 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.h +90 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/citycrc.h +43 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/config.h +118 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/BUCK +14 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/CMakeLists.txt +4 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/LICENSE +28 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/README.md +1 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-death-test.h +346 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-matchers.h +930 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-message.h +219 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-param-test.h +507 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-printers.h +1029 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-spi.h +238 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-test-part.h +184 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-typed-test.h +329 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest.h +2495 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_pred_impl.h +359 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_prod.h +61 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/README.md +56 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-port.h +37 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-printers.h +42 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest.h +37 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-death-test-internal.h +304 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-filepath.h +211 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-internal.h +1560 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-param-util.h +947 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port-arch.h +114 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port.h +2389 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-string.h +175 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-type-util.h +183 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-all.cc +48 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-death-test.cc +1644 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-filepath.cc +369 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-internal-inl.h +1221 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-matchers.cc +97 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-port.cc +1433 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-printers.cc +533 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-test-part.cc +108 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-typed-test.cc +107 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest.cc +6746 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest_main.cc +54 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/BUCK +13 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/CMakeLists.txt +8 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/LICENSE +24 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.c +2402 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.h +764 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.c +1554 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.h +438 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/BUCK +232 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/CMakeLists.txt +115 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/LICENSE +30 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/allocations.h +55 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bits.h +200 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bitstream.h +437 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/compiler.h +358 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/cpu.h +213 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.c +24 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.h +107 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/entropy_common.c +340 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.c +63 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.h +159 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse.h +639 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse_decompress.c +311 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/huf.h +273 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/mem.h +435 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.c +371 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.h +90 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/portability_macros.h +156 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.c +176 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.h +150 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.c +24 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.h +5686 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_common.c +48 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_deps.h +111 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_internal.h +392 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_trace.h +163 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/clevels.h +134 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/fse_compress.c +624 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.c +181 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.h +75 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/huf_compress.c +1435 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress.c +7032 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_internal.h +1532 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.c +235 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.h +39 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.c +442 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.h +54 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.c +577 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.h +32 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_cwksp.h +742 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.c +758 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.h +39 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.c +960 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.h +38 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.c +2157 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.h +127 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.c +724 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.h +117 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm_geartab.h +106 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.c +1472 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.h +56 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.c +1867 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.h +113 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress.c +1882 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress_amd64.S +576 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.c +244 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.h +44 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress.c +2355 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.c +2192 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.h +73 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_internal.h +238 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.c +1257 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.h +158 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.c +1913 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.h +67 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/fastcover.c +766 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/zdict.c +1127 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_legacy.h +422 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.c +2125 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.h +94 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.c +3477 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.h +93 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.c +3117 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.h +93 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.c +3605 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.h +142 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.c +4004 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.h +162 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.c +4113 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.h +172 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.c +4498 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.h +187 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zdict.h +474 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd.h +3020 -0
- data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd_errors.h +114 -0
- data/lib/clickhouse_native/clickhouse_native.bundle +0 -0
- data/lib/clickhouse_native/client.rb +50 -0
- data/lib/clickhouse_native/errors.rb +23 -0
- data/lib/clickhouse_native/pool.rb +49 -0
- data/lib/clickhouse_native/version.rb +3 -0
- data/lib/clickhouse_native.rb +8 -0
- metadata +369 -0
|
@@ -0,0 +1,1269 @@
|
|
|
1
|
+
#include "client.h"
|
|
2
|
+
#include "clickhouse/version.h"
|
|
3
|
+
#include "protocol.h"
|
|
4
|
+
|
|
5
|
+
#include "base/compressed.h"
|
|
6
|
+
#include "base/socket.h"
|
|
7
|
+
#include "base/wire_format.h"
|
|
8
|
+
|
|
9
|
+
#include "columns/factory.h"
|
|
10
|
+
|
|
11
|
+
#include <assert.h>
|
|
12
|
+
#include <system_error>
|
|
13
|
+
#include <vector>
|
|
14
|
+
#include <sstream>
|
|
15
|
+
|
|
16
|
+
#if defined(WITH_OPENSSL)
|
|
17
|
+
#include "base/sslsocket.h"
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#define CLIENT_NAME "clickhouse-cpp"
|
|
21
|
+
|
|
22
|
+
#define DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES 50264
|
|
23
|
+
#define DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS 51554
|
|
24
|
+
#define DBMS_MIN_REVISION_WITH_BLOCK_INFO 51903
|
|
25
|
+
#define DBMS_MIN_REVISION_WITH_CLIENT_INFO 54032
|
|
26
|
+
#define DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE 54058
|
|
27
|
+
#define DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO 54060
|
|
28
|
+
//#define DBMS_MIN_REVISION_WITH_TABLES_STATUS 54226
|
|
29
|
+
#define DBMS_MIN_REVISION_WITH_TIME_ZONE_PARAMETER_IN_DATETIME_DATA_TYPE 54337
|
|
30
|
+
#define DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME 54372
|
|
31
|
+
#define DBMS_MIN_REVISION_WITH_VERSION_PATCH 54401
|
|
32
|
+
#define DBMS_MIN_REVISION_WITH_LOW_CARDINALITY_TYPE 54405
|
|
33
|
+
#define DBMS_MIN_REVISION_WITH_COLUMN_DEFAULTS_METADATA 54410
|
|
34
|
+
#define DBMS_MIN_REVISION_WITH_CLIENT_WRITE_INFO 54420
|
|
35
|
+
#define DBMS_MIN_REVISION_WITH_SETTINGS_SERIALIZED_AS_STRINGS 54429
|
|
36
|
+
#define DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET 54441
|
|
37
|
+
#define DBMS_MIN_REVISION_WITH_OPENTELEMETRY 54442
|
|
38
|
+
#define DBMS_MIN_REVISION_WITH_DISTRIBUTED_DEPTH 54448
|
|
39
|
+
#define DBMS_MIN_REVISION_WITH_INITIAL_QUERY_START_TIME 54449
|
|
40
|
+
#define DBMS_MIN_REVISION_WITH_INCREMENTAL_PROFILE_EVENTS 54451
|
|
41
|
+
#define DBMS_MIN_REVISION_WITH_PARALLEL_REPLICAS 54453
|
|
42
|
+
#define DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION 54454 // Client can get some fields in JSon format
|
|
43
|
+
#define DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM 54458 // send quota key after handshake
|
|
44
|
+
#define DBMS_MIN_PROTOCOL_REVISION_WITH_QUOTA_KEY 54458 // the same
|
|
45
|
+
#define DBMS_MIN_PROTOCOL_VERSION_WITH_PARAMETERS 54459
|
|
46
|
+
|
|
47
|
+
#define DMBS_PROTOCOL_REVISION DBMS_MIN_PROTOCOL_VERSION_WITH_PARAMETERS
|
|
48
|
+
|
|
49
|
+
namespace clickhouse {
|
|
50
|
+
|
|
51
|
+
struct ClientInfo {
|
|
52
|
+
uint8_t iface_type = 1; // TCP
|
|
53
|
+
uint8_t query_kind;
|
|
54
|
+
std::string initial_user;
|
|
55
|
+
std::string initial_query_id;
|
|
56
|
+
std::string quota_key;
|
|
57
|
+
std::string os_user;
|
|
58
|
+
std::string client_hostname;
|
|
59
|
+
std::string client_name;
|
|
60
|
+
std::string initial_address = "[::ffff:127.0.0.1]:0";
|
|
61
|
+
uint64_t client_version_major = 0;
|
|
62
|
+
uint64_t client_version_minor = 0;
|
|
63
|
+
uint64_t client_version_patch = 0;
|
|
64
|
+
uint32_t client_revision = 0;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
std::ostream& operator<<(std::ostream& os, const Endpoint& endpoint) {
|
|
68
|
+
return os << endpoint.host << ":" << endpoint.port;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) {
|
|
72
|
+
os << "Client("
|
|
73
|
+
<< " Endpoints : [";
|
|
74
|
+
size_t extra_endpoints = 0;
|
|
75
|
+
|
|
76
|
+
if (!opt.host.empty()) {
|
|
77
|
+
extra_endpoints = 1;
|
|
78
|
+
os << opt.user << '@' << Endpoint{opt.host, opt.port};
|
|
79
|
+
|
|
80
|
+
if (opt.endpoints.size())
|
|
81
|
+
os << ", ";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
for (size_t i = 0; i < opt.endpoints.size(); i++) {
|
|
85
|
+
os << opt.user << '@' << opt.endpoints[i]
|
|
86
|
+
<< ((i == opt.endpoints.size() - 1) ? "" : ", ");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
os << "] (" << opt.endpoints.size() + extra_endpoints << " items )"
|
|
90
|
+
<< " ping_before_query:" << opt.ping_before_query
|
|
91
|
+
<< " send_retries:" << opt.send_retries
|
|
92
|
+
<< " retry_timeout:" << opt.retry_timeout.count()
|
|
93
|
+
<< " compression_method:"
|
|
94
|
+
<< (opt.compression_method == CompressionMethod::LZ4 ? "LZ4"
|
|
95
|
+
: opt.compression_method == CompressionMethod::ZSTD ? "ZSTD"
|
|
96
|
+
: "None");
|
|
97
|
+
#if defined(WITH_OPENSSL)
|
|
98
|
+
if (opt.ssl_options) {
|
|
99
|
+
const auto & ssl_options = *opt.ssl_options;
|
|
100
|
+
os << " SSL ("
|
|
101
|
+
<< " ssl_context: " << (ssl_options.ssl_context ? "provided by user" : "created internally")
|
|
102
|
+
<< " use_default_ca_locations: " << ssl_options.use_default_ca_locations
|
|
103
|
+
<< " path_to_ca_files: " << ssl_options.path_to_ca_files.size() << " items"
|
|
104
|
+
<< " path_to_ca_directory: " << ssl_options.path_to_ca_directory
|
|
105
|
+
<< " min_protocol_version: " << ssl_options.min_protocol_version
|
|
106
|
+
<< " max_protocol_version: " << ssl_options.max_protocol_version
|
|
107
|
+
<< " context_options: " << ssl_options.context_options
|
|
108
|
+
<< ")";
|
|
109
|
+
}
|
|
110
|
+
#endif
|
|
111
|
+
os << ")";
|
|
112
|
+
return os;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
ClientOptions& ClientOptions::SetSSLOptions(ClientOptions::SSLOptions options)
|
|
116
|
+
{
|
|
117
|
+
#ifdef WITH_OPENSSL
|
|
118
|
+
ssl_options = options;
|
|
119
|
+
return *this;
|
|
120
|
+
#else
|
|
121
|
+
(void)options;
|
|
122
|
+
throw OpenSSLError("Library was built with no SSL support");
|
|
123
|
+
#endif
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
namespace {
|
|
127
|
+
|
|
128
|
+
std::unique_ptr<SocketFactory> GetSocketFactory(const ClientOptions& opts) {
|
|
129
|
+
(void)opts;
|
|
130
|
+
#if defined(WITH_OPENSSL)
|
|
131
|
+
if (opts.ssl_options)
|
|
132
|
+
return std::make_unique<SSLSocketFactory>(opts);
|
|
133
|
+
else
|
|
134
|
+
#endif
|
|
135
|
+
return std::make_unique<NonSecureSocketFactory>();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
std::unique_ptr<EndpointsIteratorBase> GetEndpointsIterator(const ClientOptions& opts) {
|
|
139
|
+
if (opts.endpoints.empty())
|
|
140
|
+
{
|
|
141
|
+
throw ValidationError("The list of endpoints is empty");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return std::make_unique<RoundRobinEndpointsIterator>(opts.endpoints);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
class Client::Impl {
|
|
150
|
+
public:
|
|
151
|
+
Impl(const ClientOptions& opts);
|
|
152
|
+
Impl(const ClientOptions& opts,
|
|
153
|
+
std::unique_ptr<SocketFactory> socket_factory);
|
|
154
|
+
~Impl();
|
|
155
|
+
|
|
156
|
+
void ExecuteQuery(Query query);
|
|
157
|
+
|
|
158
|
+
void SelectWithExternalData(Query query, const ExternalTables& external_tables);
|
|
159
|
+
|
|
160
|
+
void SendCancel();
|
|
161
|
+
|
|
162
|
+
void Insert(const std::string& table_name, const std::string& query_id, const Block& block);
|
|
163
|
+
|
|
164
|
+
Block BeginInsert(Query query);
|
|
165
|
+
|
|
166
|
+
void SendInsertBlock(const Block& block);
|
|
167
|
+
|
|
168
|
+
void EndInsert();
|
|
169
|
+
|
|
170
|
+
void Ping();
|
|
171
|
+
|
|
172
|
+
void ResetConnection();
|
|
173
|
+
|
|
174
|
+
void ResetConnectionEndpoint();
|
|
175
|
+
|
|
176
|
+
const ServerInfo& GetServerInfo() const;
|
|
177
|
+
|
|
178
|
+
const std::optional<Endpoint>& GetCurrentEndpoint() const;
|
|
179
|
+
|
|
180
|
+
private:
|
|
181
|
+
bool Handshake();
|
|
182
|
+
|
|
183
|
+
bool ReceivePacket(uint64_t* server_packet = nullptr);
|
|
184
|
+
|
|
185
|
+
void SendQuery(const Query& query, bool finalize = true);
|
|
186
|
+
void FinalizeQuery();
|
|
187
|
+
|
|
188
|
+
void SendData(const Block& block);
|
|
189
|
+
|
|
190
|
+
void SendBlockData(const Block& block);
|
|
191
|
+
void SendExternalData(const ExternalTables& external_tables);
|
|
192
|
+
|
|
193
|
+
bool SendHello();
|
|
194
|
+
|
|
195
|
+
bool ReadBlock(InputStream& input, Block* block);
|
|
196
|
+
|
|
197
|
+
bool ReceiveHello();
|
|
198
|
+
|
|
199
|
+
/// Reads data packet form input stream.
|
|
200
|
+
bool ReceiveData();
|
|
201
|
+
|
|
202
|
+
/// Reads exception packet form input stream.
|
|
203
|
+
bool ReceiveException(bool rethrow = false);
|
|
204
|
+
|
|
205
|
+
void WriteBlock(const Block& block, OutputStream& output);
|
|
206
|
+
|
|
207
|
+
void CreateConnection();
|
|
208
|
+
|
|
209
|
+
void InitializeStreams(std::unique_ptr<SocketBase>&& socket);
|
|
210
|
+
|
|
211
|
+
inline size_t GetConnectionAttempts() const
|
|
212
|
+
{
|
|
213
|
+
return options_.endpoints.size() * options_.send_retries;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private:
|
|
217
|
+
/// In case of network errors tries to reconnect to server and
|
|
218
|
+
/// call fuc several times.
|
|
219
|
+
void RetryGuard(std::function<void()> func);
|
|
220
|
+
|
|
221
|
+
void RetryConnectToTheEndpoint(std::function<void()>& func);
|
|
222
|
+
|
|
223
|
+
private:
|
|
224
|
+
class EnsureNull {
|
|
225
|
+
public:
|
|
226
|
+
inline EnsureNull(QueryEvents* ev, QueryEvents** ptr)
|
|
227
|
+
: ptr_(ptr)
|
|
228
|
+
{
|
|
229
|
+
if (ptr_) {
|
|
230
|
+
*ptr_ = ev;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
inline ~EnsureNull() {
|
|
235
|
+
if (ptr_) {
|
|
236
|
+
*ptr_ = nullptr;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private:
|
|
241
|
+
QueryEvents** ptr_;
|
|
242
|
+
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
const ClientOptions options_;
|
|
247
|
+
QueryEvents* events_;
|
|
248
|
+
int compression_ = CompressionState::Disable;
|
|
249
|
+
|
|
250
|
+
std::unique_ptr<SocketFactory> socket_factory_;
|
|
251
|
+
|
|
252
|
+
std::unique_ptr<InputStream> input_;
|
|
253
|
+
std::unique_ptr<OutputStream> output_;
|
|
254
|
+
std::unique_ptr<SocketBase> socket_;
|
|
255
|
+
std::unique_ptr<EndpointsIteratorBase> endpoints_iterator;
|
|
256
|
+
|
|
257
|
+
std::optional<Endpoint> current_endpoint_;
|
|
258
|
+
|
|
259
|
+
ServerInfo server_info_;
|
|
260
|
+
|
|
261
|
+
bool inserting_;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
ClientOptions modifyClientOptions(ClientOptions opts)
|
|
265
|
+
{
|
|
266
|
+
if (opts.host.empty())
|
|
267
|
+
return opts;
|
|
268
|
+
|
|
269
|
+
Endpoint default_endpoint({opts.host, opts.port});
|
|
270
|
+
opts.endpoints.emplace(opts.endpoints.begin(), default_endpoint);
|
|
271
|
+
return opts;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
Client::Impl::Impl(const ClientOptions& opts)
|
|
275
|
+
: Impl(opts, GetSocketFactory(opts)) {}
|
|
276
|
+
|
|
277
|
+
Client::Impl::Impl(const ClientOptions& opts,
|
|
278
|
+
std::unique_ptr<SocketFactory> socket_factory)
|
|
279
|
+
: options_(modifyClientOptions(opts))
|
|
280
|
+
, events_(nullptr)
|
|
281
|
+
, socket_factory_(std::move(socket_factory))
|
|
282
|
+
, endpoints_iterator(GetEndpointsIterator(options_))
|
|
283
|
+
{
|
|
284
|
+
CreateConnection();
|
|
285
|
+
|
|
286
|
+
if (options_.compression_method != CompressionMethod::None) {
|
|
287
|
+
compression_ = CompressionState::Enable;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
Client::Impl::~Impl() {
|
|
292
|
+
try {
|
|
293
|
+
EndInsert();
|
|
294
|
+
} catch (...) {
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
void Client::Impl::ExecuteQuery(Query query) {
|
|
299
|
+
if (inserting_) {
|
|
300
|
+
throw ValidationError("cannot execute query while inserting");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
EnsureNull en(static_cast<QueryEvents*>(&query), &events_);
|
|
304
|
+
|
|
305
|
+
if (options_.ping_before_query) {
|
|
306
|
+
RetryGuard([this]() { Ping(); });
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
SendQuery(query);
|
|
310
|
+
|
|
311
|
+
while (ReceivePacket()) {
|
|
312
|
+
;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
void Client::Impl::SelectWithExternalData(Query query, const ExternalTables& external_tables) {
|
|
318
|
+
if (inserting_) {
|
|
319
|
+
throw ValidationError("cannot execute query while inserting");
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (server_info_.revision < DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) {
|
|
323
|
+
throw UnimplementedError("This version of ClickHouse server doesn't support temporary tables");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
EnsureNull en(static_cast<QueryEvents*>(&query), &events_);
|
|
327
|
+
|
|
328
|
+
if (options_.ping_before_query) {
|
|
329
|
+
RetryGuard([this]() { Ping(); });
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
SendQuery(query, false);
|
|
333
|
+
SendExternalData(external_tables);
|
|
334
|
+
FinalizeQuery();
|
|
335
|
+
|
|
336
|
+
while (ReceivePacket()) {
|
|
337
|
+
;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
void Client::Impl::SendBlockData(const Block& block) {
|
|
342
|
+
if (compression_ == CompressionState::Enable) {
|
|
343
|
+
std::unique_ptr<OutputStream> compressed_output = std::make_unique<CompressedOutput>(output_.get(), options_.max_compression_chunk_size, options_.compression_method);
|
|
344
|
+
BufferedOutput buffered(std::move(compressed_output), options_.max_compression_chunk_size);
|
|
345
|
+
|
|
346
|
+
WriteBlock(block, buffered);
|
|
347
|
+
} else {
|
|
348
|
+
WriteBlock(block, *output_);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
void Client::Impl::SendExternalData(const ExternalTables& external_tables) {
|
|
353
|
+
for (const auto& table: external_tables) {
|
|
354
|
+
if (!table.data.GetRowCount()) {
|
|
355
|
+
// skip empty blocks to keep the connection in the consistent state as the current request would be marked as finished by such an empty block
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
WireFormat::WriteFixed<uint8_t>(*output_, ClientCodes::Data);
|
|
359
|
+
WireFormat::WriteString(*output_, table.name);
|
|
360
|
+
SendBlockData(table.data);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
std::string NameToQueryString(const std::string &input)
|
|
366
|
+
{
|
|
367
|
+
std::string output;
|
|
368
|
+
output.reserve(input.size() + 2);
|
|
369
|
+
output += '`';
|
|
370
|
+
|
|
371
|
+
for (const auto & c : input) {
|
|
372
|
+
if (c == '`') {
|
|
373
|
+
//escape ` with ``
|
|
374
|
+
output.append("``");
|
|
375
|
+
} else {
|
|
376
|
+
output.push_back(c);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
output += '`';
|
|
381
|
+
return output;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
void Client::Impl::Insert(const std::string& table_name, const std::string& query_id, const Block& block) {
|
|
385
|
+
if (inserting_) {
|
|
386
|
+
throw ValidationError("cannot execute query while inserting, use SendInsertData instead");
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (options_.ping_before_query) {
|
|
390
|
+
RetryGuard([this]() { Ping(); });
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
inserting_ = true;
|
|
394
|
+
|
|
395
|
+
std::stringstream fields_section;
|
|
396
|
+
const auto num_columns = block.GetColumnCount();
|
|
397
|
+
|
|
398
|
+
for (unsigned int i = 0; i < num_columns; ++i) {
|
|
399
|
+
if (i == num_columns - 1) {
|
|
400
|
+
fields_section << NameToQueryString(block.GetColumnName(i));
|
|
401
|
+
} else {
|
|
402
|
+
fields_section << NameToQueryString(block.GetColumnName(i)) << ",";
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
Query query("INSERT INTO " + table_name + " ( " + fields_section.str() + " ) VALUES", query_id);
|
|
407
|
+
SendQuery(query);
|
|
408
|
+
|
|
409
|
+
// Wait for a data packet and return
|
|
410
|
+
uint64_t server_packet = 0;
|
|
411
|
+
while (ReceivePacket(&server_packet)) {
|
|
412
|
+
if (server_packet == ServerCodes::Data) {
|
|
413
|
+
SendData(block);
|
|
414
|
+
EndInsert();
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
throw ProtocolError("fail to receive data packet");
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
Block Client::Impl::BeginInsert(Query query) {
|
|
423
|
+
if (inserting_) {
|
|
424
|
+
throw ValidationError("cannot execute query while inserting");
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
EnsureNull en(static_cast<QueryEvents*>(&query), &events_);
|
|
428
|
+
|
|
429
|
+
if (options_.ping_before_query) {
|
|
430
|
+
RetryGuard([this]() { Ping(); });
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
inserting_ = true;
|
|
434
|
+
|
|
435
|
+
// Create a callback to extract the block with the proper query columns.
|
|
436
|
+
Block block;
|
|
437
|
+
query.OnData([&block](const Block& b) {
|
|
438
|
+
block = std::move(b);
|
|
439
|
+
return true;
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
SendQuery(query.GetText());
|
|
443
|
+
|
|
444
|
+
// Wait for a data packet and return
|
|
445
|
+
uint64_t server_packet = 0;
|
|
446
|
+
while (ReceivePacket(&server_packet)) {
|
|
447
|
+
if (server_packet == ServerCodes::Data) {
|
|
448
|
+
return block;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
throw ProtocolError("fail to receive data packet");
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
void Client::Impl::SendInsertBlock(const Block& block) {
|
|
456
|
+
if (!inserting_) {
|
|
457
|
+
throw ValidationError("illegal call to InsertData without first calling BeginInsert");
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
SendData(block);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
void Client::Impl::EndInsert() {
|
|
464
|
+
if (!inserting_) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Send empty block as marker of end of data.
|
|
469
|
+
SendData(Block());
|
|
470
|
+
|
|
471
|
+
// Wait for EOS.
|
|
472
|
+
uint64_t eos_packet{0};
|
|
473
|
+
while (ReceivePacket(&eos_packet)) {
|
|
474
|
+
;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (eos_packet != ServerCodes::EndOfStream && eos_packet != ServerCodes::Exception
|
|
478
|
+
&& eos_packet != ServerCodes::Log && options_.rethrow_exceptions) {
|
|
479
|
+
throw ProtocolError(std::string{"unexpected packet from server while receiving end of query, expected (expected Exception, EndOfStream or Log, got: "}
|
|
480
|
+
+ (eos_packet ? std::to_string(eos_packet) : "nothing") + ")");
|
|
481
|
+
}
|
|
482
|
+
inserting_ = false;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
void Client::Impl::Ping() {
|
|
486
|
+
if (inserting_) {
|
|
487
|
+
throw ValidationError("cannot execute query while inserting");
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
WireFormat::WriteUInt64(*output_, ClientCodes::Ping);
|
|
491
|
+
output_->Flush();
|
|
492
|
+
|
|
493
|
+
uint64_t server_packet;
|
|
494
|
+
const bool ret = ReceivePacket(&server_packet);
|
|
495
|
+
|
|
496
|
+
if (!ret || server_packet != ServerCodes::Pong) {
|
|
497
|
+
throw ProtocolError("fail to ping server");
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
void Client::Impl::ResetConnection() {
|
|
502
|
+
InitializeStreams(socket_factory_->connect(options_, current_endpoint_.value()));
|
|
503
|
+
inserting_ = false;
|
|
504
|
+
|
|
505
|
+
if (!Handshake()) {
|
|
506
|
+
throw ProtocolError("fail to connect to " + options_.host);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
void Client::Impl::ResetConnectionEndpoint() {
|
|
511
|
+
current_endpoint_.reset();
|
|
512
|
+
for (size_t i = 0; i < options_.endpoints.size();)
|
|
513
|
+
{
|
|
514
|
+
try
|
|
515
|
+
{
|
|
516
|
+
current_endpoint_ = endpoints_iterator->Next();
|
|
517
|
+
ResetConnection();
|
|
518
|
+
return;
|
|
519
|
+
} catch (const std::system_error&) {
|
|
520
|
+
if (++i == options_.endpoints.size())
|
|
521
|
+
{
|
|
522
|
+
current_endpoint_.reset();
|
|
523
|
+
throw;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
void Client::Impl::CreateConnection() {
|
|
530
|
+
// make sure to try to connect to each endpoint at least once even if `options_.send_retries` is 0
|
|
531
|
+
const size_t max_attempts = (options_.send_retries ? options_.send_retries : 1);
|
|
532
|
+
for (size_t i = 0; i < max_attempts;)
|
|
533
|
+
{
|
|
534
|
+
try
|
|
535
|
+
{
|
|
536
|
+
// Try to connect to each endpoint before throwing exception.
|
|
537
|
+
ResetConnectionEndpoint();
|
|
538
|
+
return;
|
|
539
|
+
} catch (const std::system_error&) {
|
|
540
|
+
if (++i >= max_attempts)
|
|
541
|
+
{
|
|
542
|
+
throw;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const ServerInfo& Client::Impl::GetServerInfo() const {
|
|
549
|
+
return server_info_;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
const std::optional<Endpoint>& Client::Impl::GetCurrentEndpoint() const {
|
|
554
|
+
return current_endpoint_;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
bool Client::Impl::Handshake() {
|
|
558
|
+
if (!SendHello()) {
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
if (!ReceiveHello()) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (server_info_.revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM) {
|
|
566
|
+
WireFormat::WriteString(*output_, std::string());
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
bool Client::Impl::ReceivePacket(uint64_t* server_packet) {
|
|
573
|
+
uint64_t packet_type = 0;
|
|
574
|
+
|
|
575
|
+
if (!WireFormat::ReadVarint64(*input_, &packet_type)) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
if (server_packet) {
|
|
579
|
+
*server_packet = packet_type;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
switch (packet_type) {
|
|
583
|
+
case ServerCodes::Data: {
|
|
584
|
+
if (!ReceiveData()) {
|
|
585
|
+
throw ProtocolError("can't read data packet from input stream");
|
|
586
|
+
}
|
|
587
|
+
return true;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
case ServerCodes::Exception: {
|
|
591
|
+
ReceiveException();
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
case ServerCodes::ProfileInfo: {
|
|
596
|
+
Profile profile;
|
|
597
|
+
|
|
598
|
+
if (!WireFormat::ReadUInt64(*input_, &profile.rows)) {
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
if (!WireFormat::ReadUInt64(*input_, &profile.blocks)) {
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
if (!WireFormat::ReadUInt64(*input_, &profile.bytes)) {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
if (!WireFormat::ReadFixed(*input_, &profile.applied_limit)) {
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
if (!WireFormat::ReadUInt64(*input_, &profile.rows_before_limit)) {
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
if (!WireFormat::ReadFixed(*input_, &profile.calculated_rows_before_limit)) {
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (events_) {
|
|
618
|
+
events_->OnProfile(profile);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
case ServerCodes::Progress: {
|
|
625
|
+
Progress info;
|
|
626
|
+
|
|
627
|
+
if (!WireFormat::ReadUInt64(*input_, &info.rows)) {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
if (!WireFormat::ReadUInt64(*input_, &info.bytes)) {
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
if constexpr(DMBS_PROTOCOL_REVISION >= DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS) {
|
|
634
|
+
if (!WireFormat::ReadUInt64(*input_, &info.total_rows)) {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_CLIENT_WRITE_INFO)
|
|
639
|
+
{
|
|
640
|
+
if (!WireFormat::ReadUInt64(*input_, &info.written_rows)) {
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
643
|
+
if (!WireFormat::ReadUInt64(*input_, &info.written_bytes)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (events_) {
|
|
649
|
+
events_->OnProgress(info);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
case ServerCodes::Pong: {
|
|
656
|
+
return true;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
case ServerCodes::Hello: {
|
|
660
|
+
return true;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
case ServerCodes::EndOfStream: {
|
|
664
|
+
if (events_) {
|
|
665
|
+
events_->OnFinish();
|
|
666
|
+
}
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
case ServerCodes::Log: {
|
|
671
|
+
// log tag
|
|
672
|
+
if (!WireFormat::SkipString(*input_)) {
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
Block block;
|
|
676
|
+
|
|
677
|
+
// Use uncompressed stream since log blocks usually contain only one row
|
|
678
|
+
if (!ReadBlock(*input_, &block)) {
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (events_) {
|
|
683
|
+
events_->OnServerLog(block);
|
|
684
|
+
}
|
|
685
|
+
return true;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
case ServerCodes::TableColumns: {
|
|
689
|
+
// external table name
|
|
690
|
+
if (!WireFormat::SkipString(*input_)) {
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// columns metadata
|
|
695
|
+
if (!WireFormat::SkipString(*input_)) {
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
return true;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
case ServerCodes::ProfileEvents: {
|
|
702
|
+
if (!WireFormat::SkipString(*input_)) {
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
Block block;
|
|
707
|
+
if (!ReadBlock(*input_, &block)) {
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
if (events_) {
|
|
712
|
+
events_->OnProfileEvents(block);
|
|
713
|
+
}
|
|
714
|
+
return true;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
default:
|
|
718
|
+
throw UnimplementedError("unimplemented " + std::to_string((int)packet_type));
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
bool Client::Impl::ReadBlock(InputStream& input, Block* block) {
|
|
724
|
+
// Additional information about block.
|
|
725
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_BLOCK_INFO) {
|
|
726
|
+
uint64_t num;
|
|
727
|
+
BlockInfo info;
|
|
728
|
+
|
|
729
|
+
// BlockInfo
|
|
730
|
+
if (!WireFormat::ReadUInt64(input, &num)) {
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
if (!WireFormat::ReadFixed(input, &info.is_overflows)) {
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
if (!WireFormat::ReadUInt64(input, &num)) {
|
|
737
|
+
return false;
|
|
738
|
+
}
|
|
739
|
+
if (!WireFormat::ReadFixed(input, &info.bucket_num)) {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
if (!WireFormat::ReadUInt64(input, &num)) {
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
block->SetInfo(std::move(info));
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
uint64_t num_columns = 0;
|
|
750
|
+
uint64_t num_rows = 0;
|
|
751
|
+
|
|
752
|
+
if (!WireFormat::ReadUInt64(input, &num_columns)) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
if (!WireFormat::ReadUInt64(input, &num_rows)) {
|
|
756
|
+
return false;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
CreateColumnByTypeSettings create_column_settings;
|
|
760
|
+
create_column_settings.low_cardinality_as_wrapped_column = options_.backward_compatibility_lowcardinality_as_wrapped_column;
|
|
761
|
+
|
|
762
|
+
for (size_t i = 0; i < num_columns; ++i) {
|
|
763
|
+
std::string name;
|
|
764
|
+
std::string type;
|
|
765
|
+
if (!WireFormat::ReadString(input, &name)) {
|
|
766
|
+
return false;
|
|
767
|
+
}
|
|
768
|
+
if (!WireFormat::ReadString(input, &type)) {
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION) {
|
|
773
|
+
uint8_t custom_format_len;
|
|
774
|
+
if (!WireFormat::ReadFixed(input, &custom_format_len)) {
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
777
|
+
if (custom_format_len > 0) {
|
|
778
|
+
throw UnimplementedError(std::string("unsupported custom serialization"));
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
if (ColumnRef col = CreateColumnByType(type, create_column_settings)) {
|
|
783
|
+
if (num_rows && !col->Load(&input, num_rows)) {
|
|
784
|
+
throw ProtocolError("can't load column '" + name + "' of type " + type);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
block->AppendColumn(name, col);
|
|
788
|
+
} else {
|
|
789
|
+
throw UnimplementedError(std::string("unsupported column type: ") + type);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return true;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
bool Client::Impl::ReceiveData() {
|
|
797
|
+
Block block;
|
|
798
|
+
|
|
799
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) {
|
|
800
|
+
if (!WireFormat::SkipString(*input_)) {
|
|
801
|
+
return false;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
if (compression_ == CompressionState::Enable) {
|
|
806
|
+
CompressedInput compressed(input_.get());
|
|
807
|
+
if (!ReadBlock(compressed, &block)) {
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
} else {
|
|
811
|
+
if (!ReadBlock(*input_, &block)) {
|
|
812
|
+
return false;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
if (events_) {
|
|
817
|
+
events_->OnData(block);
|
|
818
|
+
if (!events_->OnDataCancelable(block)) {
|
|
819
|
+
SendCancel();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
bool Client::Impl::ReceiveException(bool rethrow) {
|
|
827
|
+
std::shared_ptr<Exception> e(new Exception);
|
|
828
|
+
Exception* current = e.get();
|
|
829
|
+
|
|
830
|
+
bool exception_received = true;
|
|
831
|
+
do {
|
|
832
|
+
bool has_nested = false;
|
|
833
|
+
|
|
834
|
+
if (!WireFormat::ReadFixed(*input_, ¤t->code)) {
|
|
835
|
+
exception_received = false;
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
if (!WireFormat::ReadString(*input_, ¤t->name)) {
|
|
839
|
+
exception_received = false;
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
if (!WireFormat::ReadString(*input_, ¤t->display_text)) {
|
|
843
|
+
exception_received = false;
|
|
844
|
+
break;
|
|
845
|
+
}
|
|
846
|
+
if (!WireFormat::ReadString(*input_, ¤t->stack_trace)) {
|
|
847
|
+
exception_received = false;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
if (!WireFormat::ReadFixed(*input_, &has_nested)) {
|
|
851
|
+
exception_received = false;
|
|
852
|
+
break;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
if (has_nested) {
|
|
856
|
+
current->nested.reset(new Exception);
|
|
857
|
+
current = current->nested.get();
|
|
858
|
+
} else {
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
861
|
+
} while (true);
|
|
862
|
+
|
|
863
|
+
if (events_) {
|
|
864
|
+
events_->OnServerException(*e);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
if (rethrow || options_.rethrow_exceptions) {
|
|
868
|
+
throw ServerError(e);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
return exception_received;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
void Client::Impl::SendCancel() {
|
|
875
|
+
WireFormat::WriteUInt64(*output_, ClientCodes::Cancel);
|
|
876
|
+
output_->Flush();
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
void Client::Impl::SendQuery(const Query& query, bool finalize) {
|
|
880
|
+
WireFormat::WriteUInt64(*output_, ClientCodes::Query);
|
|
881
|
+
WireFormat::WriteString(*output_, query.GetQueryID());
|
|
882
|
+
|
|
883
|
+
/// Client info.
|
|
884
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_CLIENT_INFO) {
|
|
885
|
+
ClientInfo info;
|
|
886
|
+
|
|
887
|
+
info.query_kind = 1;
|
|
888
|
+
info.client_name = CLIENT_NAME;
|
|
889
|
+
info.client_version_major = CLICKHOUSE_CPP_VERSION_MAJOR;
|
|
890
|
+
info.client_version_minor = CLICKHOUSE_CPP_VERSION_MINOR;
|
|
891
|
+
info.client_version_patch = CLICKHOUSE_CPP_VERSION_PATCH;
|
|
892
|
+
info.client_revision = DMBS_PROTOCOL_REVISION;
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
WireFormat::WriteFixed(*output_, info.query_kind);
|
|
896
|
+
WireFormat::WriteString(*output_, info.initial_user);
|
|
897
|
+
WireFormat::WriteString(*output_, info.initial_query_id);
|
|
898
|
+
WireFormat::WriteString(*output_, info.initial_address);
|
|
899
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_INITIAL_QUERY_START_TIME) {
|
|
900
|
+
WireFormat::WriteFixed<int64_t>(*output_, 0);
|
|
901
|
+
}
|
|
902
|
+
WireFormat::WriteFixed(*output_, info.iface_type);
|
|
903
|
+
|
|
904
|
+
WireFormat::WriteString(*output_, info.os_user);
|
|
905
|
+
WireFormat::WriteString(*output_, info.client_hostname);
|
|
906
|
+
WireFormat::WriteString(*output_, info.client_name);
|
|
907
|
+
WireFormat::WriteUInt64(*output_, info.client_version_major);
|
|
908
|
+
WireFormat::WriteUInt64(*output_, info.client_version_minor);
|
|
909
|
+
WireFormat::WriteUInt64(*output_, info.client_revision);
|
|
910
|
+
|
|
911
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO)
|
|
912
|
+
WireFormat::WriteString(*output_, info.quota_key);
|
|
913
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_DISTRIBUTED_DEPTH)
|
|
914
|
+
WireFormat::WriteUInt64(*output_, 0u);
|
|
915
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_VERSION_PATCH) {
|
|
916
|
+
WireFormat::WriteUInt64(*output_, info.client_version_patch);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_OPENTELEMETRY) {
|
|
920
|
+
if (const auto& tracing_context = query.GetTracingContext()) {
|
|
921
|
+
// Have OpenTelemetry header.
|
|
922
|
+
WireFormat::WriteFixed(*output_, uint8_t(1));
|
|
923
|
+
// No point writing these numbers with variable length, because they
|
|
924
|
+
// are random and will probably require the full length anyway.
|
|
925
|
+
WireFormat::WriteFixed(*output_, tracing_context->trace_id);
|
|
926
|
+
WireFormat::WriteFixed(*output_, tracing_context->span_id);
|
|
927
|
+
WireFormat::WriteString(*output_, tracing_context->tracestate);
|
|
928
|
+
WireFormat::WriteFixed(*output_, tracing_context->trace_flags);
|
|
929
|
+
} else {
|
|
930
|
+
// Don't have OpenTelemetry header.
|
|
931
|
+
WireFormat::WriteFixed(*output_, uint8_t(0));
|
|
932
|
+
}
|
|
933
|
+
} else {
|
|
934
|
+
if (query.GetTracingContext()) {
|
|
935
|
+
// Current implementation works only for server version >= v20.11.2.1-stable
|
|
936
|
+
throw UnimplementedError(std::string("Can't send open telemetry tracing context to a server, server version is too old"));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_PARALLEL_REPLICAS) {
|
|
940
|
+
// replica dont supported by client
|
|
941
|
+
WireFormat::WriteUInt64(*output_, 0);
|
|
942
|
+
WireFormat::WriteUInt64(*output_, 0);
|
|
943
|
+
WireFormat::WriteUInt64(*output_, 0);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/// Per query settings
|
|
948
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_SETTINGS_SERIALIZED_AS_STRINGS) {
|
|
949
|
+
for(const auto& [name, field] : query.GetQuerySettings()) {
|
|
950
|
+
WireFormat::WriteString(*output_, name);
|
|
951
|
+
WireFormat::WriteVarint64(*output_, field.flags);
|
|
952
|
+
WireFormat::WriteString(*output_, field.value);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
else if (query.GetQuerySettings().size() > 0) {
|
|
956
|
+
// Current implementation works only for server version >= v20.1.2.4-stable, since we do not implement binary settings serialization.
|
|
957
|
+
throw UnimplementedError(std::string("Can't send query settings to a server, server version is too old"));
|
|
958
|
+
}
|
|
959
|
+
// Empty string signals end of serialized settings
|
|
960
|
+
WireFormat::WriteString(*output_, std::string());
|
|
961
|
+
|
|
962
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET) {
|
|
963
|
+
WireFormat::WriteString(*output_, "");
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
WireFormat::WriteUInt64(*output_, Stages::Complete);
|
|
967
|
+
WireFormat::WriteUInt64(*output_, compression_);
|
|
968
|
+
WireFormat::WriteString(*output_, query.GetText());
|
|
969
|
+
|
|
970
|
+
//Send params after query text
|
|
971
|
+
if (server_info_.revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_PARAMETERS) {
|
|
972
|
+
for(const auto& [name, value] : query.GetParams()) {
|
|
973
|
+
// params is like query settings
|
|
974
|
+
WireFormat::WriteString(*output_, name);
|
|
975
|
+
const uint64_t Custom = 2;
|
|
976
|
+
WireFormat::WriteVarint64(*output_, Custom);
|
|
977
|
+
if (value)
|
|
978
|
+
WireFormat::WriteQuotedString(*output_, *value);
|
|
979
|
+
else
|
|
980
|
+
WireFormat::WriteParamNullRepresentation(*output_);
|
|
981
|
+
}
|
|
982
|
+
WireFormat::WriteString(*output_, std::string()); // empty string after last param
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (finalize) {
|
|
986
|
+
FinalizeQuery();
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
void Client::Impl::FinalizeQuery() {
|
|
991
|
+
// Send empty block as marker of
|
|
992
|
+
// end of data
|
|
993
|
+
SendData(Block());
|
|
994
|
+
|
|
995
|
+
output_->Flush();
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
void Client::Impl::WriteBlock(const Block& block, OutputStream& output) {
|
|
999
|
+
// Additional information about block.
|
|
1000
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_BLOCK_INFO) {
|
|
1001
|
+
WireFormat::WriteUInt64(output, 1);
|
|
1002
|
+
WireFormat::WriteFixed<uint8_t>(output, block.Info().is_overflows);
|
|
1003
|
+
WireFormat::WriteUInt64(output, 2);
|
|
1004
|
+
WireFormat::WriteFixed<int32_t>(output, block.Info().bucket_num);
|
|
1005
|
+
WireFormat::WriteUInt64(output, 0);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
WireFormat::WriteUInt64(output, block.GetColumnCount());
|
|
1009
|
+
WireFormat::WriteUInt64(output, block.GetRowCount());
|
|
1010
|
+
|
|
1011
|
+
for (Block::Iterator bi(block); bi.IsValid(); bi.Next()) {
|
|
1012
|
+
WireFormat::WriteString(output, bi.Name());
|
|
1013
|
+
WireFormat::WriteString(output, bi.Type()->GetName());
|
|
1014
|
+
|
|
1015
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION) {
|
|
1016
|
+
// TODO: custom serialization
|
|
1017
|
+
WireFormat::WriteFixed<uint8_t>(output, 0);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// Empty columns are not serialized and occupy exactly 0 bytes.
|
|
1021
|
+
// ref https://github.com/ClickHouse/ClickHouse/blob/39b37a3240f74f4871c8c1679910e065af6bea19/src/Formats/NativeWriter.cpp#L163
|
|
1022
|
+
const bool containsData = block.GetRowCount() > 0;
|
|
1023
|
+
if (containsData) {
|
|
1024
|
+
bi.Column()->Save(&output);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
output.Flush();
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
void Client::Impl::SendData(const Block& block) {
|
|
1031
|
+
WireFormat::WriteUInt64(*output_, ClientCodes::Data);
|
|
1032
|
+
|
|
1033
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) {
|
|
1034
|
+
WireFormat::WriteString(*output_, std::string());
|
|
1035
|
+
}
|
|
1036
|
+
SendBlockData(block);
|
|
1037
|
+
|
|
1038
|
+
output_->Flush();
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
void Client::Impl::InitializeStreams(std::unique_ptr<SocketBase>&& socket) {
|
|
1042
|
+
std::unique_ptr<OutputStream> output = std::make_unique<BufferedOutput>(socket->makeOutputStream());
|
|
1043
|
+
std::unique_ptr<InputStream> input = std::make_unique<BufferedInput>(socket->makeInputStream());
|
|
1044
|
+
|
|
1045
|
+
std::swap(input, input_);
|
|
1046
|
+
std::swap(output, output_);
|
|
1047
|
+
std::swap(socket, socket_);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
bool Client::Impl::SendHello() {
|
|
1051
|
+
WireFormat::WriteUInt64(*output_, ClientCodes::Hello);
|
|
1052
|
+
WireFormat::WriteString(*output_, std::string(CLIENT_NAME));
|
|
1053
|
+
WireFormat::WriteUInt64(*output_, CLICKHOUSE_CPP_VERSION_MAJOR);
|
|
1054
|
+
WireFormat::WriteUInt64(*output_, CLICKHOUSE_CPP_VERSION_MINOR);
|
|
1055
|
+
WireFormat::WriteUInt64(*output_, DMBS_PROTOCOL_REVISION);
|
|
1056
|
+
WireFormat::WriteString(*output_, options_.default_database);
|
|
1057
|
+
WireFormat::WriteString(*output_, options_.user);
|
|
1058
|
+
WireFormat::WriteString(*output_, options_.password);
|
|
1059
|
+
|
|
1060
|
+
output_->Flush();
|
|
1061
|
+
|
|
1062
|
+
return true;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
bool Client::Impl::ReceiveHello() {
|
|
1066
|
+
uint64_t packet_type = 0;
|
|
1067
|
+
|
|
1068
|
+
if (!WireFormat::ReadVarint64(*input_, &packet_type)) {
|
|
1069
|
+
return false;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
if (packet_type == ServerCodes::Hello) {
|
|
1073
|
+
if (!WireFormat::ReadString(*input_, &server_info_.name)) {
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
if (!WireFormat::ReadUInt64(*input_, &server_info_.version_major)) {
|
|
1077
|
+
return false;
|
|
1078
|
+
}
|
|
1079
|
+
if (!WireFormat::ReadUInt64(*input_, &server_info_.version_minor)) {
|
|
1080
|
+
return false;
|
|
1081
|
+
}
|
|
1082
|
+
if (!WireFormat::ReadUInt64(*input_, &server_info_.revision)) {
|
|
1083
|
+
return false;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE) {
|
|
1087
|
+
if (!WireFormat::ReadString(*input_, &server_info_.timezone)) {
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME) {
|
|
1093
|
+
if (!WireFormat::ReadString(*input_, &server_info_.display_name)) {
|
|
1094
|
+
return false;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
if (server_info_.revision >= DBMS_MIN_REVISION_WITH_VERSION_PATCH) {
|
|
1099
|
+
if (!WireFormat::ReadUInt64(*input_, &server_info_.version_patch)) {
|
|
1100
|
+
return false;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
return true;
|
|
1105
|
+
} else if (packet_type == ServerCodes::Exception) {
|
|
1106
|
+
ReceiveException(true);
|
|
1107
|
+
return false;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
return false;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
void Client::Impl::RetryGuard(std::function<void()> func) {
|
|
1114
|
+
|
|
1115
|
+
if (current_endpoint_)
|
|
1116
|
+
{
|
|
1117
|
+
for (unsigned int i = 0; ; ++i) {
|
|
1118
|
+
try {
|
|
1119
|
+
func();
|
|
1120
|
+
return;
|
|
1121
|
+
} catch (const std::system_error&) {
|
|
1122
|
+
bool ok = true;
|
|
1123
|
+
|
|
1124
|
+
try {
|
|
1125
|
+
socket_factory_->sleepFor(options_.retry_timeout);
|
|
1126
|
+
ResetConnection();
|
|
1127
|
+
} catch (...) {
|
|
1128
|
+
ok = false;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
if (!ok && i == options_.send_retries) {
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
// Connections with current_endpoint_ are broken.
|
|
1138
|
+
// Trying to establish with the another one from the list.
|
|
1139
|
+
size_t connection_attempts_count = GetConnectionAttempts();
|
|
1140
|
+
for (size_t i = 0; i < connection_attempts_count;)
|
|
1141
|
+
{
|
|
1142
|
+
try
|
|
1143
|
+
{
|
|
1144
|
+
socket_factory_->sleepFor(options_.retry_timeout);
|
|
1145
|
+
current_endpoint_ = endpoints_iterator->Next();
|
|
1146
|
+
ResetConnection();
|
|
1147
|
+
func();
|
|
1148
|
+
return;
|
|
1149
|
+
} catch (const std::system_error&) {
|
|
1150
|
+
if (++i == connection_attempts_count)
|
|
1151
|
+
{
|
|
1152
|
+
current_endpoint_.reset();
|
|
1153
|
+
throw;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
Client::Client(const ClientOptions& opts)
|
|
1160
|
+
: options_(opts)
|
|
1161
|
+
, impl_(new Impl(opts))
|
|
1162
|
+
{
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
Client::Client(const ClientOptions& opts,
|
|
1166
|
+
std::unique_ptr<SocketFactory> socket_factory)
|
|
1167
|
+
: options_(opts)
|
|
1168
|
+
, impl_(new Impl(opts, std::move(socket_factory)))
|
|
1169
|
+
{
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
Client::~Client()
|
|
1173
|
+
{ }
|
|
1174
|
+
|
|
1175
|
+
void Client::Execute(const Query& query) {
|
|
1176
|
+
impl_->ExecuteQuery(query);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
void Client::Select(const std::string& query, SelectCallback cb) {
|
|
1180
|
+
Execute(Query(query).OnData(std::move(cb)));
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
void Client::Select(const std::string& query, const std::string& query_id, SelectCallback cb) {
|
|
1184
|
+
Execute(Query(query, query_id).OnData(std::move(cb)));
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
void Client::SelectCancelable(const std::string& query, SelectCancelableCallback cb) {
|
|
1188
|
+
Execute(Query(query).OnDataCancelable(std::move(cb)));
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
void Client::SelectCancelable(const std::string& query, const std::string& query_id, SelectCancelableCallback cb) {
|
|
1192
|
+
Execute(Query(query, query_id).OnDataCancelable(std::move(cb)));
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
void Client::Select(const Query& query) {
|
|
1196
|
+
Execute(query);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
void Client::SelectWithExternalData(const std::string& query, const ExternalTables& external_tables, SelectCallback cb) {
|
|
1200
|
+
impl_->SelectWithExternalData(Query(query).OnData(std::move(cb)), external_tables);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
void Client::SelectWithExternalData(const std::string& query, const std::string& query_id, const ExternalTables& external_tables, SelectCallback cb) {
|
|
1204
|
+
impl_->SelectWithExternalData(Query(query, query_id).OnData(std::move(cb)), external_tables);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
void Client::SelectWithExternalDataCancelable(const std::string& query, const ExternalTables& external_tables, SelectCancelableCallback cb) {
|
|
1208
|
+
impl_->SelectWithExternalData(Query(query).OnDataCancelable(std::move(cb)), external_tables);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
void Client::SelectWithExternalDataCancelable(const std::string& query, const std::string& query_id, const ExternalTables& external_tables, SelectCancelableCallback cb) {
|
|
1212
|
+
impl_->SelectWithExternalData(Query(query, query_id).OnDataCancelable(std::move(cb)), external_tables);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
void Client::Insert(const std::string& table_name, const Block& block) {
|
|
1216
|
+
impl_->Insert(table_name, Query::default_query_id, block);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
void Client::Insert(const std::string& table_name, const std::string& query_id, const Block& block) {
|
|
1220
|
+
impl_->Insert(table_name, query_id, block);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
Block Client::BeginInsert(const std::string& query) {
|
|
1224
|
+
return impl_->BeginInsert(Query(query));
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
Block Client::BeginInsert(const std::string& query, const std::string& query_id) {
|
|
1228
|
+
return impl_->BeginInsert(Query(query, query_id));
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
void Client::SendInsertBlock(const Block& block) {
|
|
1232
|
+
impl_->SendInsertBlock(block);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
void Client::EndInsert() {
|
|
1236
|
+
impl_->EndInsert();
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
void Client::Ping() {
|
|
1240
|
+
impl_->Ping();
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
void Client::ResetConnection() {
|
|
1244
|
+
impl_->ResetConnection();
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
void Client::ResetConnectionEndpoint() {
|
|
1248
|
+
impl_->ResetConnectionEndpoint();
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
const std::optional<Endpoint>& Client::GetCurrentEndpoint() const {
|
|
1252
|
+
return impl_->GetCurrentEndpoint();
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
const ServerInfo& Client::GetServerInfo() const {
|
|
1256
|
+
return impl_->GetServerInfo();
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
Client::Version Client::GetVersion() {
|
|
1260
|
+
return Version {
|
|
1261
|
+
CLICKHOUSE_CPP_VERSION_MAJOR,
|
|
1262
|
+
CLICKHOUSE_CPP_VERSION_MINOR,
|
|
1263
|
+
CLICKHOUSE_CPP_VERSION_PATCH,
|
|
1264
|
+
CLICKHOUSE_CPP_VERSION_BUILD,
|
|
1265
|
+
""
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
}
|