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,118 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "column.h"
|
|
4
|
+
#include "numeric.h"
|
|
5
|
+
|
|
6
|
+
namespace clickhouse {
|
|
7
|
+
|
|
8
|
+
class ColumnTime : public Column {
|
|
9
|
+
public:
|
|
10
|
+
using ValueType = int32_t;
|
|
11
|
+
|
|
12
|
+
ColumnTime();
|
|
13
|
+
explicit ColumnTime(std::vector<int32_t>&& data);
|
|
14
|
+
|
|
15
|
+
/// Appends one element to the end of column.
|
|
16
|
+
void Append(ValueType value);
|
|
17
|
+
|
|
18
|
+
/// Returns element at given row number.
|
|
19
|
+
ValueType At(size_t n) const;
|
|
20
|
+
ValueType operator[](size_t n) const { return At(n); }
|
|
21
|
+
|
|
22
|
+
/// Get Raw Vector Contents
|
|
23
|
+
std::vector<int32_t>& GetWritableData();
|
|
24
|
+
|
|
25
|
+
public:
|
|
26
|
+
/// Increase the capacity of the column for large block insertion.
|
|
27
|
+
void Reserve(size_t new_cap) override;
|
|
28
|
+
|
|
29
|
+
/// Returns the capacity of the column
|
|
30
|
+
size_t Capacity() const;
|
|
31
|
+
|
|
32
|
+
/// Appends content of given column to the end of current one.
|
|
33
|
+
void Append(ColumnRef column) override;
|
|
34
|
+
|
|
35
|
+
/// Loads column data from input stream.
|
|
36
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
37
|
+
|
|
38
|
+
/// Clear column data .
|
|
39
|
+
void Clear() override;
|
|
40
|
+
|
|
41
|
+
/// Saves column data to output stream.
|
|
42
|
+
void SaveBody(OutputStream* output) override;
|
|
43
|
+
|
|
44
|
+
/// Returns count of rows in the column.
|
|
45
|
+
size_t Size() const override;
|
|
46
|
+
|
|
47
|
+
/// Makes slice of the current column.
|
|
48
|
+
ColumnRef Slice(size_t begin, size_t len) const override;
|
|
49
|
+
ColumnRef CloneEmpty() const override;
|
|
50
|
+
void Swap(Column& other) override;
|
|
51
|
+
|
|
52
|
+
ItemView GetItem(size_t index) const override;
|
|
53
|
+
|
|
54
|
+
private:
|
|
55
|
+
ColumnTime(TypeRef type, std::shared_ptr<ColumnInt32> data);
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
std::shared_ptr<ColumnInt32> data_;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
class ColumnTime64 : public Column {
|
|
62
|
+
public:
|
|
63
|
+
using ValueType = int64_t;
|
|
64
|
+
|
|
65
|
+
explicit ColumnTime64(size_t precision);
|
|
66
|
+
ColumnTime64(size_t precision, std::vector<int64_t>&& data);
|
|
67
|
+
|
|
68
|
+
/// Appends one element to the end of column.
|
|
69
|
+
void Append(ValueType value);
|
|
70
|
+
|
|
71
|
+
/// Returns element at given row number.
|
|
72
|
+
ValueType At(size_t n) const;
|
|
73
|
+
|
|
74
|
+
ValueType operator[](size_t n) const { return At(n); }
|
|
75
|
+
|
|
76
|
+
/// Get Raw Vector Contents
|
|
77
|
+
std::vector<int64_t>& GetWritableData();
|
|
78
|
+
|
|
79
|
+
public:
|
|
80
|
+
/// Increase the capacity of the column for large block insertion.
|
|
81
|
+
void Reserve(size_t new_cap) override;
|
|
82
|
+
|
|
83
|
+
/// Returns the capacity of the column
|
|
84
|
+
size_t Capacity() const;
|
|
85
|
+
|
|
86
|
+
/// Appends content of given column to the end of current one.
|
|
87
|
+
void Append(ColumnRef column) override;
|
|
88
|
+
|
|
89
|
+
/// Loads column data from input stream.
|
|
90
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
91
|
+
|
|
92
|
+
/// Clear column data .
|
|
93
|
+
void Clear() override;
|
|
94
|
+
|
|
95
|
+
/// Saves column data to output stream.
|
|
96
|
+
void SaveBody(OutputStream* output) override;
|
|
97
|
+
|
|
98
|
+
/// Returns count of rows in the column.
|
|
99
|
+
size_t Size() const override;
|
|
100
|
+
|
|
101
|
+
/// Makes slice of the current column.
|
|
102
|
+
ColumnRef Slice(size_t begin, size_t len) const override;
|
|
103
|
+
ColumnRef CloneEmpty() const override;
|
|
104
|
+
void Swap(Column& other) override;
|
|
105
|
+
|
|
106
|
+
ItemView GetItem(size_t index) const override;
|
|
107
|
+
|
|
108
|
+
size_t GetPrecision() const { return precision_; };
|
|
109
|
+
|
|
110
|
+
private:
|
|
111
|
+
ColumnTime64(TypeRef type, std::shared_ptr<ColumnInt64> data);
|
|
112
|
+
|
|
113
|
+
private:
|
|
114
|
+
std::shared_ptr<ColumnInt64> data_;
|
|
115
|
+
const size_t precision_;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#include "tuple.h"
|
|
2
|
+
|
|
3
|
+
namespace clickhouse {
|
|
4
|
+
|
|
5
|
+
static std::vector<TypeRef> CollectTypes(const std::vector<ColumnRef>& columns) {
|
|
6
|
+
std::vector<TypeRef> types;
|
|
7
|
+
for (const auto& col : columns) {
|
|
8
|
+
types.push_back(col->Type());
|
|
9
|
+
}
|
|
10
|
+
return types;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ColumnTuple::ColumnTuple(const std::vector<ColumnRef>& columns)
|
|
14
|
+
: Column(Type::CreateTuple(CollectTypes(columns)))
|
|
15
|
+
, columns_(columns)
|
|
16
|
+
{
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
size_t ColumnTuple::TupleSize() const {
|
|
20
|
+
return columns_.size();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void ColumnTuple::Reserve(size_t new_cap) {
|
|
24
|
+
for (auto& column : columns_) {
|
|
25
|
+
column->Reserve(new_cap);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void ColumnTuple::Append(ColumnRef column) {
|
|
30
|
+
if (!this->Type()->IsEqual(column->Type())) {
|
|
31
|
+
throw ValidationError(
|
|
32
|
+
"can't append column of type " + column->Type()->GetName() + " "
|
|
33
|
+
"to column type " + this->Type()->GetName());
|
|
34
|
+
}
|
|
35
|
+
const auto & source_tuple_column = column->As<ColumnTuple>();
|
|
36
|
+
for (size_t ci = 0; ci < columns_.size(); ++ci) {
|
|
37
|
+
columns_[ci]->Append((*source_tuple_column)[ci]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
size_t ColumnTuple::Size() const {
|
|
41
|
+
return columns_.empty() ? 0 : columns_[0]->Size();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ColumnRef ColumnTuple::Slice(size_t begin, size_t len) const {
|
|
45
|
+
std::vector<ColumnRef> sliced_columns;
|
|
46
|
+
sliced_columns.reserve(columns_.size());
|
|
47
|
+
for(const auto &column : columns_) {
|
|
48
|
+
sliced_columns.push_back(column->Slice(begin, len));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return std::make_shared<ColumnTuple>(sliced_columns);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ColumnRef ColumnTuple::CloneEmpty() const {
|
|
55
|
+
std::vector<ColumnRef> result_columns;
|
|
56
|
+
result_columns.reserve(columns_.size());
|
|
57
|
+
|
|
58
|
+
for(const auto &column : columns_) {
|
|
59
|
+
result_columns.push_back(column->CloneEmpty());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return std::make_shared<ColumnTuple>(result_columns);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
bool ColumnTuple::LoadPrefix(InputStream* input, size_t rows) {
|
|
66
|
+
for (auto ci = columns_.begin(); ci != columns_.end(); ++ci) {
|
|
67
|
+
if (!(*ci)->LoadPrefix(input, rows)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
bool ColumnTuple::LoadBody(InputStream* input, size_t rows) {
|
|
76
|
+
for (auto ci = columns_.begin(); ci != columns_.end(); ++ci) {
|
|
77
|
+
if (!(*ci)->LoadBody(input, rows)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void ColumnTuple::SavePrefix(OutputStream* output) {
|
|
86
|
+
for (auto & column : columns_) {
|
|
87
|
+
column->SavePrefix(output);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
void ColumnTuple::SaveBody(OutputStream* output) {
|
|
92
|
+
for (auto & column : columns_) {
|
|
93
|
+
column->SaveBody(output);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void ColumnTuple::Clear() {
|
|
98
|
+
columns_.clear();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
void ColumnTuple::Swap(Column& other) {
|
|
102
|
+
auto & col = dynamic_cast<ColumnTuple &>(other);
|
|
103
|
+
columns_.swap(col.columns_);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "column.h"
|
|
4
|
+
#include "utils.h"
|
|
5
|
+
|
|
6
|
+
#include <vector>
|
|
7
|
+
|
|
8
|
+
namespace clickhouse {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents column of Tuple([T]).
|
|
12
|
+
*/
|
|
13
|
+
class ColumnTuple : public Column {
|
|
14
|
+
public:
|
|
15
|
+
ColumnTuple(const std::vector<ColumnRef>& columns);
|
|
16
|
+
|
|
17
|
+
/// Returns count of columns in the tuple.
|
|
18
|
+
size_t TupleSize() const;
|
|
19
|
+
|
|
20
|
+
inline ColumnRef operator [] (size_t n) const {
|
|
21
|
+
return columns_[n];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
inline ColumnRef At(size_t n) const {
|
|
25
|
+
return columns_[n];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/// Increase the capacity of the column for large block insertion.
|
|
30
|
+
void Reserve(size_t new_cap) override;
|
|
31
|
+
|
|
32
|
+
/// Appends content of given column to the end of current one.
|
|
33
|
+
void Append(ColumnRef column) override;
|
|
34
|
+
|
|
35
|
+
/// Loads column prefix from input stream.
|
|
36
|
+
bool LoadPrefix(InputStream* input, size_t rows) override;
|
|
37
|
+
|
|
38
|
+
/// Loads column data from input stream.
|
|
39
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
40
|
+
|
|
41
|
+
/// Saves column prefix to output stream.
|
|
42
|
+
void SavePrefix(OutputStream* output) override;
|
|
43
|
+
|
|
44
|
+
/// Saves column data to output stream.
|
|
45
|
+
void SaveBody(OutputStream* output) override;
|
|
46
|
+
|
|
47
|
+
/// Clear column data .
|
|
48
|
+
void Clear() override;
|
|
49
|
+
|
|
50
|
+
/// Returns count of rows in the column.
|
|
51
|
+
size_t Size() const override;
|
|
52
|
+
|
|
53
|
+
/// Makes slice of the current column.
|
|
54
|
+
ColumnRef Slice(size_t, size_t) const override;
|
|
55
|
+
ColumnRef CloneEmpty() const override;
|
|
56
|
+
void Swap(Column& other) override;
|
|
57
|
+
|
|
58
|
+
private:
|
|
59
|
+
std::vector<ColumnRef> columns_;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
template <typename... Columns>
|
|
63
|
+
class ColumnTupleT : public ColumnTuple {
|
|
64
|
+
public:
|
|
65
|
+
using TupleOfColumns = std::tuple<std::shared_ptr<Columns>...>;
|
|
66
|
+
|
|
67
|
+
using ValueType = std::tuple<std::decay_t<decltype(std::declval<Columns>().At(0))>...>;
|
|
68
|
+
|
|
69
|
+
ColumnTupleT(std::tuple<std::shared_ptr<Columns>...> columns)
|
|
70
|
+
: ColumnTuple(TupleToVector(columns)), typed_columns_(std::move(columns)) {}
|
|
71
|
+
|
|
72
|
+
ColumnTupleT(std::vector<ColumnRef> columns)
|
|
73
|
+
: ColumnTuple(columns), typed_columns_(VectorToTuple(std::move(columns))) {}
|
|
74
|
+
|
|
75
|
+
ColumnTupleT(const std::initializer_list<ColumnRef> columns)
|
|
76
|
+
: ColumnTuple(columns), typed_columns_(VectorToTuple(std::move(columns))) {}
|
|
77
|
+
|
|
78
|
+
inline ValueType At(size_t index) const { return GetTupleOfValues(index); }
|
|
79
|
+
|
|
80
|
+
inline ValueType operator[](size_t index) const { return GetTupleOfValues(index); }
|
|
81
|
+
|
|
82
|
+
using ColumnTuple::Append;
|
|
83
|
+
|
|
84
|
+
template <typename... T>
|
|
85
|
+
inline void Append(std::tuple<T...> value) {
|
|
86
|
+
AppendTuple(std::move(value));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Create a ColumnTupleT from a ColumnTuple, without copying data and offsets, but by
|
|
90
|
+
* 'stealing' those from `col`.
|
|
91
|
+
*
|
|
92
|
+
* Ownership of column internals is transferred to returned object, original (argument) object
|
|
93
|
+
* MUST NOT BE USED IN ANY WAY, it is only safe to dispose it.
|
|
94
|
+
*
|
|
95
|
+
* Throws an exception if `col` is of wrong type, it is safe to use original col in this case.
|
|
96
|
+
* This is a static method to make such conversion verbose.
|
|
97
|
+
*/
|
|
98
|
+
static auto Wrap(ColumnTuple&& col) {
|
|
99
|
+
if (col.TupleSize() != std::tuple_size_v<TupleOfColumns>) {
|
|
100
|
+
throw ValidationError("Can't wrap from " + col.GetType().GetName());
|
|
101
|
+
}
|
|
102
|
+
return std::make_shared<ColumnTupleT<Columns...>>(VectorToTuple(std::move(col)));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static auto Wrap(Column&& col) { return Wrap(std::move(dynamic_cast<ColumnTuple&&>(col))); }
|
|
106
|
+
|
|
107
|
+
// Helper to simplify integration with other APIs
|
|
108
|
+
static auto Wrap(ColumnRef&& col) { return Wrap(std::move(*col->AsStrict<ColumnTuple>())); }
|
|
109
|
+
|
|
110
|
+
ColumnRef Slice(size_t begin, size_t size) const override {
|
|
111
|
+
return Wrap(ColumnTuple::Slice(begin, size));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
ColumnRef CloneEmpty() const override { return Wrap(ColumnTuple::CloneEmpty()); }
|
|
115
|
+
|
|
116
|
+
void Swap(Column& other) override {
|
|
117
|
+
auto& col = dynamic_cast<ColumnTupleT<Columns...>&>(other);
|
|
118
|
+
typed_columns_.swap(col.typed_columns_);
|
|
119
|
+
ColumnTuple::Swap(other);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private:
|
|
123
|
+
template <typename T, size_t index = std::tuple_size_v<T>>
|
|
124
|
+
inline void AppendTuple([[maybe_unused]] T value) {
|
|
125
|
+
static_assert(index <= std::tuple_size_v<T>);
|
|
126
|
+
static_assert(std::tuple_size_v<TupleOfColumns> == std::tuple_size_v<T>);
|
|
127
|
+
if constexpr (index == 0) {
|
|
128
|
+
return;
|
|
129
|
+
} else {
|
|
130
|
+
std::get<index - 1>(typed_columns_)->Append(std::move(std::get<index - 1>(value)));
|
|
131
|
+
AppendTuple<T, index - 1>(std::move(value));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
template <typename T, size_t index = std::tuple_size_v<T>>
|
|
136
|
+
inline static std::vector<ColumnRef> TupleToVector([[maybe_unused]] const T& value) {
|
|
137
|
+
static_assert(index <= std::tuple_size_v<T>);
|
|
138
|
+
if constexpr (index == 0) {
|
|
139
|
+
std::vector<ColumnRef> result;
|
|
140
|
+
result.reserve(std::tuple_size_v<T>);
|
|
141
|
+
return result;
|
|
142
|
+
} else {
|
|
143
|
+
auto result = TupleToVector<T, index - 1>(value);
|
|
144
|
+
result.push_back(std::get<index - 1>(value));
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
template <typename T, size_t column_index = std::tuple_size_v<TupleOfColumns>>
|
|
150
|
+
inline static auto VectorToTuple([[maybe_unused]] T columns) {
|
|
151
|
+
static_assert(column_index <= std::tuple_size_v<TupleOfColumns>);
|
|
152
|
+
if constexpr (column_index == 0) {
|
|
153
|
+
return std::make_tuple();
|
|
154
|
+
} else {
|
|
155
|
+
using ColumnType =
|
|
156
|
+
typename std::tuple_element<column_index - 1, TupleOfColumns>::type::element_type;
|
|
157
|
+
auto column = WrapColumn<ColumnType>(columns[column_index - 1]);
|
|
158
|
+
return std::tuple_cat(std::move(VectorToTuple<T, column_index - 1>(std::move(columns))),
|
|
159
|
+
std::make_tuple(std::move(column)));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
template <size_t column_index = std::tuple_size_v<TupleOfColumns>>
|
|
164
|
+
inline auto GetTupleOfValues([[maybe_unused]]size_t index) const {
|
|
165
|
+
static_assert(column_index <= std::tuple_size_v<TupleOfColumns>);
|
|
166
|
+
if constexpr (column_index == 0) {
|
|
167
|
+
return std::make_tuple();
|
|
168
|
+
} else {
|
|
169
|
+
return std::tuple_cat(
|
|
170
|
+
std::move(GetTupleOfValues<column_index - 1>(index)),
|
|
171
|
+
std::move(std::make_tuple(std::get<column_index - 1>(typed_columns_)->At(index))));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
TupleOfColumns typed_columns_;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
} // namespace clickhouse
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <algorithm>
|
|
4
|
+
#include <vector>
|
|
5
|
+
#include <memory>
|
|
6
|
+
|
|
7
|
+
namespace clickhouse {
|
|
8
|
+
|
|
9
|
+
template <typename T>
|
|
10
|
+
std::vector<T> SliceVector(const std::vector<T>& vec, size_t begin, size_t len) {
|
|
11
|
+
std::vector<T> result;
|
|
12
|
+
|
|
13
|
+
if (begin < vec.size()) {
|
|
14
|
+
len = std::min(len, vec.size() - begin);
|
|
15
|
+
result.assign(vec.begin() + begin, vec.begin() + (begin + len));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
template <typename T>
|
|
22
|
+
struct HasWrapMethod {
|
|
23
|
+
private:
|
|
24
|
+
static int detect(...);
|
|
25
|
+
template <typename U>
|
|
26
|
+
static decltype(U::Wrap(std::move(std::declval<ColumnRef>()))) detect(const U&);
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
static constexpr bool value = !std::is_same<int, decltype(detect(std::declval<T>()))>::value;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
template <typename T>
|
|
33
|
+
inline std::shared_ptr<T> WrapColumn(ColumnRef&& column) {
|
|
34
|
+
if constexpr (HasWrapMethod<T>::value) {
|
|
35
|
+
return T::Wrap(std::move(column));
|
|
36
|
+
} else {
|
|
37
|
+
return column->template AsStrict<T>();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#include "uuid.h"
|
|
2
|
+
#include "utils.h"
|
|
3
|
+
#include "../exceptions.h"
|
|
4
|
+
|
|
5
|
+
#include <stdexcept>
|
|
6
|
+
|
|
7
|
+
namespace clickhouse {
|
|
8
|
+
|
|
9
|
+
ColumnUUID::ColumnUUID()
|
|
10
|
+
: Column(Type::CreateUUID())
|
|
11
|
+
, data_(std::make_shared<ColumnUInt64>())
|
|
12
|
+
{
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ColumnUUID::ColumnUUID(ColumnRef data)
|
|
16
|
+
: Column(Type::CreateUUID())
|
|
17
|
+
, data_(data->As<ColumnUInt64>())
|
|
18
|
+
{
|
|
19
|
+
if (data_->Size() % 2 != 0) {
|
|
20
|
+
throw ValidationError("number of entries must be even (two 64-bit numbers for each UUID)");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void ColumnUUID::Append(const UUID& value) {
|
|
25
|
+
data_->Append(value.first);
|
|
26
|
+
data_->Append(value.second);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void ColumnUUID::Clear() {
|
|
30
|
+
data_->Clear();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const UUID ColumnUUID::At(size_t n) const {
|
|
34
|
+
return UUID(data_->At(n * 2), data_->At(n * 2 + 1));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void ColumnUUID::Reserve(size_t new_cap) {
|
|
38
|
+
data_->Reserve(new_cap);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void ColumnUUID::Append(ColumnRef column) {
|
|
42
|
+
if (auto col = column->As<ColumnUUID>()) {
|
|
43
|
+
data_->Append(col->data_);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
bool ColumnUUID::LoadBody(InputStream* input, size_t rows) {
|
|
48
|
+
return data_->LoadBody(input, rows * 2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void ColumnUUID::SaveBody(OutputStream* output) {
|
|
52
|
+
data_->SaveBody(output);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
size_t ColumnUUID::Size() const {
|
|
56
|
+
return data_->Size() / 2;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ColumnRef ColumnUUID::Slice(size_t begin, size_t len) const {
|
|
60
|
+
return std::make_shared<ColumnUUID>(data_->Slice(begin * 2, len * 2));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ColumnRef ColumnUUID::CloneEmpty() const {
|
|
64
|
+
return std::make_shared<ColumnUUID>();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void ColumnUUID::Swap(Column& other) {
|
|
68
|
+
auto & col = dynamic_cast<ColumnUUID &>(other);
|
|
69
|
+
data_.swap(col.data_);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ItemView ColumnUUID::GetItem(size_t index) const {
|
|
73
|
+
// We know that ColumnUInt64 stores it's data in continius memory region,
|
|
74
|
+
// and that every 2 values from data represent 1 UUID value.
|
|
75
|
+
const auto data_item_view = data_->GetItem(index * 2);
|
|
76
|
+
|
|
77
|
+
return ItemView{Type::UUID, std::string_view{data_item_view.data.data(), data_item_view.data.size() * 2}};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "../base/uuid.h"
|
|
4
|
+
#include "column.h"
|
|
5
|
+
#include "numeric.h"
|
|
6
|
+
|
|
7
|
+
namespace clickhouse {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents a UUID column.
|
|
12
|
+
*/
|
|
13
|
+
class ColumnUUID : public Column {
|
|
14
|
+
public:
|
|
15
|
+
ColumnUUID();
|
|
16
|
+
|
|
17
|
+
explicit ColumnUUID(ColumnRef data);
|
|
18
|
+
|
|
19
|
+
/// Appends one element to the end of column.
|
|
20
|
+
void Append(const UUID& value);
|
|
21
|
+
|
|
22
|
+
/// Returns element at given row number.
|
|
23
|
+
const UUID At(size_t n) const;
|
|
24
|
+
|
|
25
|
+
/// Returns element at given row number.
|
|
26
|
+
inline const UUID operator [] (size_t n) const { return At(n); }
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/// Increase the capacity of the column for large block insertion.
|
|
30
|
+
void Reserve(size_t new_cap) override;
|
|
31
|
+
|
|
32
|
+
/// Appends content of given column to the end of current one.
|
|
33
|
+
void Append(ColumnRef column) override;
|
|
34
|
+
|
|
35
|
+
/// Loads column data from input stream.
|
|
36
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
37
|
+
|
|
38
|
+
/// Saves column data to output stream.
|
|
39
|
+
void SaveBody(OutputStream* output) override;
|
|
40
|
+
|
|
41
|
+
/// Clear column data .
|
|
42
|
+
void Clear() override;
|
|
43
|
+
|
|
44
|
+
/// Returns count of rows in the column.
|
|
45
|
+
size_t Size() const override;
|
|
46
|
+
|
|
47
|
+
/// Makes slice of the current column.
|
|
48
|
+
ColumnRef Slice(size_t begin, size_t len) const override;
|
|
49
|
+
ColumnRef CloneEmpty() const override;
|
|
50
|
+
void Swap(Column& other) override;
|
|
51
|
+
|
|
52
|
+
ItemView GetItem(size_t) const override;
|
|
53
|
+
|
|
54
|
+
private:
|
|
55
|
+
std::shared_ptr<ColumnUInt64> data_;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
}
|