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.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/ext/clickhouse_native/client.cpp +847 -0
  3. data/ext/clickhouse_native/extconf.rb +101 -0
  4. data/ext/clickhouse_native/vendor/clickhouse-cpp/.clang-format +11 -0
  5. data/ext/clickhouse_native/vendor/clickhouse-cpp/.git +1 -0
  6. data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitattributes +63 -0
  7. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/CODEOWNERS +1 -0
  8. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/linux.yml +139 -0
  9. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/macos.yml +87 -0
  10. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_mingw.yml +102 -0
  11. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_msvc.yml +74 -0
  12. data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitignore +280 -0
  13. data/ext/clickhouse_native/vendor/clickhouse-cpp/.travis.yml +62 -0
  14. data/ext/clickhouse_native/vendor/clickhouse-cpp/CMakeLists.txt +157 -0
  15. data/ext/clickhouse_native/vendor/clickhouse-cpp/LICENSE +206 -0
  16. data/ext/clickhouse_native/vendor/clickhouse-cpp/README.md +260 -0
  17. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/CMakeLists.txt +246 -0
  18. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/buffer.h +10 -0
  19. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.cpp +258 -0
  20. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.h +48 -0
  21. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.cpp +20 -0
  22. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.h +34 -0
  23. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.cpp +96 -0
  24. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.h +103 -0
  25. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/open_telemetry.h +23 -0
  26. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.cpp +119 -0
  27. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.h +142 -0
  28. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.cpp +1 -0
  29. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.h +33 -0
  30. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/projected_iterator.h +55 -0
  31. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/singleton.h +11 -0
  32. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.cpp +489 -0
  33. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.h +177 -0
  34. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.cpp +307 -0
  35. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.h +111 -0
  36. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_utils.h +28 -0
  37. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_view.h +142 -0
  38. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/uuid.h +10 -0
  39. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.cpp +177 -0
  40. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.h +79 -0
  41. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.cpp +134 -0
  42. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.h +114 -0
  43. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.cpp +1269 -0
  44. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.h +320 -0
  45. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.cpp +175 -0
  46. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.h +321 -0
  47. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.cpp +24 -0
  48. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.h +107 -0
  49. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.cpp +365 -0
  50. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.h +245 -0
  51. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.cpp +255 -0
  52. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.h +50 -0
  53. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.cpp +123 -0
  54. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.h +65 -0
  55. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.cpp +285 -0
  56. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.h +14 -0
  57. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.cpp +108 -0
  58. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.h +79 -0
  59. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.cpp +117 -0
  60. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.h +71 -0
  61. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.cpp +108 -0
  62. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.h +66 -0
  63. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.cpp +101 -0
  64. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.h +86 -0
  65. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.cpp +527 -0
  66. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.h +221 -0
  67. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinalityadaptor.h +63 -0
  68. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.cpp +87 -0
  69. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.h +257 -0
  70. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nothing.h +87 -0
  71. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.cpp +109 -0
  72. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.h +153 -0
  73. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.cpp +126 -0
  74. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.h +88 -0
  75. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.cpp +333 -0
  76. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.h +145 -0
  77. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.cpp +155 -0
  78. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.h +118 -0
  79. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.cpp +106 -0
  80. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.h +178 -0
  81. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/utils.h +41 -0
  82. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.cpp +80 -0
  83. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.h +58 -0
  84. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/error_codes.h +595 -0
  85. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/exceptions.h +66 -0
  86. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/protocol.h +54 -0
  87. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.cpp +25 -0
  88. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.h +246 -0
  89. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/server_exception.h +16 -0
  90. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.cpp +314 -0
  91. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.h +89 -0
  92. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.cpp +484 -0
  93. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.h +397 -0
  94. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/version.h +14 -0
  95. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findcityhash.cmake +26 -0
  96. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findlz4.cmake +39 -0
  97. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findzstd.cmake +39 -0
  98. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/cpp17.cmake +8 -0
  99. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/openssl.cmake +8 -0
  100. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/subdirs.cmake +5 -0
  101. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/version.cmake +87 -0
  102. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/CMakeLists.txt +9 -0
  103. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/attributes.h +682 -0
  104. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/config.h +714 -0
  105. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/internal/bits.h +219 -0
  106. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/macros.h +147 -0
  107. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/optimization.h +241 -0
  108. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/options.h +238 -0
  109. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/policy_checks.h +111 -0
  110. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/port.h +26 -0
  111. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.cc +390 -0
  112. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.h +1092 -0
  113. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_have_intrinsic.inc +302 -0
  114. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_no_intrinsic.inc +308 -0
  115. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/BUCK +13 -0
  116. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/CMakeLists.txt +7 -0
  117. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/COPYING +19 -0
  118. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.cc +469 -0
  119. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.h +90 -0
  120. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/citycrc.h +43 -0
  121. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/config.h +118 -0
  122. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/BUCK +14 -0
  123. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/CMakeLists.txt +4 -0
  124. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/LICENSE +28 -0
  125. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/README.md +1 -0
  126. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-death-test.h +346 -0
  127. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-matchers.h +930 -0
  128. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-message.h +219 -0
  129. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-param-test.h +507 -0
  130. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-printers.h +1029 -0
  131. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-spi.h +238 -0
  132. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-test-part.h +184 -0
  133. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-typed-test.h +329 -0
  134. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest.h +2495 -0
  135. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_pred_impl.h +359 -0
  136. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_prod.h +61 -0
  137. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/README.md +56 -0
  138. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-port.h +37 -0
  139. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-printers.h +42 -0
  140. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest.h +37 -0
  141. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-death-test-internal.h +304 -0
  142. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-filepath.h +211 -0
  143. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-internal.h +1560 -0
  144. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-param-util.h +947 -0
  145. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port-arch.h +114 -0
  146. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port.h +2389 -0
  147. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-string.h +175 -0
  148. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-type-util.h +183 -0
  149. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-all.cc +48 -0
  150. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-death-test.cc +1644 -0
  151. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-filepath.cc +369 -0
  152. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-internal-inl.h +1221 -0
  153. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-matchers.cc +97 -0
  154. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-port.cc +1433 -0
  155. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-printers.cc +533 -0
  156. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-test-part.cc +108 -0
  157. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-typed-test.cc +107 -0
  158. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest.cc +6746 -0
  159. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest_main.cc +54 -0
  160. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/BUCK +13 -0
  161. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/CMakeLists.txt +8 -0
  162. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/LICENSE +24 -0
  163. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.c +2402 -0
  164. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.h +764 -0
  165. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.c +1554 -0
  166. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.h +438 -0
  167. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/BUCK +232 -0
  168. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/CMakeLists.txt +115 -0
  169. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/LICENSE +30 -0
  170. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/allocations.h +55 -0
  171. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bits.h +200 -0
  172. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bitstream.h +437 -0
  173. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/compiler.h +358 -0
  174. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/cpu.h +213 -0
  175. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.c +24 -0
  176. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.h +107 -0
  177. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/entropy_common.c +340 -0
  178. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.c +63 -0
  179. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.h +159 -0
  180. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse.h +639 -0
  181. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse_decompress.c +311 -0
  182. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/huf.h +273 -0
  183. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/mem.h +435 -0
  184. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.c +371 -0
  185. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.h +90 -0
  186. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/portability_macros.h +156 -0
  187. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.c +176 -0
  188. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.h +150 -0
  189. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.c +24 -0
  190. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.h +5686 -0
  191. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_common.c +48 -0
  192. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_deps.h +111 -0
  193. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_internal.h +392 -0
  194. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_trace.h +163 -0
  195. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/clevels.h +134 -0
  196. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/fse_compress.c +624 -0
  197. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.c +181 -0
  198. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.h +75 -0
  199. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/huf_compress.c +1435 -0
  200. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress.c +7032 -0
  201. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_internal.h +1532 -0
  202. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.c +235 -0
  203. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.h +39 -0
  204. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.c +442 -0
  205. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.h +54 -0
  206. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.c +577 -0
  207. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.h +32 -0
  208. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_cwksp.h +742 -0
  209. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.c +758 -0
  210. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.h +39 -0
  211. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.c +960 -0
  212. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.h +38 -0
  213. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.c +2157 -0
  214. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.h +127 -0
  215. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.c +724 -0
  216. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.h +117 -0
  217. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm_geartab.h +106 -0
  218. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.c +1472 -0
  219. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.h +56 -0
  220. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.c +1867 -0
  221. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.h +113 -0
  222. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress.c +1882 -0
  223. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress_amd64.S +576 -0
  224. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.c +244 -0
  225. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.h +44 -0
  226. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress.c +2355 -0
  227. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.c +2192 -0
  228. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.h +73 -0
  229. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_internal.h +238 -0
  230. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.c +1257 -0
  231. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.h +158 -0
  232. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.c +1913 -0
  233. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.h +67 -0
  234. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/fastcover.c +766 -0
  235. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/zdict.c +1127 -0
  236. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_legacy.h +422 -0
  237. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.c +2125 -0
  238. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.h +94 -0
  239. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.c +3477 -0
  240. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.h +93 -0
  241. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.c +3117 -0
  242. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.h +93 -0
  243. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.c +3605 -0
  244. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.h +142 -0
  245. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.c +4004 -0
  246. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.h +162 -0
  247. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.c +4113 -0
  248. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.h +172 -0
  249. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.c +4498 -0
  250. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.h +187 -0
  251. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zdict.h +474 -0
  252. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd.h +3020 -0
  253. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd_errors.h +114 -0
  254. data/lib/clickhouse_native/clickhouse_native.bundle +0 -0
  255. data/lib/clickhouse_native/client.rb +50 -0
  256. data/lib/clickhouse_native/errors.rb +23 -0
  257. data/lib/clickhouse_native/pool.rb +49 -0
  258. data/lib/clickhouse_native/version.rb +3 -0
  259. data/lib/clickhouse_native.rb +8 -0
  260. metadata +369 -0
