39 , enableShared ? !stdenv.hostPlatform.isStatic
41 , enableJemalloc ? !stdenv.isDarwin
43 , enableGcs ? !stdenv.isDarwin
46 assert lib.asserts.assertMsg
47 ((enableS3 && stdenv.isDarwin) -> (lib.versionOlder boost.version "1.69" || lib.versionAtLeast boost.version "1.70"))
48 "S3 on Darwin requires Boost != 1.69";
51 arrow-testing = fetchFromGitHub {
52 name = "arrow-testing";
54 repo = "arrow-testing";
55 rev = "47f7b56b25683202c1fd957668e13f2abafc0f12";
56 hash = "sha256-ZDznR+yi0hm5O1s9as8zq5nh1QxJ8kXCRwbNQlzXpnI=";
59 parquet-testing = fetchFromGitHub {
60 name = "parquet-testing";
62 repo = "parquet-testing";
63 rev = "b2e7cc755159196e3a068c8594f7acbaecfdaaac";
64 hash = "sha256-IFvGTOkaRSNgZOj8DziRj88yH5JRF+wgSDZ5N0GNvjk=";
67 aws-sdk-cpp-arrow = aws-sdk-cpp.override {
79 stdenv.mkDerivation rec {
84 url = "mirror://apache/arrow/arrow-${version}/apache-arrow-${version}.tar.gz";
85 hash = "sha256-XHDq+xAR+dEkuvsyiv5U9izFuSgLcIDh49Zo94wOQH4=";
88 sourceRoot = "apache-arrow-${version}/cpp";
90 # versions are all taken from
91 # https://github.com/apache/arrow/blob/apache-arrow-${version}/cpp/thirdparty/versions.txt
93 # jemalloc: arrow uses a custom prefix to prevent default allocator symbol
94 # collisions as well as custom build flags
95 ${if enableJemalloc then "ARROW_JEMALLOC_URL" else null} = fetchurl {
96 url = "https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2";
97 hash = "sha256-LbgtHnEZ3z5xt2QCGbbf6EeJvAU3mDw7esT3GJrs/qo=";
100 # mimalloc: arrow uses custom build flags for mimalloc
101 ARROW_MIMALLOC_URL = fetchFromGitHub {
105 hash = "sha256-u2ITXABBN/dwU+mCIbL3tN1f4c17aBuSdNTV+Adtohc=";
108 ARROW_XSIMD_URL = fetchFromGitHub {
109 owner = "xtensor-stack";
112 hash = "sha256-onALN6agtrHWigtFlCeefD9CiRZI4Y690XTzy2UDnrk=";
115 ARROW_SUBSTRAIT_URL = fetchFromGitHub {
116 owner = "substrait-io";
119 hash = "sha256-wptEAXembah04pzqAz6UHeUxp+jMf6Lh/IdyuIhy/a8=";
122 nativeBuildInputs = [
125 autoconf # for vendored jemalloc
127 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
137 nlohmann_json # alternative JSON parser to rapidjson
138 protobuf # substrait requires protobuf
146 ] ++ lib.optionals enableFlight [
151 ] ++ lib.optionals enableS3 [ aws-sdk-cpp-arrow openssl ]
152 ++ lib.optionals enableGcs [
161 patchShebangs build-support/
162 substituteInPlace "src/arrow/vendored/datetime/tz.cpp" \
163 --replace 'discover_tz_dir();' '"${tzdata}/share/zoneinfo";'
167 "-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON"
168 "-DARROW_BUILD_SHARED=${if enableShared then "ON" else "OFF"}"
169 "-DARROW_BUILD_STATIC=${if enableShared then "OFF" else "ON"}"
170 "-DARROW_BUILD_TESTS=ON"
171 "-DARROW_BUILD_INTEGRATION=ON"
172 "-DARROW_BUILD_UTILITIES=ON"
173 "-DARROW_EXTRA_ERROR_CONTEXT=ON"
174 "-DARROW_VERBOSE_THIRDPARTY_BUILD=ON"
175 "-DARROW_DEPENDENCY_SOURCE=SYSTEM"
176 "-Dxsimd_SOURCE=AUTO"
177 "-DARROW_DEPENDENCY_USE_SHARED=${if enableShared then "ON" else "OFF"}"
181 "-DARROW_FILESYSTEM=ON"
182 "-DARROW_FLIGHT_SQL=${if enableFlight then "ON" else "OFF"}"
185 "-DARROW_JEMALLOC=${if enableJemalloc then "ON" else "OFF"}"
187 "-DARROW_USE_GLOG=ON"
188 "-DARROW_WITH_BACKTRACE=ON"
189 "-DARROW_WITH_BROTLI=ON"
190 "-DARROW_WITH_LZ4=ON"
191 "-DARROW_WITH_NLOHMANN_JSON=ON"
192 "-DARROW_WITH_SNAPPY=ON"
193 "-DARROW_WITH_UTF8PROC=ON"
194 "-DARROW_WITH_ZLIB=ON"
195 "-DARROW_WITH_ZSTD=ON"
196 "-DARROW_MIMALLOC=ON"
197 "-DARROW_SUBSTRAIT=ON"
198 "-DARROW_FLIGHT=${if enableFlight then "ON" else "OFF"}"
199 "-DARROW_FLIGHT_TESTING=${if enableFlight then "ON" else "OFF"}"
200 "-DARROW_S3=${if enableS3 then "ON" else "OFF"}"
201 "-DARROW_GCS=${if enableGcs then "ON" else "OFF"}"
204 "-DPARQUET_BUILD_EXECUTABLES=ON"
205 "-DPARQUET_REQUIRE_ENCRYPTION=ON"
206 ] ++ lib.optionals (!enableShared) [
207 "-DARROW_TEST_LINKAGE=static"
208 ] ++ lib.optionals stdenv.isDarwin [
209 "-DCMAKE_INSTALL_RPATH=@loader_path/../lib" # needed for tools executables
210 ] ++ lib.optionals (!stdenv.isx86_64) [ "-DARROW_USE_SIMD=OFF" ]
211 ++ lib.optionals enableS3 [ "-DAWSSDK_CORE_HEADER_FILE=${aws-sdk-cpp-arrow}/include/aws/core/Aws.h" ];
213 doInstallCheck = true;
214 ARROW_TEST_DATA = lib.optionalString doInstallCheck "${arrow-testing}/data";
215 PARQUET_TEST_DATA = lib.optionalString doInstallCheck "${parquet-testing}/data";
218 # Upstream Issue: https://issues.apache.org/jira/browse/ARROW-11398
219 filteredTests = lib.optionals stdenv.hostPlatform.isAarch64 [
220 "TestFilterKernelWithNumeric/3.CompareArrayAndFilterRandomNumeric"
221 "TestFilterKernelWithNumeric/7.CompareArrayAndFilterRandomNumeric"
222 "TestCompareKernel.PrimitiveRandomTests"
223 ] ++ lib.optionals enableS3 [
224 "S3OptionsTest.FromUri"
225 "S3RegionResolutionTest.NonExistentBucket"
226 "S3RegionResolutionTest.PublicBucket"
227 "S3RegionResolutionTest.RestrictedBucket"
228 "TestMinioServer.Connect"
231 ] ++ lib.optionals stdenv.isDarwin [
232 # TODO: revisit at 12.0.0 or when
233 # https://github.com/apache/arrow/commit/295c6644ca6b67c95a662410b2c7faea0920c989
235 # https://github.com/apache/arrow/pull/15288#discussion_r1071244661
236 "ExecPlanExecution.StressSourceSinkStopped"
239 lib.optionalString doInstallCheck "-${lib.concatStringsSep ":" filteredTests}";
241 __darwinAllowLocalNetworking = true;
243 nativeInstallCheckInputs = [ perl which sqlite ]
244 ++ lib.optionals enableS3 [ minio ]
245 ++ lib.optionals enableFlight [ python3 ];
248 # requires networking
250 "arrow-flight-integration-test"
253 installCheckPhase = ''
254 runHook preInstallCheck
256 ctest -L unittest --exclude-regex '^(${lib.concatStringsSep "|" disabledTests})$'
258 runHook postInstallCheck
262 description = "A cross-language development platform for in-memory data";
263 homepage = "https://arrow.apache.org/docs/cpp/";
264 license = licenses.asl20;
265 platforms = platforms.unix;
266 maintainers = with maintainers; [ tobim veprbl cpcloud ];
269 inherit enableFlight enableJemalloc enableS3 enableGcs;