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,484 @@
|
|
|
1
|
+
#include "types.h"
|
|
2
|
+
|
|
3
|
+
#include "../exceptions.h"
|
|
4
|
+
|
|
5
|
+
#include <city.h>
|
|
6
|
+
|
|
7
|
+
#include <stdexcept>
|
|
8
|
+
|
|
9
|
+
namespace clickhouse {
|
|
10
|
+
|
|
11
|
+
Type::Type(const Code code)
|
|
12
|
+
: code_(code)
|
|
13
|
+
, type_unique_id_(0)
|
|
14
|
+
{}
|
|
15
|
+
|
|
16
|
+
const char* Type::TypeName(Type::Code code) {
|
|
17
|
+
switch (code) {
|
|
18
|
+
case Type::Code::Void: return "Void";
|
|
19
|
+
case Type::Code::Int8: return "Int8";
|
|
20
|
+
case Type::Code::Int16: return "Int16";
|
|
21
|
+
case Type::Code::Int32: return "Int32";
|
|
22
|
+
case Type::Code::Int64: return "Int64";
|
|
23
|
+
case Type::Code::UInt8: return "UInt8";
|
|
24
|
+
case Type::Code::UInt16: return "UInt16";
|
|
25
|
+
case Type::Code::UInt32: return "UInt32";
|
|
26
|
+
case Type::Code::UInt64: return "UInt64";
|
|
27
|
+
case Type::Code::Float32: return "Float32";
|
|
28
|
+
case Type::Code::Float64: return "Float64";
|
|
29
|
+
case Type::Code::String: return "String";
|
|
30
|
+
case Type::Code::FixedString: return "FixedString";
|
|
31
|
+
case Type::Code::DateTime: return "DateTime";
|
|
32
|
+
case Type::Code::Date: return "Date";
|
|
33
|
+
case Type::Code::Array: return "Array";
|
|
34
|
+
case Type::Code::Nullable: return "Nullable";
|
|
35
|
+
case Type::Code::Tuple: return "Tuple";
|
|
36
|
+
case Type::Code::Enum8: return "Enum8";
|
|
37
|
+
case Type::Code::Enum16: return "Enum16";
|
|
38
|
+
case Type::Code::UUID: return "UUID";
|
|
39
|
+
case Type::Code::IPv4: return "IPv4";
|
|
40
|
+
case Type::Code::IPv6: return "IPv6";
|
|
41
|
+
case Type::Code::Int128: return "Int128";
|
|
42
|
+
case Type::Code::UInt128: return "UInt128";
|
|
43
|
+
case Type::Code::Decimal: return "Decimal";
|
|
44
|
+
case Type::Code::Decimal32: return "Decimal32";
|
|
45
|
+
case Type::Code::Decimal64: return "Decimal64";
|
|
46
|
+
case Type::Code::Decimal128: return "Decimal128";
|
|
47
|
+
case Type::Code::LowCardinality: return "LowCardinality";
|
|
48
|
+
case Type::Code::DateTime64: return "DateTime64";
|
|
49
|
+
case Type::Code::Date32: return "Date32";
|
|
50
|
+
case Type::Code::Map: return "Map";
|
|
51
|
+
case Type::Code::Point: return "Point";
|
|
52
|
+
case Type::Code::Ring: return "Ring";
|
|
53
|
+
case Type::Code::Polygon: return "Polygon";
|
|
54
|
+
case Type::Code::MultiPolygon: return "MultiPolygon";
|
|
55
|
+
case Type::Code::Time: return "Time";
|
|
56
|
+
case Type::Code::Time64: return "Time64";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return "Unknown type";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
std::string Type::GetName() const {
|
|
63
|
+
switch (code_) {
|
|
64
|
+
case Void:
|
|
65
|
+
case Int8:
|
|
66
|
+
case Int16:
|
|
67
|
+
case Int32:
|
|
68
|
+
case Int64:
|
|
69
|
+
case Int128:
|
|
70
|
+
case UInt8:
|
|
71
|
+
case UInt16:
|
|
72
|
+
case UInt32:
|
|
73
|
+
case UInt64:
|
|
74
|
+
case UInt128:
|
|
75
|
+
case UUID:
|
|
76
|
+
case Float32:
|
|
77
|
+
case Float64:
|
|
78
|
+
case String:
|
|
79
|
+
case IPv4:
|
|
80
|
+
case IPv6:
|
|
81
|
+
case Date:
|
|
82
|
+
case Date32:
|
|
83
|
+
case Time:
|
|
84
|
+
case Point:
|
|
85
|
+
case Ring:
|
|
86
|
+
case Polygon:
|
|
87
|
+
case MultiPolygon:
|
|
88
|
+
return TypeName(code_);
|
|
89
|
+
case Time64:
|
|
90
|
+
return As<Time64Type>()->GetName();
|
|
91
|
+
case FixedString:
|
|
92
|
+
return As<FixedStringType>()->GetName();
|
|
93
|
+
case DateTime:
|
|
94
|
+
return As<DateTimeType>()->GetName();
|
|
95
|
+
case DateTime64:
|
|
96
|
+
return As<DateTime64Type>()->GetName();
|
|
97
|
+
case Array:
|
|
98
|
+
return As<ArrayType>()->GetName();
|
|
99
|
+
case Nullable:
|
|
100
|
+
return As<NullableType>()->GetName();
|
|
101
|
+
case Tuple:
|
|
102
|
+
return As<TupleType>()->GetName();
|
|
103
|
+
case Enum8:
|
|
104
|
+
case Enum16:
|
|
105
|
+
return As<EnumType>()->GetName();
|
|
106
|
+
case Decimal:
|
|
107
|
+
case Decimal32:
|
|
108
|
+
case Decimal64:
|
|
109
|
+
case Decimal128:
|
|
110
|
+
return As<DecimalType>()->GetName();
|
|
111
|
+
case LowCardinality:
|
|
112
|
+
return As<LowCardinalityType>()->GetName();
|
|
113
|
+
case Map:
|
|
114
|
+
return As<MapType>()->GetName();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// XXX: NOT REACHED!
|
|
118
|
+
return std::string();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
uint64_t Type::GetTypeUniqueId() const {
|
|
122
|
+
// Helper method to optimize equality checks of types with Type::IsEqual(),
|
|
123
|
+
// base invariant: types with same names produce same unique id (and hence considered equal).
|
|
124
|
+
// As an optimization, full type name is constructed at most once, and only for complex types.
|
|
125
|
+
switch (code_) {
|
|
126
|
+
case Void:
|
|
127
|
+
case Int8:
|
|
128
|
+
case Int16:
|
|
129
|
+
case Int32:
|
|
130
|
+
case Int64:
|
|
131
|
+
case Int128:
|
|
132
|
+
case UInt8:
|
|
133
|
+
case UInt16:
|
|
134
|
+
case UInt32:
|
|
135
|
+
case UInt64:
|
|
136
|
+
case UInt128:
|
|
137
|
+
case UUID:
|
|
138
|
+
case Float32:
|
|
139
|
+
case Float64:
|
|
140
|
+
case String:
|
|
141
|
+
case IPv4:
|
|
142
|
+
case IPv6:
|
|
143
|
+
case Date:
|
|
144
|
+
case Date32:
|
|
145
|
+
case Point:
|
|
146
|
+
case Ring:
|
|
147
|
+
case Polygon:
|
|
148
|
+
case MultiPolygon:
|
|
149
|
+
// For simple types, unique ID is the same as Type::Code
|
|
150
|
+
return code_;
|
|
151
|
+
|
|
152
|
+
case FixedString:
|
|
153
|
+
case Time:
|
|
154
|
+
case Time64:
|
|
155
|
+
case DateTime:
|
|
156
|
+
case DateTime64:
|
|
157
|
+
case Array:
|
|
158
|
+
case Nullable:
|
|
159
|
+
case Tuple:
|
|
160
|
+
case Enum8:
|
|
161
|
+
case Enum16:
|
|
162
|
+
case Decimal:
|
|
163
|
+
case Decimal32:
|
|
164
|
+
case Decimal64:
|
|
165
|
+
case Decimal128:
|
|
166
|
+
case LowCardinality:
|
|
167
|
+
case Map: {
|
|
168
|
+
// For complex types, exact unique ID depends on nested types and/or parameters,
|
|
169
|
+
// the easiest way is to lazy-compute unique ID from name once.
|
|
170
|
+
// Here we do not care if multiple threads are computing value simultaneosly since it is both:
|
|
171
|
+
// 1. going to be the same
|
|
172
|
+
// 2. going to be stored atomically
|
|
173
|
+
|
|
174
|
+
if (type_unique_id_.load(std::memory_order_relaxed) == 0) {
|
|
175
|
+
const auto name = GetName();
|
|
176
|
+
type_unique_id_.store(CityHash64WithSeed(name.c_str(), name.size(), code_), std::memory_order_relaxed);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return type_unique_id_;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
assert(false);
|
|
183
|
+
return 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
TypeRef Type::CreateArray(TypeRef item_type) {
|
|
187
|
+
return TypeRef(new ArrayType(item_type));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
TypeRef Type::CreateDate() {
|
|
191
|
+
return TypeRef(new Type(Type::Date));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
TypeRef Type::CreateDate32() {
|
|
195
|
+
return TypeRef(new Type(Type::Date32));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
TypeRef Type::CreateTime() {
|
|
199
|
+
return TypeRef(new Type(Type::Time));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
TypeRef Type::CreateTime64(size_t precision) {
|
|
203
|
+
return TypeRef(new Time64Type(precision));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
TypeRef Type::CreateDateTime(std::string timezone) {
|
|
207
|
+
return TypeRef(new DateTimeType(std::move(timezone)));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
TypeRef Type::CreateDateTime64(size_t precision, std::string timezone) {
|
|
211
|
+
return TypeRef(new DateTime64Type(precision, std::move(timezone)));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
TypeRef Type::CreateDecimal(size_t precision, size_t scale) {
|
|
215
|
+
return TypeRef(new DecimalType(precision, scale));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
TypeRef Type::CreateIPv4() {
|
|
219
|
+
return TypeRef(new Type(Type::IPv4));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
TypeRef Type::CreateIPv6() {
|
|
223
|
+
return TypeRef(new Type(Type::IPv6));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
TypeRef Type::CreateNothing() {
|
|
227
|
+
return TypeRef(new Type(Type::Void));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
TypeRef Type::CreateNullable(TypeRef nested_type) {
|
|
231
|
+
return TypeRef(new NullableType(nested_type));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
TypeRef Type::CreateString() {
|
|
235
|
+
return TypeRef(new Type(Type::String));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
TypeRef Type::CreateString(size_t n) {
|
|
239
|
+
return TypeRef(new FixedStringType(n));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
TypeRef Type::CreateTuple(const std::vector<TypeRef>& item_types) {
|
|
243
|
+
return TypeRef(new TupleType(item_types));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
TypeRef Type::CreateEnum8(const std::vector<EnumItem>& enum_items) {
|
|
247
|
+
return TypeRef(new EnumType(Type::Enum8, enum_items));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
TypeRef Type::CreateEnum16(const std::vector<EnumItem>& enum_items) {
|
|
251
|
+
return TypeRef(new EnumType(Type::Enum16, enum_items));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
TypeRef Type::CreateUUID() {
|
|
255
|
+
return TypeRef(new Type(Type::UUID));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
TypeRef Type::CreateLowCardinality(TypeRef item_type) {
|
|
259
|
+
return std::make_shared<LowCardinalityType>(item_type);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
TypeRef Type::CreateMap(TypeRef key_type, TypeRef value_type) {
|
|
263
|
+
return std::make_shared<MapType>(key_type, value_type);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
TypeRef Type::CreatePoint() {
|
|
267
|
+
return TypeRef(new Type(Type::Point));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
TypeRef Type::CreateRing() {
|
|
271
|
+
return TypeRef(new Type(Type::Ring));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
TypeRef Type::CreatePolygon() {
|
|
275
|
+
return TypeRef(new Type(Type::Polygon));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
TypeRef Type::CreateMultiPolygon() {
|
|
279
|
+
return TypeRef(new Type(Type::MultiPolygon));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/// class ArrayType
|
|
283
|
+
|
|
284
|
+
ArrayType::ArrayType(TypeRef item_type) : Type(Array), item_type_(item_type) {
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/// class DecimalType
|
|
288
|
+
|
|
289
|
+
DecimalType::DecimalType(size_t precision, size_t scale)
|
|
290
|
+
: Type(Decimal),
|
|
291
|
+
precision_(precision),
|
|
292
|
+
scale_(scale) {
|
|
293
|
+
// TODO: assert(precision <= 38 && precision > 0);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
std::string DecimalType::GetName() const {
|
|
297
|
+
switch (GetCode()) {
|
|
298
|
+
case Decimal:
|
|
299
|
+
return "Decimal(" + std::to_string(precision_) + "," + std::to_string(scale_) + ")";
|
|
300
|
+
case Decimal32:
|
|
301
|
+
return "Decimal32(" + std::to_string(scale_) + ")";
|
|
302
|
+
case Decimal64:
|
|
303
|
+
return "Decimal64(" + std::to_string(scale_) + ")";
|
|
304
|
+
case Decimal128:
|
|
305
|
+
return "Decimal128(" + std::to_string(scale_) + ")";
|
|
306
|
+
default:
|
|
307
|
+
/// XXX: NOT REACHED!
|
|
308
|
+
return "";
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/// class EnumType
|
|
313
|
+
|
|
314
|
+
EnumType::EnumType(Type::Code type, const std::vector<EnumItem>& items) : Type(type) {
|
|
315
|
+
for (const auto& item : items) {
|
|
316
|
+
auto result = name_to_value_.insert(item);
|
|
317
|
+
value_to_name_[item.second] = result.first->first;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
std::string EnumType::GetName() const {
|
|
322
|
+
std::string result;
|
|
323
|
+
|
|
324
|
+
if (GetCode() == Enum8) {
|
|
325
|
+
result = "Enum8(";
|
|
326
|
+
} else {
|
|
327
|
+
result = "Enum16(";
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
for (auto ei = value_to_name_.begin(); ei != value_to_name_.end();) {
|
|
331
|
+
result += "'";
|
|
332
|
+
result += ei->second;
|
|
333
|
+
result += "' = ";
|
|
334
|
+
result += std::to_string(ei->first);
|
|
335
|
+
|
|
336
|
+
if (++ei != value_to_name_.end()) {
|
|
337
|
+
result += ", ";
|
|
338
|
+
} else {
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
result += ")";
|
|
344
|
+
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
std::string_view EnumType::GetEnumName(int16_t value) const {
|
|
349
|
+
return value_to_name_.at(value);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
int16_t EnumType::GetEnumValue(const std::string& name) const {
|
|
353
|
+
return name_to_value_.at(name);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
bool EnumType::HasEnumName(const std::string& name) const {
|
|
357
|
+
return name_to_value_.find(name) != name_to_value_.end();
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
bool EnumType::HasEnumValue(int16_t value) const {
|
|
361
|
+
return value_to_name_.find(value) != value_to_name_.end();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
EnumType::ValueToNameIterator EnumType::BeginValueToName() const {
|
|
365
|
+
return value_to_name_.begin();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
EnumType::ValueToNameIterator EnumType::EndValueToName() const {
|
|
369
|
+
return value_to_name_.end();
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
namespace details
|
|
374
|
+
{
|
|
375
|
+
TypeWithTimeZoneMixin::TypeWithTimeZoneMixin(std::string timezone)
|
|
376
|
+
: timezone_(std::move(timezone)) {
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const std::string & TypeWithTimeZoneMixin::Timezone() const {
|
|
380
|
+
return timezone_;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/// class Time64
|
|
385
|
+
Time64Type::Time64Type(size_t precision)
|
|
386
|
+
: Type(Time64), precision_{precision} {
|
|
387
|
+
if (precision_ > 9) {
|
|
388
|
+
throw ValidationError("Time64 precision is > 9");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
std::string Time64Type::GetName() const {
|
|
393
|
+
return "Time64(" + std::to_string(precision_) + ")";
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/// class DateTimeType
|
|
397
|
+
DateTimeType::DateTimeType(std::string timezone)
|
|
398
|
+
: Type(DateTime), details::TypeWithTimeZoneMixin(std::move(timezone)) {
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
std::string DateTimeType::GetName() const {
|
|
402
|
+
std::string datetime_representation = "DateTime";
|
|
403
|
+
const auto & timezone = Timezone();
|
|
404
|
+
if (!timezone.empty())
|
|
405
|
+
datetime_representation += "('" + timezone + "')";
|
|
406
|
+
|
|
407
|
+
return datetime_representation;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/// class DateTime64Type
|
|
411
|
+
|
|
412
|
+
DateTime64Type::DateTime64Type(size_t precision, std::string timezone)
|
|
413
|
+
: Type(DateTime64), details::TypeWithTimeZoneMixin(std::move(timezone)), precision_(precision) {
|
|
414
|
+
|
|
415
|
+
if (precision_ > 18) {
|
|
416
|
+
throw ValidationError("DateTime64 precision is > 18");
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
std::string DateTime64Type::GetName() const {
|
|
421
|
+
std::string datetime64_representation;
|
|
422
|
+
datetime64_representation.reserve(14);
|
|
423
|
+
datetime64_representation += "DateTime64(";
|
|
424
|
+
datetime64_representation += std::to_string(precision_);
|
|
425
|
+
|
|
426
|
+
const auto & timezone = Timezone();
|
|
427
|
+
if (!timezone.empty()) {
|
|
428
|
+
datetime64_representation += ", '" + timezone + "'";
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
datetime64_representation += ")";
|
|
432
|
+
return datetime64_representation;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/// class FixedStringType
|
|
436
|
+
|
|
437
|
+
FixedStringType::FixedStringType(size_t n) : Type(FixedString), size_(n) {
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/// class NullableType
|
|
441
|
+
|
|
442
|
+
NullableType::NullableType(TypeRef nested_type) : Type(Nullable), nested_type_(nested_type) {
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/// class TupleType
|
|
446
|
+
|
|
447
|
+
TupleType::TupleType(const std::vector<TypeRef>& item_types) : Type(Tuple), item_types_(item_types) {
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/// class LowCardinalityType
|
|
451
|
+
LowCardinalityType::LowCardinalityType(TypeRef nested_type) : Type(LowCardinality), nested_type_(nested_type) {
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
LowCardinalityType::~LowCardinalityType() {
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
std::string TupleType::GetName() const {
|
|
458
|
+
std::string result("Tuple(");
|
|
459
|
+
|
|
460
|
+
if (!item_types_.empty()) {
|
|
461
|
+
result += item_types_[0]->GetName();
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
for (size_t i = 1; i < item_types_.size(); ++i) {
|
|
465
|
+
result += ", " + item_types_[i]->GetName();
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
result += ")";
|
|
469
|
+
|
|
470
|
+
return result;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/// class MapType
|
|
474
|
+
MapType::MapType(TypeRef key_type, TypeRef value_type)
|
|
475
|
+
: Type(Map)
|
|
476
|
+
, key_type_(key_type)
|
|
477
|
+
, value_type_(value_type) {
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
std::string MapType::GetName() const {
|
|
481
|
+
return std::string("Map(") + key_type_->GetName() + ", " +value_type_->GetName() + ")";
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
} // namespace clickhouse
|