@@ -0,0 +1,87 @@
1
+
2
+ #pragma once
3
+
4
+ #include "column.h"
5
+ #include "../base/input.h"
6
+
7
+ #include <stdexcept>
8
+ #include <utility>
9
+
10
+ namespace clickhouse {
11
+
12
+ /**
13
+ * Represents dummy column of NULLs.
14
+ */
15
+ class ColumnNothing : public Column {
16
+ public:
17
+ ColumnNothing()
18
+ : Column(Type::CreateNothing())
19
+ , size_(0)
20
+ {
21
+ }
22
+
23
+ explicit ColumnNothing(size_t n)
24
+ : Column(Type::CreateNothing())
25
+ , size_(n)
26
+ {
27
+ }
28
+
29
+ /// Increase the capacity of the column for large block insertion.
30
+ void Reserve(size_t) override {};
31
+
32
+ /// Appends one element to the column.
33
+ void Append(std::unique_ptr<void*>) { ++size_; }
34
+
35
+ /// Returns element at given row number.
36
+ std::nullptr_t At(size_t) const { return nullptr; };
37
+
38
+ /// Returns element at given row number.
39
+ inline std::nullptr_t operator [] (size_t) const { return nullptr; };
40
+
41
+ /// Makes slice of the current column.
42
+ ColumnRef Slice(size_t, size_t len) const override {
43
+ return std::make_shared<ColumnNothing>(len);
44
+ }
45
+
46
+ ColumnRef CloneEmpty() const override {
47
+ return std::make_shared<ColumnNothing>();
48
+ }
49
+
50
+ ItemView GetItem(size_t /*index*/) const override { return ItemView{}; }
51
+
52
+ public:
53
+ /// Appends content of given column to the end of current one.
54
+ void Append(ColumnRef column) override {
55
+ if (auto col = column->As<ColumnNothing>()) {
56
+ size_ += col->Size();
57
+ }
58
+ }
59
+
60
+ /// Loads column data from input stream.
61
+ bool LoadBody(InputStream* input, size_t rows) override {
62
+ input->Skip(rows);
63
+ size_ += rows;
64
+ return true;
65
+ }
66
+
67
+ /// Saves column data to output stream.
68
+ void SaveBody(OutputStream*) override {
69
+ throw UnimplementedError("method SaveBody is not supported for Nothing column");
70
+ }
71
+
72
+ /// Clear column data .
73
+ void Clear() override { size_ = 0; }
74
+
75
+ /// Returns count of rows in the column.
76
+ size_t Size() const override { return size_; }
77
+
78
+ void Swap(Column& other) override {
79
+ auto & col = dynamic_cast<ColumnNothing &>(other);
80
+ std::swap(size_, col.size_);
81
+ }
82
+
83
+ private:
84
+ size_t size_;
85
+ };
86
+
87
+ }
@@ -0,0 +1,109 @@
1
+ #include "nullable.h"
2
+
3
+ #include <assert.h>
4
+ #include <stdexcept>
5
+
6
+ namespace clickhouse {
7
+
8
+ ColumnNullable::ColumnNullable(ColumnRef nested, ColumnRef nulls)
9
+ : Column(Type::CreateNullable(nested->Type()))
10
+ , nested_(nested)
11
+ , nulls_(nulls->As<ColumnUInt8>())
12
+ {
13
+ if (nested_->Size() != nulls->Size()) {
14
+ throw ValidationError("count of elements in nested and nulls should be the same");
15
+ }
16
+ }
17
+
18
+ void ColumnNullable::Append(bool isnull)
19
+ {
20
+ nulls_->Append(isnull ? 1 : 0);
21
+ }
22
+
23
+
24
+ bool ColumnNullable::IsNull(size_t n) const {
25
+ return nulls_->At(n) != 0;
26
+ }
27
+
28
+ ColumnRef ColumnNullable::Nested() const {
29
+ return nested_;
30
+ }
31
+
32
+ ColumnRef ColumnNullable::Nulls() const
33
+ {
34
+ return nulls_;
35
+ }
36
+
37
+ void ColumnNullable::Reserve(size_t new_cap) {
38
+ nested_->Reserve(new_cap);
39
+ nulls_->Reserve(new_cap);
40
+ }
41
+
42
+ void ColumnNullable::Append(ColumnRef column) {
43
+ if (auto col = column->As<ColumnNullable>()) {
44
+ if (!col->nested_->Type()->IsEqual(nested_->Type())) {
45
+ return;
46
+ }
47
+
48
+ nested_->Append(col->nested_);
49
+ nulls_->Append(col->nulls_);
50
+ }
51
+ }
52
+
53
+ void ColumnNullable::Clear() {
54
+ nested_->Clear();
55
+ nulls_->Clear();
56
+ }
57
+
58
+ bool ColumnNullable::LoadPrefix(InputStream* input, size_t rows) {
59
+ return nested_->LoadPrefix(input, rows);
60
+ }
61
+
62
+ bool ColumnNullable::LoadBody(InputStream* input, size_t rows) {
63
+ if (!nulls_->LoadBody(input, rows)) {
64
+ return false;
65
+ }
66
+ if (!nested_->LoadBody(input, rows)) {
67
+ return false;
68
+ }
69
+ return true;
70
+ }
71
+
72
+ void ColumnNullable::SavePrefix(OutputStream* output) {
73
+ nested_->SavePrefix(output);
74
+ }
75
+
76
+ void ColumnNullable::SaveBody(OutputStream* output) {
77
+ nulls_->SaveBody(output);
78
+ nested_->SaveBody(output);
79
+ }
80
+
81
+ size_t ColumnNullable::Size() const {
82
+ return nulls_->Size();
83
+ }
84
+
85
+ ColumnRef ColumnNullable::Slice(size_t begin, size_t len) const {
86
+ return std::make_shared<ColumnNullable>(nested_->Slice(begin, len), nulls_->Slice(begin, len));
87
+ }
88
+
89
+ ColumnRef ColumnNullable::CloneEmpty() const {
90
+ return std::make_shared<ColumnNullable>(nested_->CloneEmpty(), nulls_->CloneEmpty());
91
+ }
92
+
93
+ void ColumnNullable::Swap(Column& other) {
94
+ auto & col = dynamic_cast<ColumnNullable &>(other);
95
+ if (!nested_->Type()->IsEqual(col.nested_->Type()))
96
+ throw ValidationError("Can't swap() Nullable columns of different types.");
97
+
98
+ nested_.swap(col.nested_);
99
+ nulls_.swap(col.nulls_);
100
+ }
101
+
102
+ ItemView ColumnNullable::GetItem(size_t index) const {
103
+ if (IsNull(index))
104
+ return ItemView();
105
+
106
+ return nested_->GetItem(index);
107
+ }
108
+
109
+ }
@@ -0,0 +1,153 @@
1
+ #pragma once
2
+
3
+ #include "column.h"
4
+ #include "numeric.h"
5
+
6
+ #include <optional>
7
+
8
+ namespace clickhouse {
9
+
10
+ /**
11
+ * Represents column of Nullable(T).
12
+ */
13
+ class ColumnNullable : public Column {
14
+ public:
15
+ ColumnNullable(ColumnRef nested, ColumnRef nulls);
16
+
17
+ /// Appends one null flag to the end of the column
18
+ void Append(bool isnull);
19
+
20
+ /// Returns null flag at given row number.
21
+ bool IsNull(size_t n) const;
22
+
23
+ /// Returns nested column.
24
+ ColumnRef Nested() const;
25
+
26
+ /// Returns nulls column.
27
+ ColumnRef Nulls() const;
28
+
29
+ public:
30
+ /// Increase the capacity of the column for large block insertion.
31
+ void Reserve(size_t new_cap) override;
32
+
33
+ /// Appends content of given column to the end of current one.
34
+ void Append(ColumnRef column) override;
35
+
36
+ /// Loads column prefix from input stream.
37
+ bool LoadPrefix(InputStream* input, size_t rows) override;
38
+
39
+ /// Loads column data from input stream.
40
+ bool LoadBody(InputStream* input, size_t rows) override;
41
+
42
+ /// Saves column prefix to output stream.
43
+ void SavePrefix(OutputStream* output) override;
44
+
45
+ /// Saves column data to output stream.
46
+ void SaveBody(OutputStream* output) override;
47
+
48
+ /// Clear column data .
49
+ void Clear() override;
50
+
51
+ /// Returns count of rows in the column.
52
+ size_t Size() const override;
53
+
54
+ /// Makes slice of the current column.
55
+ ColumnRef Slice(size_t begin, size_t len) const override;
56
+ ColumnRef CloneEmpty() const override;
57
+ void Swap(Column&) override;
58
+
59
+ ItemView GetItem(size_t) const override;
60
+
61
+ private:
62
+ ColumnRef nested_;
63
+ std::shared_ptr<ColumnUInt8> nulls_;
64
+ };
65
+
66
+ template <typename ColumnType>
67
+ class ColumnNullableT : public ColumnNullable {
68
+ public:
69
+ using NestedColumnType = ColumnType;
70
+ using ValueType = std::optional<std::decay_t<decltype(std::declval<NestedColumnType>().At(0))>>;
71
+
72
+ ColumnNullableT(std::shared_ptr<NestedColumnType> data, std::shared_ptr<ColumnUInt8> nulls)
73
+ : ColumnNullable(data, nulls)
74
+ , typed_nested_data_(data)
75
+ {}
76
+
77
+ explicit ColumnNullableT(std::shared_ptr<NestedColumnType> data)
78
+ : ColumnNullableT(data, FillNulls(data->Size()))
79
+ {}
80
+
81
+ template <typename ...Args>
82
+ explicit ColumnNullableT(Args &&... args)
83
+ : ColumnNullableT(std::make_shared<NestedColumnType>(std::forward<Args>(args)...))
84
+ {}
85
+
86
+ inline ValueType At(size_t index) const {
87
+ return IsNull(index) ? ValueType{} : ValueType{typed_nested_data_->At(index)};
88
+ }
89
+
90
+ inline ValueType operator[](size_t index) const { return At(index); }
91
+
92
+ /// Appends content of given column to the end of current one.
93
+ void Append(ColumnRef column) override {
94
+ ColumnNullable::Append(std::move(column));
95
+ }
96
+
97
+ inline void Append(ValueType value) {
98
+ ColumnNullable::Append(!value.has_value());
99
+ if (value.has_value()) {
100
+ typed_nested_data_->Append(std::move(*value));
101
+ } else {
102
+ typed_nested_data_->Append(typename ValueType::value_type{});
103
+ }
104
+ }
105
+
106
+ /** Create a ColumnNullableT from a ColumnNullable, without copying data and offsets, but by
107
+ * 'stealing' those from `col`.
108
+ *
109
+ * Ownership of column internals is transferred to returned object, original (argument) object
110
+ * MUST NOT BE USED IN ANY WAY, it is only safe to dispose it.
111
+ *
112
+ * Throws an exception if `col` is of wrong type, it is safe to use original col in this case.
113
+ * This is a static method to make such conversion verbose.
114
+ */
115
+ static auto Wrap(ColumnNullable&& col) {
116
+ return std::make_shared<ColumnNullableT<NestedColumnType>>(
117
+ col.Nested()->AsStrict<NestedColumnType>(),
118
+ col.Nulls()->AsStrict<ColumnUInt8>()) ;
119
+ }
120
+
121
+ static auto Wrap(Column&& col) { return Wrap(std::move(dynamic_cast<ColumnNullable&&>(col))); }
122
+
123
+ // Helper to simplify integration with other APIs
124
+ static auto Wrap(ColumnRef&& col) { return Wrap(std::move(*col->AsStrict<ColumnNullable>())); }
125
+
126
+ ColumnRef Slice(size_t begin, size_t size) const override {
127
+ return Wrap(ColumnNullable::Slice(begin, size));
128
+ }
129
+
130
+ ColumnRef CloneEmpty() const override { return Wrap(ColumnNullable::CloneEmpty()); }
131
+
132
+ void Swap(Column& other) override {
133
+ auto& col = dynamic_cast<ColumnNullableT<NestedColumnType>&>(other);
134
+ typed_nested_data_.swap(col.typed_nested_data_);
135
+ ColumnNullable::Swap(other);
136
+ }
137
+
138
+ private:
139
+ static inline auto FillNulls(size_t n){
140
+ auto result = std::make_shared<ColumnUInt8>();
141
+ for (size_t i = 0; i < n; ++i) {
142
+ result->Append(0);
143
+ }
144
+ return result;
145
+ }
146
+
147
+ std::shared_ptr<NestedColumnType> typed_nested_data_;
148
+ };
149
+
150
+ template <typename T>
151
+ constexpr bool IsNullable = std::is_base_of_v<ColumnNullable, T>;
152
+
153
+ }
@@ -0,0 +1,126 @@
1
+ #include "numeric.h"
2
+ #include "utils.h"
3
+
4
+ #include "../base/wire_format.h"
5
+
6
+ namespace clickhouse {
7
+
8
+ template <typename T>
9
+ ColumnVector<T>::ColumnVector()
10
+ : Column(Type::CreateSimple<T>())
11
+ {
12
+ }
13
+
14
+ template <typename T>
15
+ ColumnVector<T>::ColumnVector(const std::vector<T> & data)
16
+ : Column(Type::CreateSimple<T>())
17
+ , data_(data)
18
+ {
19
+ }
20
+
21
+ template <typename T>
22
+ ColumnVector<T>::ColumnVector(std::vector<T> && data)
23
+ : Column(Type::CreateSimple<T>())
24
+ , data_(std::move(data))
25
+ {
26
+ }
27
+
28
+ template <typename T>
29
+ void ColumnVector<T>::Append(const T& value) {
30
+ data_.push_back(value);
31
+ }
32
+
33
+ template <typename T>
34
+ void ColumnVector<T>::Erase(size_t pos, size_t count) {
35
+ const auto begin = std::min(pos, data_.size());
36
+ const auto last = begin + std::min(data_.size() - begin, count);
37
+
38
+ data_.erase(data_.begin() + begin, data_.begin() + last);
39
+ }
40
+
41
+ template <typename T>
42
+ std::vector<T>& ColumnVector<T>::GetWritableData() {
43
+ return data_;
44
+ }
45
+
46
+ template <typename T>
47
+ void ColumnVector<T>::Reserve(size_t new_cap) {
48
+ data_.reserve(new_cap);
49
+ }
50
+
51
+ template <typename T>
52
+ size_t ColumnVector<T>::Capacity() const {
53
+ return data_.capacity();
54
+ }
55
+
56
+ template <typename T>
57
+ void ColumnVector<T>::Clear() {
58
+ data_.clear();
59
+ }
60
+
61
+ template <typename T>
62
+ const T& ColumnVector<T>::At(size_t n) const {
63
+ return data_.at(n);
64
+ }
65
+
66
+ template <typename T>
67
+ void ColumnVector<T>::Append(ColumnRef column) {
68
+ if (auto col = column->As<ColumnVector<T>>()) {
69
+ data_.insert(data_.end(), col->data_.begin(), col->data_.end());
70
+ }
71
+ }
72
+
73
+ template <typename T>
74
+ bool ColumnVector<T>::LoadBody(InputStream* input, size_t rows) {
75
+ data_.resize(rows);
76
+
77
+ return WireFormat::ReadBytes(*input, data_.data(), data_.size() * sizeof(T));
78
+ }
79
+
80
+ template <typename T>
81
+ void ColumnVector<T>::SaveBody(OutputStream* output) {
82
+ WireFormat::WriteBytes(*output, data_.data(), data_.size() * sizeof(T));
83
+ }
84
+
85
+ template <typename T>
86
+ size_t ColumnVector<T>::Size() const {
87
+ return data_.size();
88
+ }
89
+
90
+ template <typename T>
91
+ ColumnRef ColumnVector<T>::Slice(size_t begin, size_t len) const {
92
+ return std::make_shared<ColumnVector<T>>(SliceVector(data_, begin, len));
93
+ }
94
+
95
+ template <typename T>
96
+ ColumnRef ColumnVector<T>::CloneEmpty() const {
97
+ return std::make_shared<ColumnVector<T>>();
98
+ }
99
+
100
+ template <typename T>
101
+ void ColumnVector<T>::Swap(Column& other) {
102
+ auto & col = dynamic_cast<ColumnVector<T> &>(other);
103
+ data_.swap(col.data_);
104
+ }
105
+
106
+ template <typename T>
107
+ ItemView ColumnVector<T>::GetItem(size_t index) const {
108
+ return ItemView{type_->GetCode(), data_[index]};
109
+ }
110
+
111
+ template class ColumnVector<int8_t>;
112
+ template class ColumnVector<int16_t>;
113
+ template class ColumnVector<int32_t>;
114
+ template class ColumnVector<int64_t>;
115
+
116
+ template class ColumnVector<uint8_t>;
117
+ template class ColumnVector<uint16_t>;
118
+ template class ColumnVector<uint32_t>;
119
+ template class ColumnVector<uint64_t>;
120
+ template class ColumnVector<Int128>;
121
+ template class ColumnVector<UInt128>;
122
+
123
+ template class ColumnVector<float>;
124
+ template class ColumnVector<double>;
125
+
126
+ }
@@ -0,0 +1,88 @@
1
+ #pragma once
2
+
3
+ #include "column.h"
4
+ #include "absl/numeric/int128.h"
5
+
6
+ namespace clickhouse {
7
+
8
+ /**
9
+ * Represents various numeric columns.
10
+ */
11
+ template <typename T>
12
+ class ColumnVector : public Column {
13
+ public:
14
+ using DataType = T;
15
+ using ValueType = T;
16
+
17
+ ColumnVector();
18
+
19
+ explicit ColumnVector(const std::vector<T>& data);
20
+ explicit ColumnVector(std::vector<T> && data);
21
+
22
+ /// Increase the capacity of the column for large block insertion.
23
+ void Reserve(size_t new_cap) override;
24
+
25
+ /// Appends one element to the end of column.
26
+ void Append(const T& value);
27
+
28
+ /// Returns element at given row number.
29
+ const T& At(size_t n) const;
30
+
31
+ /// Returns element at given row number.
32
+ inline const T& operator [] (size_t n) const { return At(n); }
33
+
34
+ void Erase(size_t pos, size_t count = 1);
35
+
36
+ /// Get Raw Vector Contents
37
+ std::vector<T>& GetWritableData();
38
+
39
+ /// Returns the capacity of the column
40
+ size_t Capacity() const;
41
+
42
+ public:
43
+ /// Appends content of given column to the end of current one.
44
+ void Append(ColumnRef column) override;
45
+
46
+ /// Loads column data from input stream.
47
+ bool LoadBody(InputStream* input, size_t rows) override;
48
+
49
+ /// Saves column data to output stream.
50
+ void SaveBody(OutputStream* output) override;
51
+
52
+ /// Clear column data .
53
+ void Clear() override;
54
+
55
+ /// Returns count of rows in the column.
56
+ size_t Size() const override;
57
+
58
+ /// Makes slice of the current column.
59
+ ColumnRef Slice(size_t begin, size_t len) const override;
60
+ ColumnRef CloneEmpty() const override;
61
+ void Swap(Column& other) override;
62
+
63
+ ItemView GetItem(size_t index) const override;
64
+
65
+ private:
66
+ std::vector<T> data_;
67
+ };
68
+
69
+ using Int128 = absl::int128;
70
+ using UInt128 = absl::uint128;
71
+ using Int64 = int64_t;
72
+
73
+ using ColumnUInt8 = ColumnVector<uint8_t>;
74
+ using ColumnUInt16 = ColumnVector<uint16_t>;
75
+ using ColumnUInt32 = ColumnVector<uint32_t>;
76
+ using ColumnUInt64 = ColumnVector<uint64_t>;
77
+ using ColumnUInt128 = ColumnVector<UInt128>;
78
+
79
+ using ColumnInt8 = ColumnVector<int8_t>;
80
+ using ColumnInt16 = ColumnVector<int16_t>;
81
+ using ColumnInt32 = ColumnVector<int32_t>;
82
+ using ColumnInt64 = ColumnVector<int64_t>;
83
+ using ColumnInt128 = ColumnVector<Int128>;
84
+
85
+ using ColumnFloat32 = ColumnVector<float>;
86
+ using ColumnFloat64 = ColumnVector<double>;
87
+
88
+ }