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,321 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "column.h"
|
|
4
|
+
#include "numeric.h"
|
|
5
|
+
#include "utils.h"
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
|
|
9
|
+
namespace clickhouse {
|
|
10
|
+
|
|
11
|
+
template <typename NestedColumnType>
|
|
12
|
+
class ColumnArrayT;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents column of Array(T).
|
|
16
|
+
*/
|
|
17
|
+
class ColumnArray : public Column {
|
|
18
|
+
public:
|
|
19
|
+
using ValueType = ColumnRef;
|
|
20
|
+
|
|
21
|
+
/** Create an array of given type.
|
|
22
|
+
*
|
|
23
|
+
* `data` is used internally (and modified) by ColumnArray.
|
|
24
|
+
* Users are strongly advised against supplying non-empty columns and/or modifying
|
|
25
|
+
* contents of `data` afterwards.
|
|
26
|
+
*/
|
|
27
|
+
explicit ColumnArray(ColumnRef data);
|
|
28
|
+
|
|
29
|
+
/** Create an array of given type, with actual values and offsets.
|
|
30
|
+
*
|
|
31
|
+
* Both `data` and `offsets` are used (and modified) internally bye ColumnArray.
|
|
32
|
+
* Users are strongly advised against modifying contents of `data` or `offsets` afterwards.
|
|
33
|
+
*/
|
|
34
|
+
ColumnArray(ColumnRef data, std::shared_ptr<ColumnUInt64> offsets);
|
|
35
|
+
|
|
36
|
+
/// Converts input column to array and appends as one row to the current column.
|
|
37
|
+
void AppendAsColumn(ColumnRef array);
|
|
38
|
+
|
|
39
|
+
/// Converts array at pos n to column.
|
|
40
|
+
/// Type of element of result column same as type of array element.
|
|
41
|
+
ColumnRef GetAsColumn(size_t n) const;
|
|
42
|
+
|
|
43
|
+
/// Shorthand to get a column casted to a proper type.
|
|
44
|
+
template <typename T>
|
|
45
|
+
auto GetAsColumnTyped(size_t n) const {
|
|
46
|
+
return GetAsColumn(n)->AsStrict<T>();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
/// Increase the capacity of the column for large block insertion.
|
|
51
|
+
void Reserve(size_t new_cap) override;
|
|
52
|
+
|
|
53
|
+
/// Appends content of given column to the end of current one.
|
|
54
|
+
void Append(ColumnRef column) override;
|
|
55
|
+
|
|
56
|
+
/// Loads column prefix from input stream.
|
|
57
|
+
bool LoadPrefix(InputStream* input, size_t rows) override;
|
|
58
|
+
|
|
59
|
+
/// Loads column data from input stream.
|
|
60
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
61
|
+
|
|
62
|
+
/// Saves column prefix to output stream.
|
|
63
|
+
void SavePrefix(OutputStream* output) override;
|
|
64
|
+
|
|
65
|
+
/// Saves column data to output stream.
|
|
66
|
+
void SaveBody(OutputStream* output) override;
|
|
67
|
+
|
|
68
|
+
/// Clear column data .
|
|
69
|
+
void Clear() override;
|
|
70
|
+
|
|
71
|
+
/// Returns count of rows in the column.
|
|
72
|
+
size_t Size() const override;
|
|
73
|
+
|
|
74
|
+
/// Makes slice of the current column.
|
|
75
|
+
ColumnRef Slice(size_t, size_t) const override;
|
|
76
|
+
ColumnRef CloneEmpty() const override;
|
|
77
|
+
void Swap(Column&) override;
|
|
78
|
+
|
|
79
|
+
void OffsetsIncrease(size_t);
|
|
80
|
+
|
|
81
|
+
protected:
|
|
82
|
+
template<typename T> friend class ColumnArrayT;
|
|
83
|
+
|
|
84
|
+
ColumnArray(ColumnArray&& array);
|
|
85
|
+
|
|
86
|
+
size_t GetOffset(size_t n) const;
|
|
87
|
+
size_t GetSize(size_t n) const;
|
|
88
|
+
ColumnRef GetData();
|
|
89
|
+
void AddOffset(size_t n);
|
|
90
|
+
void Reset();
|
|
91
|
+
|
|
92
|
+
private:
|
|
93
|
+
ColumnRef data_;
|
|
94
|
+
std::shared_ptr<ColumnUInt64> offsets_;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
template <typename ColumnType>
|
|
98
|
+
class ColumnArrayT : public ColumnArray {
|
|
99
|
+
public:
|
|
100
|
+
class ArrayValueView;
|
|
101
|
+
using ValueType = ArrayValueView;
|
|
102
|
+
using NestedColumnType = ColumnType;
|
|
103
|
+
|
|
104
|
+
explicit ColumnArrayT(std::shared_ptr<NestedColumnType> data)
|
|
105
|
+
: ColumnArray(data)
|
|
106
|
+
, typed_nested_data_(data)
|
|
107
|
+
{}
|
|
108
|
+
|
|
109
|
+
ColumnArrayT(std::shared_ptr<NestedColumnType> data, std::shared_ptr<ColumnUInt64> offsets)
|
|
110
|
+
: ColumnArray(data, offsets)
|
|
111
|
+
, typed_nested_data_(data)
|
|
112
|
+
{}
|
|
113
|
+
|
|
114
|
+
template <typename ...Args>
|
|
115
|
+
explicit ColumnArrayT(Args &&... args)
|
|
116
|
+
: ColumnArrayT(std::make_shared<NestedColumnType>(std::forward<Args>(args)...))
|
|
117
|
+
{}
|
|
118
|
+
|
|
119
|
+
/** Create a ColumnArrayT from a ColumnArray, without copying data and offsets, but by 'stealing' those from `col`.
|
|
120
|
+
*
|
|
121
|
+
* Ownership of column internals is transferred to returned object, original (argument) object
|
|
122
|
+
* MUST NOT BE USED IN ANY WAY, it is only safe to dispose it.
|
|
123
|
+
*
|
|
124
|
+
* Throws an exception if `col` is of wrong type, it is safe to use original col in this case.
|
|
125
|
+
* This is a static method to make such conversion verbose.
|
|
126
|
+
*/
|
|
127
|
+
static auto Wrap(ColumnArray&& col) {
|
|
128
|
+
auto nested_data = WrapColumn<NestedColumnType>(col.GetData());
|
|
129
|
+
return std::make_shared<ColumnArrayT<NestedColumnType>>(nested_data, col.offsets_);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static auto Wrap(Column&& col) {
|
|
133
|
+
return Wrap(std::move(dynamic_cast<ColumnArray&&>(col)));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Helper to simplify integration with other APIs
|
|
137
|
+
static auto Wrap(ColumnRef&& col) {
|
|
138
|
+
return Wrap(std::move(*col->AsStrict<ColumnArray>()));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// A single (row) value of the Array-column, i.e. readonly array of items.
|
|
142
|
+
class ArrayValueView {
|
|
143
|
+
const std::shared_ptr<NestedColumnType> typed_nested_data_;
|
|
144
|
+
const size_t offset_;
|
|
145
|
+
const size_t size_;
|
|
146
|
+
|
|
147
|
+
public:
|
|
148
|
+
using ValueType = std::decay_t<decltype(std::declval<NestedColumnType>().At(0))>;
|
|
149
|
+
|
|
150
|
+
ArrayValueView(std::shared_ptr<NestedColumnType> data, size_t offset = 0, size_t size = std::numeric_limits<size_t>::max())
|
|
151
|
+
: typed_nested_data_(data)
|
|
152
|
+
, offset_(offset)
|
|
153
|
+
, size_(std::min(typed_nested_data_->Size() - offset, size))
|
|
154
|
+
{}
|
|
155
|
+
|
|
156
|
+
inline auto operator[](size_t index) const {
|
|
157
|
+
return (*typed_nested_data_)[offset_ + index];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
inline auto At(size_t index) const {
|
|
161
|
+
if (index >= size_)
|
|
162
|
+
throw ValidationError("ColumnArray value index out of bounds: "
|
|
163
|
+
+ std::to_string(index) + ", max is " + std::to_string(size_));
|
|
164
|
+
return typed_nested_data_->At(offset_ + index);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
class Iterator {
|
|
168
|
+
const std::shared_ptr<NestedColumnType> typed_nested_data_;
|
|
169
|
+
const size_t offset_;
|
|
170
|
+
const size_t size_;
|
|
171
|
+
size_t index_;
|
|
172
|
+
public:
|
|
173
|
+
Iterator() = default;
|
|
174
|
+
|
|
175
|
+
Iterator(std::shared_ptr<NestedColumnType> typed_nested_data, size_t offset, size_t size, size_t index)
|
|
176
|
+
: typed_nested_data_(typed_nested_data)
|
|
177
|
+
, offset_(offset)
|
|
178
|
+
, size_(size)
|
|
179
|
+
, index_(index)
|
|
180
|
+
{}
|
|
181
|
+
|
|
182
|
+
using ValueType = typename ArrayValueView::ValueType;
|
|
183
|
+
|
|
184
|
+
inline auto operator*() const {
|
|
185
|
+
return typed_nested_data_->At(offset_ + index_);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
inline Iterator& operator++() {
|
|
189
|
+
++index_;
|
|
190
|
+
return *this;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
inline bool operator==(const Iterator& other) const {
|
|
194
|
+
return this->typed_nested_data_ == other.typed_nested_data_
|
|
195
|
+
&& this->offset_ == other.offset_
|
|
196
|
+
&& this->size_ == other.size_
|
|
197
|
+
&& this->index_ == other.index_;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
inline bool operator!=(const Iterator& other) const {
|
|
201
|
+
return !(*this == other);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// minimalistic stl-like container interface, hence the lowercase
|
|
206
|
+
inline Iterator begin() const {
|
|
207
|
+
return Iterator{typed_nested_data_, offset_, size_, 0};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
inline Iterator cbegin() const {
|
|
211
|
+
return Iterator{typed_nested_data_, offset_, size_, 0};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
inline Iterator end() const {
|
|
215
|
+
return Iterator{typed_nested_data_, offset_, size_, size_};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
inline Iterator cend() const {
|
|
219
|
+
return Iterator{typed_nested_data_, offset_, size_, size_};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
inline size_t size() const {
|
|
223
|
+
return size_;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// It is ugly to have both size() and Size(), but it is for compatitability with both STL and rest of the clickhouse-cpp.
|
|
227
|
+
inline size_t Size() const {
|
|
228
|
+
return size_;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
inline bool operator==(const ArrayValueView& other) const {
|
|
232
|
+
if (size() != other.size()) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
for (size_t i = 0; i < size_; ++i) {
|
|
236
|
+
if ((*this)[i] != other[i]) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
inline bool operator!=(const ArrayValueView& other) const {
|
|
244
|
+
return !(*this == other);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
inline auto At(size_t index) const {
|
|
249
|
+
if (index >= Size())
|
|
250
|
+
throw ValidationError("ColumnArray row index out of bounds: "
|
|
251
|
+
+ std::to_string(index) + ", max is " + std::to_string(Size()));
|
|
252
|
+
|
|
253
|
+
return ArrayValueView{typed_nested_data_, GetOffset(index), GetSize(index)};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
inline auto operator[](size_t index) const {
|
|
257
|
+
return ArrayValueView{typed_nested_data_, GetOffset(index), GetSize(index)};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
using ColumnArray::Append;
|
|
261
|
+
|
|
262
|
+
template <typename Container>
|
|
263
|
+
inline void Append(Container&& container) {
|
|
264
|
+
using container_type = decltype(container);
|
|
265
|
+
if constexpr (std::is_lvalue_reference_v<container_type> ||
|
|
266
|
+
std::is_const_v<std::remove_reference_t<container_type>>) {
|
|
267
|
+
Append(std::begin(container), std::end(container));
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
Append(std::make_move_iterator(std::begin(container)),
|
|
271
|
+
std::make_move_iterator(std::end(container)));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
template <typename ValueType>
|
|
276
|
+
inline void Append(const std::initializer_list<ValueType>& container) {
|
|
277
|
+
Append(std::begin(container), std::end(container));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
template <typename Begin, typename End>
|
|
281
|
+
inline void Append(Begin begin, End end) {
|
|
282
|
+
auto & nested_data = *typed_nested_data_;
|
|
283
|
+
size_t counter = 0;
|
|
284
|
+
|
|
285
|
+
while (begin != end) {
|
|
286
|
+
nested_data.Append(*begin);
|
|
287
|
+
++begin;
|
|
288
|
+
++counter;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Even if there are 0 items, increase counter, creating empty array item.
|
|
292
|
+
AddOffset(counter);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
ColumnRef Slice(size_t begin, size_t size) const override {
|
|
296
|
+
return Wrap(ColumnArray::Slice(begin, size));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
ColumnRef CloneEmpty() const override {
|
|
300
|
+
return Wrap(ColumnArray::CloneEmpty());
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
void Swap(Column& other) override {
|
|
304
|
+
auto & col = dynamic_cast<ColumnArrayT<NestedColumnType> &>(other);
|
|
305
|
+
typed_nested_data_.swap(col.typed_nested_data_);
|
|
306
|
+
ColumnArray::Swap(other);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
private:
|
|
310
|
+
/// Helper to allow wrapping a "typeless" ColumnArray
|
|
311
|
+
ColumnArrayT(ColumnArray&& array, std::shared_ptr<NestedColumnType> nested_data)
|
|
312
|
+
: ColumnArray(std::move(array))
|
|
313
|
+
, typed_nested_data_(std::move(nested_data))
|
|
314
|
+
{}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
private:
|
|
318
|
+
std::shared_ptr<NestedColumnType> typed_nested_data_;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#include "column.h"
|
|
2
|
+
|
|
3
|
+
namespace clickhouse {
|
|
4
|
+
|
|
5
|
+
bool Column::LoadPrefix(InputStream*, size_t) {
|
|
6
|
+
/// does nothing by default
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
bool Column::Load(InputStream* input, size_t rows) {
|
|
11
|
+
return LoadPrefix(input, rows) && LoadBody(input, rows);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
void Column::SavePrefix(OutputStream*) {
|
|
15
|
+
/// does nothing by default
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// Saves column data to output stream.
|
|
19
|
+
void Column::Save(OutputStream* output) {
|
|
20
|
+
SavePrefix(output);
|
|
21
|
+
SaveBody(output);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "../types/types.h"
|
|
4
|
+
#include "../columns/itemview.h"
|
|
5
|
+
#include "../exceptions.h"
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <stdexcept>
|
|
9
|
+
|
|
10
|
+
namespace clickhouse {
|
|
11
|
+
|
|
12
|
+
class InputStream;
|
|
13
|
+
class OutputStream;
|
|
14
|
+
|
|
15
|
+
using ColumnRef = std::shared_ptr<class Column>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An abstract base of all columns classes.
|
|
19
|
+
*/
|
|
20
|
+
class Column : public std::enable_shared_from_this<Column> {
|
|
21
|
+
public:
|
|
22
|
+
explicit inline Column(TypeRef type) : type_(type) {}
|
|
23
|
+
|
|
24
|
+
virtual ~Column() {}
|
|
25
|
+
|
|
26
|
+
/// Downcast pointer to the specific column's subtype.
|
|
27
|
+
template <typename T>
|
|
28
|
+
inline std::shared_ptr<T> As() {
|
|
29
|
+
return std::dynamic_pointer_cast<T>(shared_from_this());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// Downcast pointer to the specific column's subtype.
|
|
33
|
+
template <typename T>
|
|
34
|
+
inline std::shared_ptr<const T> As() const {
|
|
35
|
+
return std::dynamic_pointer_cast<const T>(shared_from_this());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Downcast pointer to the specific column's subtype.
|
|
39
|
+
template <typename T>
|
|
40
|
+
inline std::shared_ptr<T> AsStrict() {
|
|
41
|
+
auto result = std::dynamic_pointer_cast<T>(shared_from_this());
|
|
42
|
+
if (!result) {
|
|
43
|
+
throw ValidationError("Can't cast from " + type_->GetName());
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// Get type object of the column.
|
|
49
|
+
inline TypeRef Type() const { return type_; }
|
|
50
|
+
inline const class Type& GetType() const { return *type_; }
|
|
51
|
+
|
|
52
|
+
/// Appends content of given column to the end of current one.
|
|
53
|
+
virtual void Append(ColumnRef column) = 0;
|
|
54
|
+
|
|
55
|
+
/// Increase the capacity of the column for large block insertion.
|
|
56
|
+
virtual void Reserve(size_t new_cap) = 0;
|
|
57
|
+
|
|
58
|
+
/// Template method to load column data from input stream. It'll call LoadPrefix and LoadBody.
|
|
59
|
+
/// Should be called only once from the client. Derived classes should not call it.
|
|
60
|
+
bool Load(InputStream* input, size_t rows);
|
|
61
|
+
|
|
62
|
+
/// Loads column prefix from input stream.
|
|
63
|
+
virtual bool LoadPrefix(InputStream* input, size_t rows);
|
|
64
|
+
|
|
65
|
+
/// Loads column data from input stream.
|
|
66
|
+
virtual bool LoadBody(InputStream* input, size_t rows) = 0;
|
|
67
|
+
|
|
68
|
+
/// Saves column prefix to output stream. Column types with prefixes must implement it.
|
|
69
|
+
virtual void SavePrefix(OutputStream* output);
|
|
70
|
+
|
|
71
|
+
/// Saves column body to output stream.
|
|
72
|
+
virtual void SaveBody(OutputStream* output) = 0;
|
|
73
|
+
|
|
74
|
+
/// Template method to save to output stream. It'll call SavePrefix and SaveBody respectively
|
|
75
|
+
/// Should be called only once from the client. Derived classes should not call it.
|
|
76
|
+
/// Save is split in Prefix and Body because some data types require prefixes and specific serialization order.
|
|
77
|
+
/// For instance, Array(LowCardinality(X)) requires LowCardinality.key_version bytes to come before Array.offsets
|
|
78
|
+
void Save(OutputStream* output);
|
|
79
|
+
|
|
80
|
+
/// Clear column data .
|
|
81
|
+
virtual void Clear() = 0;
|
|
82
|
+
|
|
83
|
+
/// Returns count of rows in the column.
|
|
84
|
+
virtual size_t Size() const = 0;
|
|
85
|
+
|
|
86
|
+
/// Makes slice of the current column.
|
|
87
|
+
virtual ColumnRef Slice(size_t begin, size_t len) const = 0;
|
|
88
|
+
|
|
89
|
+
virtual ColumnRef CloneEmpty() const = 0;
|
|
90
|
+
|
|
91
|
+
virtual void Swap(Column&) = 0;
|
|
92
|
+
|
|
93
|
+
/// Get a view on raw item data if it is supported by column, will throw an exception if index is out of range.
|
|
94
|
+
/// Please note that view is invalidated once column items are added or deleted, column is loaded from strean or destroyed.
|
|
95
|
+
virtual ItemView GetItem(size_t) const {
|
|
96
|
+
throw UnimplementedError("GetItem() is not supported for column of " + type_->GetName());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
friend void swap(Column& left, Column& right) {
|
|
100
|
+
left.Swap(right);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
protected:
|
|
104
|
+
TypeRef type_;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
} // namespace clickhouse
|