[packages/clickhouse-cpp] - initial

qboosh qboosh at pld-linux.org
Wed Jul 22 22:32:50 CEST 2026


commit 15d79460af69270210ff6545176963d7c78862f4
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jul 22 22:32:54 2026 +0200

    - initial

 clickhouse-cpp-32bit.patch | 151 +++++++++++++++++++++++++++++++++++++++++++++
 clickhouse-cpp.spec        |  87 ++++++++++++++++++++++++++
 2 files changed, 238 insertions(+)
---
diff --git a/clickhouse-cpp.spec b/clickhouse-cpp.spec
new file mode 100644
index 0000000..3087bca
--- /dev/null
+++ b/clickhouse-cpp.spec
@@ -0,0 +1,87 @@
+#
+# Conditional build:
+%bcond_with	ilp32		# force 32-bit build (MAY BE UNRELIABLE)
+#
+Summary:	ClickHouse C++ client library
+Summary(pl.UTF-8):	Biblioteka klienta ClichHouse dla C++
+Name:		clickhouse-cpp
+Version:	2.6.2
+Release:	1
+License:	Apache v2.0
+Group:		Libraries
+#Source0Download: https://github.com/ClickHouse/clickhouse-cpp/releases
+Source0:	https://github.com/ClickHouse/clickhouse-cpp/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5:	b5cdf86f0a88488bceb3f30da5cd688e
+Patch0:		%{name}-32bit.patch
+URL:		https://github.com/ClickHouse/clickhouse-cpp
+BuildRequires:	abseil-cpp-devel
+BuildRequires:	cityhash-devel
+BuildRequires:	cmake >= 3.12
+BuildRequires:	lz4-devel
+BuildRequires:	libstdc++-devel >= 6:7
+BuildRequires:	openssl-devel
+BuildRequires:	zstd-devel
+%if %{without ilp32}
+# assumes size_t==uint64_t and probably 64-bit time_t
+ExclusiveArch:	%{x8664} aarch64
+%endif
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+C++ client for ClickHouse <https://clickhouse.com/>.
+
+%description -l pl.UTF-8
+Klient C++ do bazy ClickHouse <https://clickhouse.com/>.
+
+%package devel
+Summary:	Header files for ClickHouse C++ client library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki klienta C++ ClichHouse
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Header files for ClickHouse C++ client library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki klienta C++ ClichHouse.
+
+%prep
+%setup -q
+%if %{with ilp32}
+%patch -P0 -p1
+%endif
+
+%build
+install -d build
+cd build
+%cmake .. \
+	-DCH_MAP_BOOL_TO_UINT8=OFF \
+	-DWITH_OPENSSL=ON \
+	-DWITH_SYSTEM_ABSEIL=ON \
+	-DWITH_SYSTEM_LZ4=ON \
+	-DWITH_SYSTEM_CITYHASH=ON \
+	-DWITH_SYSTEM_ZSTD=ON
+
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C build install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc README.md
+%{_libdir}/libclickhouse-cpp-lib.so.%{version}
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libclickhouse-cpp-lib.so
+%{_includedir}/clickhouse
diff --git a/clickhouse-cpp-32bit.patch b/clickhouse-cpp-32bit.patch
new file mode 100644
index 0000000..330fee8
--- /dev/null
+++ b/clickhouse-cpp-32bit.patch
@@ -0,0 +1,151 @@
+--- clickhouse-cpp-2.6.2/clickhouse/columns/lowcardinality.h.orig	2026-06-10 10:48:13.000000000 +0200
++++ clickhouse-cpp-2.6.2/clickhouse/columns/lowcardinality.h	2026-07-20 19:02:14.112159876 +0200
+@@ -5,6 +5,7 @@
+ #include "nullable.h"
+ 
+ #include <functional>
++#include <limits>
+ #include <string>
+ #include <unordered_map>
+ #include <utility>
+@@ -27,7 +28,7 @@ using LowCardinalityHashKey = std::pair<
+ 
+ struct LowCardinalityHashKeyHash {
+     inline std::size_t operator()(const LowCardinalityHashKey &hash_key) const noexcept {
+-        return hash_key.first;
++        return hash_key.first & std::numeric_limits<std::size_t>::max();
+     }
+ };
+ 
+@@ -157,7 +158,7 @@ public:
+ 
+     /// Returns element at given row number.
+     inline ValueType operator [] (size_t n) const {
+-        return typed_dictionary_[getDictionaryIndex(n)];
++        return typed_dictionary_[static_cast<size_t>(getDictionaryIndex(n))];
+     }
+ 
+     // so the non-virtual Append below doesn't shadow Append() from base class when compiled with older compilers.
+--- clickhouse-cpp-2.6.2/clickhouse/base/endpoints_iterator.cpp.orig	2026-06-10 10:48:13.000000000 +0200
++++ clickhouse-cpp-2.6.2/clickhouse/base/endpoints_iterator.cpp	2026-07-20 19:03:24.375212563 +0200
+@@ -5,13 +5,13 @@ namespace clickhouse {
+ 
+ RoundRobinEndpointsIterator::RoundRobinEndpointsIterator(const std::vector<Endpoint>& _endpoints)
+    :  endpoints (_endpoints)
+-   , current_index (endpoints.size() - 1ull)
++   , current_index (endpoints.size() - 1ul)
+ {
+ }
+ 
+ Endpoint RoundRobinEndpointsIterator::Next()
+ {
+-   current_index = (current_index + 1ull) % endpoints.size();
++   current_index = (current_index + 1ul) % endpoints.size();
+    return endpoints[current_index];
+ }
+ 
+--- clickhouse-cpp-2.6.2/clickhouse/columns/lowcardinality.cpp.orig	2026-06-10 10:48:13.000000000 +0200
++++ clickhouse-cpp-2.6.2/clickhouse/columns/lowcardinality.cpp	2026-07-20 19:14:52.121766721 +0200
+@@ -204,13 +204,13 @@ void ColumnLowCardinality::Setup(ColumnR
+ std::uint64_t ColumnLowCardinality::getDictionaryIndex(std::uint64_t item_index) const {
+     switch (index_type_code_) {
+         case Type::UInt8:
+-            return static_cast<const ColumnUInt8&>(*index_column_)[item_index];
++            return static_cast<const ColumnUInt8&>(*index_column_)[static_cast<size_t>(item_index)];
+         case Type::UInt16:
+-            return static_cast<const ColumnUInt16&>(*index_column_)[item_index];
++            return static_cast<const ColumnUInt16&>(*index_column_)[static_cast<size_t>(item_index)];
+         case Type::UInt32:
+-            return static_cast<const ColumnUInt32&>(*index_column_)[item_index];
++            return static_cast<const ColumnUInt32&>(*index_column_)[static_cast<size_t>(item_index)];
+         case Type::UInt64:
+-            return static_cast<const ColumnUInt64&>(*index_column_)[item_index];
++            return static_cast<const ColumnUInt64&>(*index_column_)[static_cast<size_t>(item_index)];
+         default:
+             throw ValidationError("Invalid index column type");
+     }
+@@ -330,7 +330,7 @@ auto Load(ColumnRef new_dictionary_colum
+         dataColumn = nullable->Nested();
+     }
+ 
+-    if (!dataColumn->LoadBody(&input, number_of_keys))
++    if (!dataColumn->LoadBody(&input, static_cast<size_t>(number_of_keys)))
+         throw ProtocolError("Failed to read values of dictionary column.");
+ 
+     uint64_t number_of_rows;
+@@ -340,7 +340,7 @@ auto Load(ColumnRef new_dictionary_colum
+     if (number_of_rows != rows)
+         throw AssertionError("LowCardinality column must be read in full.");
+ 
+-    new_index_column->LoadBody(&input, number_of_rows);
++    new_index_column->LoadBody(&input, static_cast<size_t>(number_of_rows));
+ 
+     if (auto nullable = new_dictionary_column->As<ColumnNullable>()) {
+         nullable->Append(true);
+@@ -472,7 +472,7 @@ ItemView ColumnLowCardinality::GetItem(s
+         }
+     }
+ 
+-    return dictionary_column_->GetItem(dictionaryIndex);
++    return dictionary_column_->GetItem(static_cast<size_t>(dictionaryIndex));
+ }
+ 
+ // No checks regarding value type or validity of value is made.
+--- clickhouse-cpp-2.6.2/clickhouse/columns/string.cpp.orig	2026-06-10 10:48:13.000000000 +0200
++++ clickhouse-cpp-2.6.2/clickhouse/columns/string.cpp	2026-07-20 19:28:05.651821139 +0200
+@@ -280,12 +280,12 @@ bool ColumnString::LoadBody(InputStream*
+             return false;
+ 
+         if (len > block->GetAvailable())
+-            block = &new_blocks.emplace_back(std::max<size_t>(DEFAULT_BLOCK_SIZE, len));
++            block = &new_blocks.emplace_back(std::max<size_t>(DEFAULT_BLOCK_SIZE, static_cast<size_t>(len)));
+ 
+-        if (!WireFormat::ReadBytes(*input, block->GetCurrentWritePos(), len))
++        if (!WireFormat::ReadBytes(*input, block->GetCurrentWritePos(), static_cast<size_t>(len)))
+             return false;
+ 
+-        new_items.emplace_back(block->ConsumeTailAsStringViewUnsafe(len));
++        new_items.emplace_back(block->ConsumeTailAsStringViewUnsafe(static_cast<size_t>(len)));
+     }
+ 
+     items_.swap(new_items);
+--- clickhouse-cpp-2.6.2/clickhouse/client.cpp.orig	2026-06-10 10:48:13.000000000 +0200
++++ clickhouse-cpp-2.6.2/clickhouse/client.cpp	2026-07-20 19:29:51.840345861 +0200
+@@ -910,7 +910,7 @@ bool Client::Impl::ReadBlock(InputStream
+         }  
+ 
+         if (ColumnRef col = CreateColumnByType(type, create_column_settings)) {
+-            if (num_rows && !col->Load(&input, num_rows)) {
++            if (num_rows && !col->Load(&input, static_cast<size_t>(num_rows))) {
+                 throw ProtocolError("can't load column '" + name + "' of type " + type);
+             }
+ 
+--- clickhouse-cpp-2.6.2/clickhouse/columns/array.cpp.orig	2026-06-10 10:48:13.000000000 +0200
++++ clickhouse-cpp-2.6.2/clickhouse/columns/array.cpp	2026-07-21 22:02:32.534187040 +0200
+@@ -110,7 +110,7 @@ bool ColumnArray::LoadBody(InputStream*
+     if (nested_rows == 0) {
+         return true;
+     }
+-    if (!data_->LoadBody(input, nested_rows)) {
++    if (!data_->LoadBody(input, static_cast<size_t>(nested_rows))) {
+         return false;
+     }
+     return true;
+@@ -148,7 +148,7 @@ void ColumnArray::OffsetsIncrease(size_t
+ 
+ size_t ColumnArray::GetOffset(size_t n) const {
+ 
+-    return (n == 0) ? 0 : (*offsets_)[n - 1];
++    return (n == 0) ? 0 : static_cast<size_t>((*offsets_)[n - 1]);
+ }
+ 
+ void ColumnArray::AddOffset(size_t n) {
+@@ -160,7 +160,7 @@ void ColumnArray::AddOffset(size_t n) {
+ }
+ 
+ size_t ColumnArray::GetSize(size_t n) const {
+-    return (n == 0) ? (*offsets_)[n] : ((*offsets_)[n] - (*offsets_)[n - 1]);
++    return static_cast<size_t>((n == 0) ? (*offsets_)[n] : ((*offsets_)[n] - (*offsets_)[n - 1]));
+ }
+ 
+ ColumnRef ColumnArray::GetData() {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/clickhouse-cpp.git/commitdiff/15d79460af69270210ff6545176963d7c78862f4



More information about the pld-cvs-commit mailing list