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,320 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "query.h"
|
|
4
|
+
#include "exceptions.h"
|
|
5
|
+
|
|
6
|
+
#include "columns/array.h"
|
|
7
|
+
#include "columns/date.h"
|
|
8
|
+
#include "columns/decimal.h"
|
|
9
|
+
#include "columns/enum.h"
|
|
10
|
+
#include "columns/geo.h"
|
|
11
|
+
#include "columns/ip4.h"
|
|
12
|
+
#include "columns/ip6.h"
|
|
13
|
+
#include "columns/lowcardinality.h"
|
|
14
|
+
#include "columns/nothing.h"
|
|
15
|
+
#include "columns/nullable.h"
|
|
16
|
+
#include "columns/numeric.h"
|
|
17
|
+
#include "columns/map.h"
|
|
18
|
+
#include "columns/string.h"
|
|
19
|
+
#include "columns/tuple.h"
|
|
20
|
+
#include "columns/time.h"
|
|
21
|
+
#include "columns/uuid.h"
|
|
22
|
+
|
|
23
|
+
#include <chrono>
|
|
24
|
+
#include <cstdint>
|
|
25
|
+
#include <memory>
|
|
26
|
+
#include <ostream>
|
|
27
|
+
#include <string>
|
|
28
|
+
#include <optional>
|
|
29
|
+
|
|
30
|
+
typedef struct ssl_ctx_st SSL_CTX;
|
|
31
|
+
|
|
32
|
+
namespace clickhouse {
|
|
33
|
+
|
|
34
|
+
struct ServerInfo {
|
|
35
|
+
std::string name;
|
|
36
|
+
std::string timezone;
|
|
37
|
+
std::string display_name;
|
|
38
|
+
uint64_t version_major;
|
|
39
|
+
uint64_t version_minor;
|
|
40
|
+
uint64_t version_patch;
|
|
41
|
+
uint64_t revision;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/// Methods of block compression.
|
|
45
|
+
enum class CompressionMethod : int8_t {
|
|
46
|
+
None = -1,
|
|
47
|
+
LZ4 = 1,
|
|
48
|
+
ZSTD = 2,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
struct Endpoint {
|
|
52
|
+
std::string host;
|
|
53
|
+
uint16_t port = 9000;
|
|
54
|
+
inline bool operator==(const Endpoint& right) const {
|
|
55
|
+
return host == right.host && port == right.port;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
enum class EndpointsIterationAlgorithm {
|
|
60
|
+
RoundRobin = 0,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
struct ClientOptions {
|
|
64
|
+
// Setter goes first, so it is possible to apply 'deprecated' annotation safely.
|
|
65
|
+
#define DECLARE_FIELD(name, type, setter, default_value) \
|
|
66
|
+
inline auto & setter(const type& value) { \
|
|
67
|
+
name = value; \
|
|
68
|
+
return *this; \
|
|
69
|
+
} \
|
|
70
|
+
type name = default_value
|
|
71
|
+
|
|
72
|
+
/// Hostname of the server.
|
|
73
|
+
DECLARE_FIELD(host, std::string, SetHost, std::string());
|
|
74
|
+
/// Service port.
|
|
75
|
+
DECLARE_FIELD(port, uint16_t, SetPort, 9000);
|
|
76
|
+
|
|
77
|
+
/** Set endpoints (host+port), only one is used.
|
|
78
|
+
* Client tries to connect to those endpoints one by one, on the round-robin basis:
|
|
79
|
+
* first default enpoint (set via SetHost() + SetPort()), then each of endpoints, from begin() to end(),
|
|
80
|
+
* the first one to establish connection is used for the rest of the session.
|
|
81
|
+
* If port isn't specified, default(9000) value will be used.
|
|
82
|
+
*/
|
|
83
|
+
DECLARE_FIELD(endpoints, std::vector<Endpoint>, SetEndpoints, {});
|
|
84
|
+
|
|
85
|
+
/// Default database.
|
|
86
|
+
DECLARE_FIELD(default_database, std::string, SetDefaultDatabase, "default");
|
|
87
|
+
/// User name.
|
|
88
|
+
DECLARE_FIELD(user, std::string, SetUser, "default");
|
|
89
|
+
/// Access password.
|
|
90
|
+
DECLARE_FIELD(password, std::string, SetPassword, std::string());
|
|
91
|
+
|
|
92
|
+
/// By default all exceptions received during query execution will be
|
|
93
|
+
/// passed to OnException handler. Set rethrow_exceptions to true to
|
|
94
|
+
/// enable throwing exceptions with standard c++ exception mechanism.
|
|
95
|
+
DECLARE_FIELD(rethrow_exceptions, bool, SetRethrowException, true);
|
|
96
|
+
|
|
97
|
+
/// Ping server every time before execute any query.
|
|
98
|
+
DECLARE_FIELD(ping_before_query, bool, SetPingBeforeQuery, false);
|
|
99
|
+
/// Count of retry to send request to server.
|
|
100
|
+
DECLARE_FIELD(send_retries, unsigned int, SetSendRetries, 1);
|
|
101
|
+
/// Amount of time to wait before next retry.
|
|
102
|
+
DECLARE_FIELD(retry_timeout, std::chrono::seconds, SetRetryTimeout, std::chrono::seconds(5));
|
|
103
|
+
|
|
104
|
+
/// Compression method.
|
|
105
|
+
DECLARE_FIELD(compression_method, CompressionMethod, SetCompressionMethod, CompressionMethod::None);
|
|
106
|
+
|
|
107
|
+
/// TCP Keep alive options
|
|
108
|
+
DECLARE_FIELD(tcp_keepalive, bool, TcpKeepAlive, false);
|
|
109
|
+
DECLARE_FIELD(tcp_keepalive_idle, std::chrono::seconds, SetTcpKeepAliveIdle, std::chrono::seconds(60));
|
|
110
|
+
DECLARE_FIELD(tcp_keepalive_intvl, std::chrono::seconds, SetTcpKeepAliveInterval, std::chrono::seconds(5));
|
|
111
|
+
DECLARE_FIELD(tcp_keepalive_cnt, unsigned int, SetTcpKeepAliveCount, 3);
|
|
112
|
+
|
|
113
|
+
// TCP options
|
|
114
|
+
DECLARE_FIELD(tcp_nodelay, bool, TcpNoDelay, true);
|
|
115
|
+
|
|
116
|
+
/// Connection socket connect timeout. If the timeout is negative then the connect operation will never timeout.
|
|
117
|
+
DECLARE_FIELD(connection_connect_timeout, std::chrono::milliseconds, SetConnectionConnectTimeout, std::chrono::seconds(5));
|
|
118
|
+
|
|
119
|
+
/// Connection socket timeout. If the timeout is set to zero then the operation will never timeout.
|
|
120
|
+
DECLARE_FIELD(connection_recv_timeout, std::chrono::milliseconds, SetConnectionRecvTimeout, std::chrono::milliseconds(0));
|
|
121
|
+
DECLARE_FIELD(connection_send_timeout, std::chrono::milliseconds, SetConnectionSendTimeout, std::chrono::milliseconds(0));
|
|
122
|
+
|
|
123
|
+
/** It helps to ease migration of the old codebases, which can't afford to switch
|
|
124
|
+
* to using ColumnLowCardinalityT or ColumnLowCardinality directly,
|
|
125
|
+
* but still want to benefit from smaller on-wire LowCardinality bandwidth footprint.
|
|
126
|
+
*
|
|
127
|
+
* @see LowCardinalitySerializationAdaptor, CreateColumnByType
|
|
128
|
+
*/
|
|
129
|
+
[[deprecated("Makes implementation of LC(X) harder and code uglier. Will be removed in next major release (3.0) ")]]
|
|
130
|
+
DECLARE_FIELD(backward_compatibility_lowcardinality_as_wrapped_column, bool, SetBakcwardCompatibilityFeatureLowCardinalityAsWrappedColumn, false);
|
|
131
|
+
|
|
132
|
+
/** Set max size data to compress if compression enabled.
|
|
133
|
+
*
|
|
134
|
+
* Allows choosing tradeoff between RAM\CPU:
|
|
135
|
+
* - Lower value reduces RAM usage, but slightly increases CPU usage.
|
|
136
|
+
* - Higher value increases RAM usage but slightly decreases CPU usage.
|
|
137
|
+
*/
|
|
138
|
+
DECLARE_FIELD(max_compression_chunk_size, unsigned int, SetMaxCompressionChunkSize, 65535);
|
|
139
|
+
|
|
140
|
+
struct SSLOptions {
|
|
141
|
+
/** There are two ways to configure an SSL connection:
|
|
142
|
+
* - provide a pre-configured SSL_CTX, which is not modified and not owned by the Client.
|
|
143
|
+
* - provide a set of options and allow the Client to create and configure SSL_CTX by itself.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/** Pre-configured SSL-context for SSL-connection.
|
|
147
|
+
* If NOT null client DONES NOT take ownership of context and it must be valid for client lifetime.
|
|
148
|
+
* If null client initlaizes OpenSSL and creates his own context, initializes it using
|
|
149
|
+
* other options, like path_to_ca_files, path_to_ca_directory, use_default_ca_locations, etc.
|
|
150
|
+
*
|
|
151
|
+
* Either way context is used to create an SSL-connection, which is then configured with
|
|
152
|
+
* whatever was provided as `configuration`, `host_flags`, `skip_verification` and `use_sni`.
|
|
153
|
+
*/
|
|
154
|
+
SSL_CTX * ssl_context = nullptr;
|
|
155
|
+
auto & SetExternalSSLContext(SSL_CTX * new_ssl_context) {
|
|
156
|
+
ssl_context = new_ssl_context;
|
|
157
|
+
return *this;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Means to validate the server-supplied certificate against trusted Certificate Authority (CA).
|
|
161
|
+
* If no CAs are configured, the server's identity can't be validated, and the Client would err.
|
|
162
|
+
* See https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_default_verify_paths.html
|
|
163
|
+
*/
|
|
164
|
+
/// Load default CA certificates from default locations.
|
|
165
|
+
DECLARE_FIELD(use_default_ca_locations, bool, SetUseDefaultCALocations, true);
|
|
166
|
+
/// Path to the CA files to verify server certificate, may be empty.
|
|
167
|
+
DECLARE_FIELD(path_to_ca_files, std::vector<std::string>, SetPathToCAFiles, {});
|
|
168
|
+
/// Path to the directory with CA files used to validate server certificate, may be empty.
|
|
169
|
+
DECLARE_FIELD(path_to_ca_directory, std::string, SetPathToCADirectory, "");
|
|
170
|
+
|
|
171
|
+
/** Min and max protocol versions to use, set with SSL_CTX_set_min_proto_version and SSL_CTX_set_max_proto_version
|
|
172
|
+
* for details see https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_min_proto_version.html
|
|
173
|
+
*/
|
|
174
|
+
DECLARE_FIELD(min_protocol_version, int, SetMinProtocolVersion, DEFAULT_VALUE);
|
|
175
|
+
DECLARE_FIELD(max_protocol_version, int, SetMaxProtocolVersion, DEFAULT_VALUE);
|
|
176
|
+
|
|
177
|
+
/** Options to be set with SSL_CTX_set_options,
|
|
178
|
+
* for details see https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_options.html
|
|
179
|
+
*/
|
|
180
|
+
DECLARE_FIELD(context_options, int, SetContextOptions, DEFAULT_VALUE);
|
|
181
|
+
|
|
182
|
+
/** Use SNI at ClientHello
|
|
183
|
+
*/
|
|
184
|
+
DECLARE_FIELD(use_sni, bool, SetUseSNI, true);
|
|
185
|
+
|
|
186
|
+
/** Skip SSL session verification (server's certificate, etc).
|
|
187
|
+
*
|
|
188
|
+
* WARNING: settig to true will bypass all SSL session checks, which
|
|
189
|
+
* is dangerous, but can be used against self-signed certificates, e.g. for testing purposes.
|
|
190
|
+
*/
|
|
191
|
+
DECLARE_FIELD(skip_verification, bool, SetSkipVerification, false);
|
|
192
|
+
|
|
193
|
+
/** Mode of verifying host ssl certificate against name of the host, set with SSL_set_hostflags.
|
|
194
|
+
* For details see https://www.openssl.org/docs/man1.1.1/man3/SSL_set_hostflags.html
|
|
195
|
+
*/
|
|
196
|
+
DECLARE_FIELD(host_flags, int, SetHostVerifyFlags, DEFAULT_VALUE);
|
|
197
|
+
|
|
198
|
+
struct CommandAndValue {
|
|
199
|
+
std::string command;
|
|
200
|
+
std::optional<std::string> value = std::nullopt;
|
|
201
|
+
};
|
|
202
|
+
/** Extra configuration options, set with SSL_CONF_cmd.
|
|
203
|
+
* For deatils see https://www.openssl.org/docs/man1.1.1/man3/SSL_CONF_cmd.html
|
|
204
|
+
*
|
|
205
|
+
* Takes multiple pairs of command-value strings, all commands are supported,
|
|
206
|
+
* and prefix is empty.
|
|
207
|
+
* i.e. pass `sigalgs` or `SignatureAlgorithms` instead of `-sigalgs`.
|
|
208
|
+
*
|
|
209
|
+
* Rewrites any other options/flags if set in other ways.
|
|
210
|
+
*/
|
|
211
|
+
DECLARE_FIELD(configuration, std::vector<CommandAndValue>, SetConfiguration, {});
|
|
212
|
+
|
|
213
|
+
static const int DEFAULT_VALUE = -1;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// By default SSL is turned off.
|
|
217
|
+
std::optional<SSLOptions> ssl_options = std::nullopt;
|
|
218
|
+
|
|
219
|
+
// Will throw an exception if client was built without SSL support.
|
|
220
|
+
ClientOptions& SetSSLOptions(SSLOptions options);
|
|
221
|
+
|
|
222
|
+
#undef DECLARE_FIELD
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
std::ostream& operator<<(std::ostream& os, const ClientOptions& options);
|
|
226
|
+
std::ostream& operator<<(std::ostream& os, const Endpoint& options);
|
|
227
|
+
|
|
228
|
+
class SocketFactory;
|
|
229
|
+
|
|
230
|
+
struct ExternalTable {
|
|
231
|
+
const std::string_view name;
|
|
232
|
+
const Block& data;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
using ExternalTables = std::vector<ExternalTable>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
*
|
|
239
|
+
*/
|
|
240
|
+
class Client {
|
|
241
|
+
public:
|
|
242
|
+
Client(const ClientOptions& opts);
|
|
243
|
+
Client(const ClientOptions& opts,
|
|
244
|
+
std::unique_ptr<SocketFactory> socket_factory);
|
|
245
|
+
~Client();
|
|
246
|
+
|
|
247
|
+
/// Intends for execute arbitrary queries.
|
|
248
|
+
void Execute(const Query& query);
|
|
249
|
+
|
|
250
|
+
/// Intends for execute select queries. Data will be returned with
|
|
251
|
+
/// one or more call of \p cb.
|
|
252
|
+
void Select(const std::string& query, SelectCallback cb);
|
|
253
|
+
void Select(const std::string& query, const std::string& query_id, SelectCallback cb);
|
|
254
|
+
|
|
255
|
+
/// Executes a select query which can be canceled by returning false from
|
|
256
|
+
/// the data handler function \p cb.
|
|
257
|
+
void SelectCancelable(const std::string& query, SelectCancelableCallback cb);
|
|
258
|
+
void SelectCancelable(const std::string& query, const std::string& query_id, SelectCancelableCallback cb);
|
|
259
|
+
|
|
260
|
+
// The same as Select but with an external data
|
|
261
|
+
// required for the query, see https://clickhouse.com/docs/engines/table-engines/special/external-data
|
|
262
|
+
void SelectWithExternalData(const std::string& query, const ExternalTables& external_tables, SelectCallback cb);
|
|
263
|
+
void SelectWithExternalData(const std::string& query, const std::string& query_id, const ExternalTables& external_tables, SelectCallback cb);
|
|
264
|
+
|
|
265
|
+
// The same as SelectWithExternalData but can be canceled by returning false from
|
|
266
|
+
// the data handler function \p cb.
|
|
267
|
+
void SelectWithExternalDataCancelable(const std::string& query, const ExternalTables& external_tables, SelectCancelableCallback cb);
|
|
268
|
+
void SelectWithExternalDataCancelable(const std::string& query, const std::string& query_id, const ExternalTables& external_tables, SelectCancelableCallback cb);
|
|
269
|
+
|
|
270
|
+
/// Alias for Execute.
|
|
271
|
+
void Select(const Query& query);
|
|
272
|
+
|
|
273
|
+
/// Intends for insert block of data into a table \p table_name.
|
|
274
|
+
void Insert(const std::string& table_name, const Block& block);
|
|
275
|
+
void Insert(const std::string& table_name, const std::string& query_id, const Block& block);
|
|
276
|
+
|
|
277
|
+
/// Start an \p INSERT statement, insert batches of data, then finish the insert.
|
|
278
|
+
Block BeginInsert(const std::string& query);
|
|
279
|
+
Block BeginInsert(const std::string& query, const std::string& query_id);
|
|
280
|
+
|
|
281
|
+
/// Insert data using a \p block returned by \p BeginInsert.
|
|
282
|
+
void SendInsertBlock(const Block& block);
|
|
283
|
+
|
|
284
|
+
/// End an \p INSERT session started by \p BeginInsert.
|
|
285
|
+
void EndInsert();
|
|
286
|
+
|
|
287
|
+
/// Ping server for aliveness.
|
|
288
|
+
void Ping();
|
|
289
|
+
|
|
290
|
+
/// Reset connection with initial params.
|
|
291
|
+
void ResetConnection();
|
|
292
|
+
|
|
293
|
+
const ServerInfo& GetServerInfo() const;
|
|
294
|
+
|
|
295
|
+
/// Get current connected endpoint.
|
|
296
|
+
/// In case when client is not connected to any endpoint, nullopt will returned.
|
|
297
|
+
const std::optional<Endpoint>& GetCurrentEndpoint() const;
|
|
298
|
+
|
|
299
|
+
// Try to connect to different endpoints one by one only one time. If it doesn't work, throw an exception.
|
|
300
|
+
void ResetConnectionEndpoint();
|
|
301
|
+
|
|
302
|
+
struct Version
|
|
303
|
+
{
|
|
304
|
+
uint16_t major;
|
|
305
|
+
uint16_t minor;
|
|
306
|
+
uint16_t patch;
|
|
307
|
+
uint16_t build;
|
|
308
|
+
const char * extra;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
static Version GetVersion();
|
|
312
|
+
|
|
313
|
+
private:
|
|
314
|
+
const ClientOptions options_;
|
|
315
|
+
|
|
316
|
+
class Impl;
|
|
317
|
+
std::unique_ptr<Impl> impl_;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#include "array.h"
|
|
2
|
+
#include "numeric.h"
|
|
3
|
+
|
|
4
|
+
#include <stdexcept>
|
|
5
|
+
|
|
6
|
+
namespace clickhouse {
|
|
7
|
+
|
|
8
|
+
namespace {
|
|
9
|
+
std::shared_ptr<ColumnUInt64> make_single_offset(size_t value) {
|
|
10
|
+
auto res = std::make_shared<ColumnUInt64>();
|
|
11
|
+
if (value != 0) {
|
|
12
|
+
res->Append(value);
|
|
13
|
+
}
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
} // namespace
|
|
17
|
+
|
|
18
|
+
ColumnArray::ColumnArray(ColumnRef data) : ColumnArray(data, make_single_offset(data->Size())) {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ColumnArray::ColumnArray(ColumnRef data, std::shared_ptr<ColumnUInt64> offsets)
|
|
22
|
+
: Column(Type::CreateArray(data->Type()))
|
|
23
|
+
, data_(data)
|
|
24
|
+
, offsets_(offsets)
|
|
25
|
+
{
|
|
26
|
+
const auto rows = offsets_->Size();
|
|
27
|
+
const auto expected_values = rows > 0 ? offsets_->At(rows - 1) : 0;
|
|
28
|
+
std::uint64_t prev = 0;
|
|
29
|
+
// Ensure the offset array is internally consistent
|
|
30
|
+
for (const auto& o : offsets_->GetWritableData()) {
|
|
31
|
+
if (o < prev) {
|
|
32
|
+
throw ValidationError("offsets must be monotonically increasing");
|
|
33
|
+
}
|
|
34
|
+
prev = o;
|
|
35
|
+
}
|
|
36
|
+
if (data_->Size() != expected_values) {
|
|
37
|
+
throw ValidationError("Mismatch between data and offsets: Expected " + std::to_string(expected_values) +
|
|
38
|
+
" values in data, but got " + std::to_string(data_->Size()));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ColumnArray::ColumnArray(ColumnArray&& other)
|
|
43
|
+
: Column(other.Type())
|
|
44
|
+
, data_(std::move(other.data_))
|
|
45
|
+
, offsets_(std::move(other.offsets_))
|
|
46
|
+
{
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void ColumnArray::AppendAsColumn(ColumnRef array) {
|
|
50
|
+
// appending data may throw (i.e. due to ype check failure), so do it first to avoid partly modified state.
|
|
51
|
+
data_->Append(array);
|
|
52
|
+
AddOffset(array->Size());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ColumnRef ColumnArray::GetAsColumn(size_t n) const {
|
|
56
|
+
if (n >= Size())
|
|
57
|
+
throw ValidationError("Index is out ouf bounds: " + std::to_string(n));
|
|
58
|
+
|
|
59
|
+
return data_->Slice(GetOffset(n), GetSize(n));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ColumnRef ColumnArray::Slice(size_t begin, size_t size) const {
|
|
63
|
+
if (size && begin + size > Size())
|
|
64
|
+
throw ValidationError("Slice indexes are out of bounds");
|
|
65
|
+
|
|
66
|
+
auto sliced_data = data_->Slice(GetOffset(begin), GetOffset(begin + size) - GetOffset(begin));
|
|
67
|
+
auto offsets = std::make_shared<ColumnUInt64>();
|
|
68
|
+
auto offset = uint64_t{0};
|
|
69
|
+
for (size_t i = 0; i < size; i++) {
|
|
70
|
+
offset += GetSize(begin + i);
|
|
71
|
+
offsets->Append(offset);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return std::make_shared<ColumnArray>(std::move(sliced_data), std::move(offsets));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ColumnRef ColumnArray::CloneEmpty() const {
|
|
78
|
+
return std::make_shared<ColumnArray>(data_->CloneEmpty());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void ColumnArray::Reserve(size_t new_cap) {
|
|
82
|
+
data_->Reserve(new_cap);
|
|
83
|
+
offsets_->Reserve(new_cap);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void ColumnArray::Append(ColumnRef column) {
|
|
87
|
+
if (auto col = column->As<ColumnArray>()) {
|
|
88
|
+
for (size_t i = 0; i < col->Size(); ++i) {
|
|
89
|
+
AppendAsColumn(col->GetAsColumn(i));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
bool ColumnArray::LoadPrefix(InputStream* input, size_t rows) {
|
|
95
|
+
if (!rows) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return data_->LoadPrefix(input, rows);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
bool ColumnArray::LoadBody(InputStream* input, size_t rows) {
|
|
103
|
+
if (!rows) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
if (!offsets_->LoadBody(input, rows)) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
const auto nested_rows = (*offsets_)[rows - 1];
|
|
110
|
+
if (nested_rows == 0) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
if (!data_->LoadBody(input, nested_rows)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
void ColumnArray::SavePrefix(OutputStream* output) {
|
|
120
|
+
data_->SavePrefix(output);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
void ColumnArray::SaveBody(OutputStream* output) {
|
|
124
|
+
offsets_->SaveBody(output);
|
|
125
|
+
if (data_->Size() > 0) {
|
|
126
|
+
data_->SaveBody(output);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
void ColumnArray::Clear() {
|
|
131
|
+
offsets_->Clear();
|
|
132
|
+
data_->Clear();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
size_t ColumnArray::Size() const {
|
|
136
|
+
return offsets_->Size();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
void ColumnArray::Swap(Column& other) {
|
|
140
|
+
auto & col = dynamic_cast<ColumnArray &>(other);
|
|
141
|
+
data_.swap(col.data_);
|
|
142
|
+
offsets_.swap(col.offsets_);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
void ColumnArray::OffsetsIncrease(size_t n) {
|
|
146
|
+
offsets_->Append(n);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
size_t ColumnArray::GetOffset(size_t n) const {
|
|
150
|
+
|
|
151
|
+
return (n == 0) ? 0 : (*offsets_)[n - 1];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
void ColumnArray::AddOffset(size_t n) {
|
|
155
|
+
if (offsets_->Size() == 0) {
|
|
156
|
+
offsets_->Append(n);
|
|
157
|
+
} else {
|
|
158
|
+
offsets_->Append((*offsets_)[offsets_->Size() - 1] + n);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
size_t ColumnArray::GetSize(size_t n) const {
|
|
163
|
+
return (n == 0) ? (*offsets_)[n] : ((*offsets_)[n] - (*offsets_)[n - 1]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
ColumnRef ColumnArray::GetData() {
|
|
167
|
+
return data_;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void ColumnArray::Reset() {
|
|
171
|
+
data_.reset();
|
|
172
|
+
offsets_.reset();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
}
|