diff --git a/appveyor.yml b/appveyor.yml index 082063ae572..3c4c2c3dc76 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,14 +36,6 @@ cache: matrix: fast_finish: true - allow_failures: - # Can't build with 32-bit MinGW for now. - # See https://issues.apache.org/jira/browse/ARROW-4297 - - JOB: "MinGW32" - MINGW_PACKAGE_PREFIX: mingw-w64-i686 - MINGW_PREFIX: c:\msys64\mingw32 - MSYSTEM: MINGW32 - USE_CLCACHE: false environment: global: diff --git a/ci/appveyor-cpp-build-mingw.bat b/ci/appveyor-cpp-build-mingw.bat index 4d399274549..bdd3b14462e 100644 --- a/ci/appveyor-cpp-build-mingw.bat +++ b/ci/appveyor-cpp-build-mingw.bat @@ -44,8 +44,11 @@ cmake ^ -DARROW_PYTHON=ON ^ -DPythonInterp_FIND_VERSION=ON ^ -DPythonInterp_FIND_VERSION_MAJOR=3 ^ + -DARROW_BUILD_TESTS=ON ^ + -DARROW_PYTHON=OFF ^ .. || exit /B make -j4 || exit /B +ctest --output-on-failure -j2 || exit /B make install || exit /B popd diff --git a/ci/appveyor-cpp-setup-mingw.bat b/ci/appveyor-cpp-setup-mingw.bat index 471e7426f6e..0c3d633cf8a 100644 --- a/ci/appveyor-cpp-setup-mingw.bat +++ b/ci/appveyor-cpp-setup-mingw.bat @@ -25,6 +25,7 @@ pacman -S --noconfirm ^ "%MINGW_PACKAGE_PREFIX%-cmake" ^ "%MINGW_PACKAGE_PREFIX%-flatbuffers" ^ "%MINGW_PACKAGE_PREFIX%-gcc" ^ + "%MINGW_PACKAGE_PREFIX%-gflags" ^ "%MINGW_PACKAGE_PREFIX%-gobject-introspection" ^ "%MINGW_PACKAGE_PREFIX%-gtk-doc" ^ "%MINGW_PACKAGE_PREFIX%-lz4" ^ diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 94eba0ce1a6..9ddadc5a555 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -301,13 +301,24 @@ arrow_add_pkg_config("arrow") # add_arrow_test(allocator-test) -add_arrow_test(array-test - SOURCES - array-test.cc - array-binary-test.cc - array-dict-test.cc - array-list-test.cc - array-struct-test.cc) + +if(WIN32) + add_arrow_test(array-test + SOURCES + array-test.cc + array-binary-test.cc + array-list-test.cc + array-struct-test.cc) +else() + add_arrow_test(array-test + SOURCES + array-test.cc + array-binary-test.cc + array-dict-test.cc + array-list-test.cc + array-struct-test.cc) +endif() + add_arrow_test(buffer-test) if(ARROW_IPC) diff --git a/cpp/src/arrow/compute/kernels/cast-test.cc b/cpp/src/arrow/compute/kernels/cast-test.cc index e7f5a4aa296..0fd3065bd9b 100644 --- a/cpp/src/arrow/compute/kernels/cast-test.cc +++ b/cpp/src/arrow/compute/kernels/cast-test.cc @@ -424,6 +424,7 @@ TEST_F(TestCast, FloatingPointToInt) { options); } +#if ARROW_BITNESS >= 64 TEST_F(TestCast, IntToFloatingPoint) { auto options = CastOptions::Safe(); @@ -438,6 +439,7 @@ TEST_F(TestCast, IntToFloatingPoint) { UnsafeVectorCast(v1), options); } +#endif TEST_F(TestCast, TimestampToTimestamp) { CastOptions options; diff --git a/cpp/src/arrow/util/hash-util.h b/cpp/src/arrow/util/hash-util.h index 637f4328085..7aed3c171dc 100644 --- a/cpp/src/arrow/util/hash-util.h +++ b/cpp/src/arrow/util/hash-util.h @@ -81,10 +81,13 @@ class HashUtil { const uint8_t* p = reinterpret_cast(data); const uint8_t* end = p + nbytes; +#if ARROW_BITNESS >= 64 while (p <= end - 8) { hash = HW_crc32_u64(hash, *reinterpret_cast(p)); p += 8; } +#endif + while (p <= end - 4) { hash = HW_crc32_u32(hash, *reinterpret_cast(p)); p += 4; @@ -113,6 +116,7 @@ class HashUtil { uint32_t h1 = static_cast(hash >> 32); uint32_t h2 = static_cast(hash); +#if ARROW_BITNESS >= 64 while (nbytes >= 16) { h1 = HW_crc32_u64(h1, *reinterpret_cast(p)); h2 = HW_crc32_u64(h2, *reinterpret_cast(p + 8)); @@ -125,6 +129,15 @@ class HashUtil { nbytes -= 8; p += 8; } +#else + while (nbytes >= 8) { + h1 = HW_crc32_u32(h1, *reinterpret_cast(p)); + h2 = HW_crc32_u32(h2, *reinterpret_cast(p + 4)); + nbytes -= 8; + p += 8; + } +#endif + if (nbytes >= 4) { h1 = HW_crc32_u16(h1, *reinterpret_cast(p)); h2 = HW_crc32_u16(h2, *reinterpret_cast(p + 2)); @@ -151,58 +164,6 @@ class HashUtil { return (static_cast(h1) << 32) + h2; } - /// CrcHash() specialized for 1-byte data - static inline uint32_t CrcHash1(const void* v, uint32_t hash) { - const uint8_t* s = reinterpret_cast(v); - hash = HW_crc32_u8(hash, *s); - hash = (hash << 16) | (hash >> 16); - return hash; - } - - /// CrcHash() specialized for 2-byte data - static inline uint32_t CrcHash2(const void* v, uint32_t hash) { - const uint16_t* s = reinterpret_cast(v); - hash = HW_crc32_u16(hash, *s); - hash = (hash << 16) | (hash >> 16); - return hash; - } - - /// CrcHash() specialized for 4-byte data - static inline uint32_t CrcHash4(const void* v, uint32_t hash) { - const uint32_t* p = reinterpret_cast(v); - hash = HW_crc32_u32(hash, *p); - hash = (hash << 16) | (hash >> 16); - return hash; - } - - /// CrcHash() specialized for 8-byte data - static inline uint32_t CrcHash8(const void* v, uint32_t hash) { - const uint64_t* p = reinterpret_cast(v); - hash = HW_crc32_u64(hash, *p); - hash = (hash << 16) | (hash >> 16); - return hash; - } - - /// CrcHash() specialized for 12-byte data - static inline uint32_t CrcHash12(const void* v, uint32_t hash) { - const uint64_t* p = reinterpret_cast(v); - hash = HW_crc32_u64(hash, *p); - ++p; - hash = HW_crc32_u32(hash, *reinterpret_cast(p)); - hash = (hash << 16) | (hash >> 16); - return hash; - } - - /// CrcHash() specialized for 16-byte data - static inline uint32_t CrcHash16(const void* v, uint32_t hash) { - const uint64_t* p = reinterpret_cast(v); - hash = HW_crc32_u64(hash, *p); - ++p; - hash = HW_crc32_u64(hash, *p); - hash = (hash << 16) | (hash >> 16); - return hash; - } - static const uint64_t MURMUR_PRIME = 0xc6a4a7935bd1e995; static const int MURMUR_R = 47; diff --git a/cpp/src/arrow/util/macros.h b/cpp/src/arrow/util/macros.h index 5f1934d732c..4516985e300 100644 --- a/cpp/src/arrow/util/macros.h +++ b/cpp/src/arrow/util/macros.h @@ -18,6 +18,8 @@ #ifndef ARROW_UTIL_MACROS_H #define ARROW_UTIL_MACROS_H +#include + #define ARROW_STRINGIFY(x) #x #define ARROW_CONCAT(x, y) x##y @@ -123,6 +125,17 @@ #define ARROW_DISABLE_UBSAN(feature) #endif +// ---------------------------------------------------------------------- +// Machine information + +#if INTPTR_MAX == INT64_MAX +#define ARROW_BITNESS 64 +#elif INTPTR_MAX == INT32_MAX +#define ARROW_BITNESS 32 +#else +#error Unexpected INTPTR_MAX +#endif + // ---------------------------------------------------------------------- // From googletest // (also in parquet-cpp) diff --git a/cpp/src/arrow/util/sse-util.h b/cpp/src/arrow/util/sse-util.h index edaf6686be5..15e7c99581a 100644 --- a/cpp/src/arrow/util/sse-util.h +++ b/cpp/src/arrow/util/sse-util.h @@ -110,7 +110,11 @@ static inline uint32_t SSE4_crc32_u32(uint32_t crc, uint32_t v) { } static inline uint32_t SSE4_crc32_u64(uint32_t crc, uint64_t v) { +#if ARROW_BITNESS == 32 + return 0; +#else return static_cast(_mm_crc32_u64(crc, v)); +#endif } #else // without SSE 4.2.