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,333 @@
|
|
|
1
|
+
#include "string.h"
|
|
2
|
+
#include "utils.h"
|
|
3
|
+
|
|
4
|
+
#include "../base/wire_format.h"
|
|
5
|
+
|
|
6
|
+
namespace {
|
|
7
|
+
|
|
8
|
+
constexpr size_t DEFAULT_BLOCK_SIZE = 4096;
|
|
9
|
+
|
|
10
|
+
template <typename Container>
|
|
11
|
+
size_t ComputeTotalSize(const Container & strings, size_t begin = 0, size_t len = -1) {
|
|
12
|
+
size_t result = 0;
|
|
13
|
+
if (begin < strings.size()) {
|
|
14
|
+
len = std::min(len, strings.size() - begin);
|
|
15
|
+
|
|
16
|
+
for (size_t i = begin; i < begin + len; ++i)
|
|
17
|
+
result += strings[i].size();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
namespace clickhouse {
|
|
26
|
+
|
|
27
|
+
ColumnFixedString::ColumnFixedString(size_t n)
|
|
28
|
+
: Column(Type::CreateString(n))
|
|
29
|
+
, string_size_(n)
|
|
30
|
+
{
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void ColumnFixedString::Reserve(size_t new_cap) {
|
|
34
|
+
data_.reserve(string_size_ * new_cap);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void ColumnFixedString::Append(std::string_view str) {
|
|
38
|
+
if (str.size() > string_size_) {
|
|
39
|
+
throw ValidationError("Expected string of length not greater than "
|
|
40
|
+
+ std::to_string(string_size_) + " bytes, received "
|
|
41
|
+
+ std::to_string(str.size()) + " bytes.");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (data_.capacity() - data_.size() < str.size()) {
|
|
45
|
+
// round up to the next block size
|
|
46
|
+
const auto new_size = (((data_.size() + string_size_) / DEFAULT_BLOCK_SIZE) + 1) * DEFAULT_BLOCK_SIZE;
|
|
47
|
+
data_.reserve(new_size);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
data_.insert(data_.size(), str);
|
|
51
|
+
// Pad up to string_size_ with zeroes.
|
|
52
|
+
if (str.size() < string_size_) {
|
|
53
|
+
const auto padding_size = string_size_ - str.size();
|
|
54
|
+
data_.resize(data_.size() + padding_size, char(0));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void ColumnFixedString::Clear() {
|
|
59
|
+
data_.clear();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
std::string_view ColumnFixedString::At(size_t n) const {
|
|
63
|
+
const auto pos = n * string_size_;
|
|
64
|
+
return std::string_view(&data_.at(pos), string_size_);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
size_t ColumnFixedString::FixedSize() const {
|
|
68
|
+
return string_size_;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
void ColumnFixedString::Append(ColumnRef column) {
|
|
72
|
+
if (auto col = column->As<ColumnFixedString>()) {
|
|
73
|
+
if (string_size_ == col->string_size_) {
|
|
74
|
+
data_.insert(data_.end(), col->data_.begin(), col->data_.end());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
bool ColumnFixedString::LoadBody(InputStream * input, size_t rows) {
|
|
80
|
+
data_.resize(string_size_ * rows);
|
|
81
|
+
if (!WireFormat::ReadBytes(*input, &data_[0], data_.size())) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void ColumnFixedString::SaveBody(OutputStream* output) {
|
|
89
|
+
WireFormat::WriteBytes(*output, data_.data(), data_.size());
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
size_t ColumnFixedString::Size() const {
|
|
93
|
+
return data_.size() / string_size_;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
ColumnRef ColumnFixedString::Slice(size_t begin, size_t len) const {
|
|
97
|
+
auto result = std::make_shared<ColumnFixedString>(string_size_);
|
|
98
|
+
|
|
99
|
+
if (begin < Size()) {
|
|
100
|
+
const auto b = begin * string_size_;
|
|
101
|
+
const auto l = len * string_size_;
|
|
102
|
+
result->data_ = data_.substr(b, std::min(data_.size() - b, l));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
ColumnRef ColumnFixedString::CloneEmpty() const {
|
|
109
|
+
return std::make_shared<ColumnFixedString>(string_size_);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
void ColumnFixedString::Swap(Column& other) {
|
|
113
|
+
auto & col = dynamic_cast<ColumnFixedString &>(other);
|
|
114
|
+
std::swap(string_size_, col.string_size_);
|
|
115
|
+
data_.swap(col.data_);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
ItemView ColumnFixedString::GetItem(size_t index) const {
|
|
119
|
+
return ItemView{Type::FixedString, this->At(index)};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
struct ColumnString::Block
|
|
123
|
+
{
|
|
124
|
+
using CharT = typename std::string::value_type;
|
|
125
|
+
|
|
126
|
+
explicit Block(size_t starting_capacity)
|
|
127
|
+
: size(0),
|
|
128
|
+
capacity(starting_capacity),
|
|
129
|
+
data_(new CharT[capacity])
|
|
130
|
+
{}
|
|
131
|
+
|
|
132
|
+
inline auto GetAvailable() const {
|
|
133
|
+
return capacity - size;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
std::string_view AppendUnsafe(std::string_view str) {
|
|
137
|
+
const auto pos = &data_[size];
|
|
138
|
+
|
|
139
|
+
memcpy(pos, str.data(), str.size());
|
|
140
|
+
size += str.size();
|
|
141
|
+
|
|
142
|
+
return std::string_view(pos, str.size());
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
auto GetCurrentWritePos() {
|
|
146
|
+
return &data_[size];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
std::string_view ConsumeTailAsStringViewUnsafe(size_t len) {
|
|
150
|
+
const auto start = &data_[size];
|
|
151
|
+
size += len;
|
|
152
|
+
return std::string_view(start, len);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
size_t size;
|
|
156
|
+
const size_t capacity;
|
|
157
|
+
std::unique_ptr<CharT[]> data_;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
ColumnString::ColumnString()
|
|
161
|
+
: Column(Type::CreateString())
|
|
162
|
+
{
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
ColumnString::ColumnString(size_t element_count)
|
|
166
|
+
: Column(Type::CreateString())
|
|
167
|
+
{
|
|
168
|
+
items_.reserve(element_count);
|
|
169
|
+
// 16 is arbitrary number, assumption that string values are about ~256 bytes long.
|
|
170
|
+
blocks_.reserve(std::max<size_t>(1, element_count / 16));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
ColumnString::ColumnString(const std::vector<std::string>& data)
|
|
174
|
+
: ColumnString()
|
|
175
|
+
{
|
|
176
|
+
items_.reserve(data.size());
|
|
177
|
+
blocks_.emplace_back(ComputeTotalSize(data));
|
|
178
|
+
|
|
179
|
+
for (const auto & s : data) {
|
|
180
|
+
AppendUnsafe(s);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
ColumnString::ColumnString(std::vector<std::string>&& data)
|
|
185
|
+
: ColumnString()
|
|
186
|
+
{
|
|
187
|
+
items_.reserve(data.size());
|
|
188
|
+
|
|
189
|
+
for (auto&& d : data) {
|
|
190
|
+
append_data_.emplace_back(std::move(d));
|
|
191
|
+
auto& last_data = append_data_.back();
|
|
192
|
+
items_.emplace_back(std::string_view{ last_data.data(),last_data.length() });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
ColumnString::~ColumnString()
|
|
197
|
+
{}
|
|
198
|
+
|
|
199
|
+
void ColumnString::Reserve(size_t new_cap) {
|
|
200
|
+
items_.reserve(new_cap);
|
|
201
|
+
// 16 is arbitrary number, assumption that string values are about ~256 bytes long.
|
|
202
|
+
blocks_.reserve(std::max<size_t>(1, new_cap / 16));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
void ColumnString::Append(std::string_view str) {
|
|
206
|
+
if (blocks_.size() == 0 || blocks_.back().GetAvailable() < str.length()) {
|
|
207
|
+
blocks_.emplace_back(std::max(DEFAULT_BLOCK_SIZE, str.size()));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
items_.emplace_back(blocks_.back().AppendUnsafe(str));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
void ColumnString::Append(const char* str) {
|
|
214
|
+
Append(std::string_view(str, strlen(str)));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
void ColumnString::Append(std::string&& steal_value) {
|
|
218
|
+
append_data_.emplace_back(std::move(steal_value));
|
|
219
|
+
auto& last_data = append_data_.back();
|
|
220
|
+
items_.emplace_back(std::string_view{ last_data.data(),last_data.length() });
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
void ColumnString::AppendNoManagedLifetime(std::string_view str) {
|
|
224
|
+
items_.emplace_back(str);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
void ColumnString::AppendUnsafe(std::string_view str) {
|
|
228
|
+
items_.emplace_back(blocks_.back().AppendUnsafe(str));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
void ColumnString::Clear() {
|
|
232
|
+
items_.clear();
|
|
233
|
+
blocks_.clear();
|
|
234
|
+
append_data_.clear();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
std::string_view ColumnString::At(size_t n) const {
|
|
238
|
+
return items_.at(n);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
void ColumnString::Append(ColumnRef column) {
|
|
242
|
+
if (auto col = column->As<ColumnString>()) {
|
|
243
|
+
const auto total_size = ComputeTotalSize(col->items_);
|
|
244
|
+
|
|
245
|
+
// TODO: fill up existing block with some items and then add a new one for the rest of items
|
|
246
|
+
if (blocks_.size() == 0 || blocks_.back().GetAvailable() < total_size)
|
|
247
|
+
blocks_.emplace_back(std::max(DEFAULT_BLOCK_SIZE, total_size));
|
|
248
|
+
|
|
249
|
+
// Intentionally not doing items_.reserve() since that cripples performance.
|
|
250
|
+
for (size_t i = 0; i < column->Size(); ++i) {
|
|
251
|
+
this->AppendUnsafe((*col)[i]);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
bool ColumnString::LoadBody(InputStream* input, size_t rows) {
|
|
257
|
+
if (rows == 0) {
|
|
258
|
+
items_.clear();
|
|
259
|
+
blocks_.clear();
|
|
260
|
+
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
decltype(items_) new_items;
|
|
265
|
+
decltype(blocks_) new_blocks;
|
|
266
|
+
|
|
267
|
+
new_items.reserve(rows);
|
|
268
|
+
|
|
269
|
+
// Suboptimzal if the first row string is >DEFAULT_BLOCK_SIZE, but that must be a very rare case.
|
|
270
|
+
Block * block = &new_blocks.emplace_back(DEFAULT_BLOCK_SIZE);
|
|
271
|
+
|
|
272
|
+
for (size_t i = 0; i < rows; ++i) {
|
|
273
|
+
uint64_t len;
|
|
274
|
+
if (!WireFormat::ReadUInt64(*input, &len))
|
|
275
|
+
return false;
|
|
276
|
+
|
|
277
|
+
if (len > block->GetAvailable())
|
|
278
|
+
block = &new_blocks.emplace_back(std::max<size_t>(DEFAULT_BLOCK_SIZE, len));
|
|
279
|
+
|
|
280
|
+
if (!WireFormat::ReadBytes(*input, block->GetCurrentWritePos(), len))
|
|
281
|
+
return false;
|
|
282
|
+
|
|
283
|
+
new_items.emplace_back(block->ConsumeTailAsStringViewUnsafe(len));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
items_.swap(new_items);
|
|
287
|
+
blocks_.swap(new_blocks);
|
|
288
|
+
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
void ColumnString::SaveBody(OutputStream* output) {
|
|
293
|
+
for (const auto & item : items_) {
|
|
294
|
+
WireFormat::WriteString(*output, item);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
size_t ColumnString::Size() const {
|
|
299
|
+
return items_.size();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
ColumnRef ColumnString::Slice(size_t begin, size_t len) const {
|
|
303
|
+
auto result = std::make_shared<ColumnString>();
|
|
304
|
+
|
|
305
|
+
if (begin < items_.size()) {
|
|
306
|
+
len = std::min(len, items_.size() - begin);
|
|
307
|
+
result->items_.reserve(len);
|
|
308
|
+
|
|
309
|
+
result->blocks_.emplace_back(ComputeTotalSize(items_, begin, len));
|
|
310
|
+
for (size_t i = begin; i < begin + len; ++i) {
|
|
311
|
+
result->Append(items_[i]);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return result;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
ColumnRef ColumnString::CloneEmpty() const {
|
|
319
|
+
return std::make_shared<ColumnString>();
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
void ColumnString::Swap(Column& other) {
|
|
323
|
+
auto & col = dynamic_cast<ColumnString &>(other);
|
|
324
|
+
items_.swap(col.items_);
|
|
325
|
+
blocks_.swap(col.blocks_);
|
|
326
|
+
append_data_.swap(col.append_data_);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
ItemView ColumnString::GetItem(size_t index) const {
|
|
330
|
+
return ItemView{Type::String, this->At(index)};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "column.h"
|
|
4
|
+
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <string_view>
|
|
7
|
+
#include <utility>
|
|
8
|
+
#include <vector>
|
|
9
|
+
#include <deque>
|
|
10
|
+
|
|
11
|
+
namespace clickhouse {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents column of fixed-length strings.
|
|
15
|
+
*/
|
|
16
|
+
class ColumnFixedString : public Column {
|
|
17
|
+
public:
|
|
18
|
+
using ValueType = std::string_view;
|
|
19
|
+
|
|
20
|
+
explicit ColumnFixedString(size_t n);
|
|
21
|
+
|
|
22
|
+
template <typename Values>
|
|
23
|
+
ColumnFixedString(size_t n, const Values & values)
|
|
24
|
+
: ColumnFixedString(n)
|
|
25
|
+
{
|
|
26
|
+
for (const auto & v : values)
|
|
27
|
+
Append(v);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Increase the capacity of the column for large block insertion.
|
|
31
|
+
void Reserve(size_t) override;
|
|
32
|
+
|
|
33
|
+
/// Appends one element to the column.
|
|
34
|
+
void Append(std::string_view str);
|
|
35
|
+
|
|
36
|
+
/// Returns element at given row number.
|
|
37
|
+
std::string_view At(size_t n) const;
|
|
38
|
+
|
|
39
|
+
/// Returns element at given row number.
|
|
40
|
+
inline std::string_view operator [] (size_t n) const { return At(n); }
|
|
41
|
+
|
|
42
|
+
/// Returns the max size of the fixed string
|
|
43
|
+
size_t FixedSize() const;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
/// Appends content of given column to the end of current one.
|
|
47
|
+
void Append(ColumnRef column) override;
|
|
48
|
+
|
|
49
|
+
/// Loads column data from input stream.
|
|
50
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
51
|
+
|
|
52
|
+
/// Saves column data to output stream.
|
|
53
|
+
void SaveBody(OutputStream* output) override;
|
|
54
|
+
|
|
55
|
+
/// Clear column data .
|
|
56
|
+
void Clear() override;
|
|
57
|
+
|
|
58
|
+
/// Returns count of rows in the column.
|
|
59
|
+
size_t Size() const override;
|
|
60
|
+
|
|
61
|
+
/// Makes slice of the current column.
|
|
62
|
+
ColumnRef Slice(size_t begin, size_t len) const override;
|
|
63
|
+
ColumnRef CloneEmpty() const override;
|
|
64
|
+
void Swap(Column& other) override;
|
|
65
|
+
|
|
66
|
+
ItemView GetItem(size_t) const override;
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
size_t string_size_;
|
|
70
|
+
std::string data_;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Represents column of variable-length strings.
|
|
75
|
+
*/
|
|
76
|
+
class ColumnString : public Column {
|
|
77
|
+
public:
|
|
78
|
+
// Type this column takes as argument of Append and returns with At() and operator[]
|
|
79
|
+
using ValueType = std::string_view;
|
|
80
|
+
|
|
81
|
+
ColumnString();
|
|
82
|
+
~ColumnString();
|
|
83
|
+
|
|
84
|
+
explicit ColumnString(size_t element_count);
|
|
85
|
+
explicit ColumnString(const std::vector<std::string> & data);
|
|
86
|
+
explicit ColumnString(std::vector<std::string>&& data);
|
|
87
|
+
ColumnString& operator=(const ColumnString&) = delete;
|
|
88
|
+
ColumnString(const ColumnString&) = delete;
|
|
89
|
+
|
|
90
|
+
/// Increase the capacity of the column for large block insertion.
|
|
91
|
+
void Reserve(size_t new_cap) override;
|
|
92
|
+
|
|
93
|
+
/// Appends one element to the column.
|
|
94
|
+
void Append(std::string_view str);
|
|
95
|
+
|
|
96
|
+
/// Appends one element to the column.
|
|
97
|
+
void Append(const char* str);
|
|
98
|
+
|
|
99
|
+
/// Appends one element to the column.
|
|
100
|
+
void Append(std::string&& steal_value);
|
|
101
|
+
|
|
102
|
+
/// Appends one element to the column.
|
|
103
|
+
/// If str lifetime is managed elsewhere and guaranteed to outlive the Block sent to the server
|
|
104
|
+
void AppendNoManagedLifetime(std::string_view str);
|
|
105
|
+
|
|
106
|
+
/// Returns element at given row number.
|
|
107
|
+
std::string_view At(size_t n) const;
|
|
108
|
+
|
|
109
|
+
/// Returns element at given row number.
|
|
110
|
+
inline std::string_view operator [] (size_t n) const { return At(n); }
|
|
111
|
+
|
|
112
|
+
public:
|
|
113
|
+
/// Appends content of given column to the end of current one.
|
|
114
|
+
void Append(ColumnRef column) override;
|
|
115
|
+
|
|
116
|
+
/// Loads column data from input stream.
|
|
117
|
+
bool LoadBody(InputStream* input, size_t rows) override;
|
|
118
|
+
|
|
119
|
+
/// Saves column data to output stream.
|
|
120
|
+
void SaveBody(OutputStream* output) override;
|
|
121
|
+
|
|
122
|
+
/// Clear column data .
|
|
123
|
+
void Clear() override;
|
|
124
|
+
|
|
125
|
+
/// Returns count of rows in the column.
|
|
126
|
+
size_t Size() const override;
|
|
127
|
+
|
|
128
|
+
/// Makes slice of the current column.
|
|
129
|
+
ColumnRef Slice(size_t begin, size_t len) const override;
|
|
130
|
+
ColumnRef CloneEmpty() const override;
|
|
131
|
+
void Swap(Column& other) override;
|
|
132
|
+
ItemView GetItem(size_t) const override;
|
|
133
|
+
|
|
134
|
+
private:
|
|
135
|
+
void AppendUnsafe(std::string_view);
|
|
136
|
+
|
|
137
|
+
private:
|
|
138
|
+
struct Block;
|
|
139
|
+
|
|
140
|
+
std::vector<std::string_view> items_;
|
|
141
|
+
std::vector<Block> blocks_;
|
|
142
|
+
std::deque<std::string> append_data_;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#include "time.h"
|
|
2
|
+
|
|
3
|
+
namespace clickhouse {
|
|
4
|
+
|
|
5
|
+
ColumnTime::ColumnTime()
|
|
6
|
+
: ColumnTime(Type::CreateTime(), std::make_shared<ColumnInt32>()) {}
|
|
7
|
+
|
|
8
|
+
ColumnTime::ColumnTime(std::vector<int32_t>&& data)
|
|
9
|
+
: ColumnTime(Type::CreateTime(), std::make_shared<ColumnInt32>(std::move(data))) {}
|
|
10
|
+
|
|
11
|
+
ColumnTime::ColumnTime(TypeRef type, std::shared_ptr<ColumnInt32> data)
|
|
12
|
+
: Column(std::move(type)),
|
|
13
|
+
data_(std::move(data))
|
|
14
|
+
{}
|
|
15
|
+
|
|
16
|
+
void ColumnTime::Append(ValueType value) {
|
|
17
|
+
data_->Append(value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ColumnTime::ValueType ColumnTime::At(size_t n) const {
|
|
21
|
+
return data_->At(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
std::vector<int32_t>& ColumnTime::GetWritableData() {
|
|
25
|
+
return data_->GetWritableData();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void ColumnTime::Reserve(size_t new_cap) {
|
|
29
|
+
data_->Reserve(new_cap);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
size_t ColumnTime::Capacity() const {
|
|
33
|
+
return data_->Capacity();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void ColumnTime::Append(ColumnRef column) {
|
|
37
|
+
if (auto col = column->As<ColumnTime>()) {
|
|
38
|
+
data_->Append(col->data_);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
bool ColumnTime::LoadBody(InputStream* input, size_t rows) {
|
|
43
|
+
return data_->LoadBody(input, rows);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
void ColumnTime::Clear() {
|
|
47
|
+
data_->Clear();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void ColumnTime::SaveBody(OutputStream* output) {
|
|
51
|
+
data_->SaveBody(output);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
size_t ColumnTime::Size() const {
|
|
55
|
+
return data_->Size();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ColumnRef ColumnTime::Slice(size_t begin, size_t len) const {
|
|
59
|
+
auto sliced_data = data_->Slice(begin, len)->As<ColumnInt32>();
|
|
60
|
+
return ColumnRef{new ColumnTime(type_, sliced_data)};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ColumnRef ColumnTime::CloneEmpty() const {
|
|
64
|
+
return ColumnRef{new ColumnTime(type_, data_->CloneEmpty()->As<ColumnInt32>())};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void ColumnTime::Swap(Column& other) {
|
|
68
|
+
auto & col = dynamic_cast<ColumnTime &>(other);
|
|
69
|
+
data_.swap(col.data_);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ItemView ColumnTime::GetItem(size_t index) const {
|
|
73
|
+
return ItemView{Type::Time, data_->GetItem(index)};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
ColumnTime64::ColumnTime64(size_t precision)
|
|
77
|
+
: ColumnTime64(Type::CreateTime64(precision), std::make_shared<ColumnInt64>())
|
|
78
|
+
{}
|
|
79
|
+
|
|
80
|
+
ColumnTime64::ColumnTime64(size_t precision, std::vector<int64_t>&& data)
|
|
81
|
+
: ColumnTime64(Type::CreateTime64(precision), std::make_shared<ColumnInt64>(std::move(data)))
|
|
82
|
+
{}
|
|
83
|
+
|
|
84
|
+
ColumnTime64::ColumnTime64(TypeRef type, std::shared_ptr<ColumnInt64> data)
|
|
85
|
+
: Column(std::move(type)),
|
|
86
|
+
data_(std::move(data)),
|
|
87
|
+
precision_{type_->As<Time64Type>()->GetPrecision()}
|
|
88
|
+
{}
|
|
89
|
+
|
|
90
|
+
void ColumnTime64::Append(ValueType value) {
|
|
91
|
+
data_->Append(value);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ColumnTime64::ValueType ColumnTime64::At(size_t n) const {
|
|
95
|
+
return data_->At(n);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
std::vector<int64_t>& ColumnTime64::GetWritableData() {
|
|
99
|
+
return data_->GetWritableData();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void ColumnTime64::Reserve(size_t new_cap) {
|
|
103
|
+
data_->Reserve(new_cap);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
size_t ColumnTime64::Capacity() const {
|
|
107
|
+
return data_->Capacity();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
void ColumnTime64::Append(ColumnRef column) {
|
|
111
|
+
if (auto col = column->As<ColumnTime64>()) {
|
|
112
|
+
data_->Append(col->data_);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
bool ColumnTime64::LoadBody(InputStream* input, size_t rows) {
|
|
117
|
+
return data_->LoadBody(input, rows);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
void ColumnTime64::Clear() {
|
|
121
|
+
data_->Clear();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
void ColumnTime64::SaveBody(OutputStream* output) {
|
|
125
|
+
data_->SaveBody(output);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
size_t ColumnTime64::Size() const {
|
|
129
|
+
return data_->Size();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
ColumnRef ColumnTime64::Slice(size_t begin, size_t len) const {
|
|
133
|
+
auto sliced_data = data_->Slice(begin, len)->As<ColumnInt64>();
|
|
134
|
+
return ColumnRef{new ColumnTime64(type_, sliced_data)};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
ColumnRef ColumnTime64::CloneEmpty() const {
|
|
138
|
+
return ColumnRef{new ColumnTime64(type_, data_->CloneEmpty()->As<ColumnInt64>())};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
void ColumnTime64::Swap(Column& other) {
|
|
142
|
+
auto & col = dynamic_cast<ColumnTime64 &>(other);
|
|
143
|
+
if (col.GetPrecision() != GetPrecision()) {
|
|
144
|
+
throw ValidationError("Can't swap Time64 columns when precisions are not the same: "
|
|
145
|
+
+ std::to_string(GetPrecision()) + "(this) != "
|
|
146
|
+
+ std::to_string(col.GetPrecision()) + "(that)");
|
|
147
|
+
}
|
|
148
|
+
data_.swap(col.data_);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
ItemView ColumnTime64::GetItem(size_t index) const {
|
|
152
|
+
return ItemView{Type::Time64, data_->GetItem(index)};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
} // namespace clickhouse
|