Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ build_script:
- cd cpp
- mkdir build
- cd build
# A lot of features are still deactivated as they do not build on Windows
# * gbenchmark doesn't build with MSVC
- cmake -G "%GENERATOR%" -DARROW_BOOST_USE_SHARED=OFF -DARROW_BUILD_BENCHMARKS=OFF -DARROW_JEMALLOC=OFF -DCMAKE_BUILD_TYPE=Release ..
- cmake -G "%GENERATOR%" -DARROW_CXXFLAGS="/WX" -DARROW_BOOST_USE_SHARED=OFF -DCMAKE_BUILD_TYPE=Release ..
- cmake --build . --config Release

# test_script:
- ctest -VV


4 changes: 4 additions & 0 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ CHECK_CXX_COMPILER_FLAG("-maltivec" CXX_SUPPORTS_ALTIVEC)
# compiler flags that are common across debug/release builds

if (MSVC)
# TODO(wesm): Change usages of C runtime functions that MSVC says are
# insecure, like std::getenv
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# clang-cl
set(CXX_COMMON_FLAGS "-EHsc")
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/array-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ TEST_F(TestArray, SliceRecomputeNullCount) {
TEST_F(TestArray, TestIsNull) {
// clang-format off
vector<uint8_t> null_bitmap = {1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 0, 1};
1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 0, 1};
// clang-format on
int64_t null_count = 0;
for (uint8_t x : null_bitmap) {
Expand All @@ -144,7 +144,7 @@ TEST_F(TestArray, TestIsNull) {
ASSERT_TRUE(arr->null_bitmap()->Equals(*null_buf.get()));

for (size_t i = 0; i < null_bitmap.size(); ++i) {
EXPECT_EQ(null_bitmap[i], !arr->IsNull(i)) << i;
EXPECT_EQ(null_bitmap[i] != 0, !arr->IsNull(i)) << i;
}
}

Expand Down Expand Up @@ -334,7 +334,7 @@ void TestPrimitiveBuilder<PBoolean>::Check(
for (int64_t i = 0; i < result->length(); ++i) {
if (nullable) { ASSERT_EQ(valid_bytes_[i] == 0, result->IsNull(i)) << i; }
bool actual = BitUtil::GetBit(result->data()->data(), i);
ASSERT_EQ(static_cast<bool>(draws_[i]), actual) << i;
ASSERT_EQ(draws_[i] != 0, actual) << i;
}
ASSERT_TRUE(result->Equals(*expected));
}
Expand Down Expand Up @@ -1379,7 +1379,7 @@ void ValidateBasicListArray(const ListArray* result, const vector<int32_t>& valu
}

for (int i = 0; i < result->length(); ++i) {
ASSERT_EQ(!static_cast<bool>(is_valid[i]), result->IsNull(i));
ASSERT_EQ(is_valid[i] == 0, result->IsNull(i));
}

ASSERT_EQ(7, result->values()->length());
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ class ARROW_EXPORT BooleanBuilder : public ArrayBuilder {
return Status::OK();
}

Status Append(uint8_t val) {
return Append(val != 0);
}

/// Vector append
///
/// If passed, valid_bytes is of equal length to values, and any zero byte
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/io/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ static inline Status FileRead(
int fd, uint8_t* buffer, int64_t nbytes, int64_t* bytes_read) {
#if defined(_MSC_VER)
if (nbytes > INT32_MAX) { return Status::IOError("Unable to read > 2GB blocks yet"); }
*bytes_read = _read(fd, buffer, static_cast<size_t>(nbytes));
*bytes_read = static_cast<int64_t>(_read(fd, buffer, static_cast<uint32_t>(nbytes)));
#else
*bytes_read = read(fd, buffer, static_cast<size_t>(nbytes));
*bytes_read = static_cast<int64_t>(read(fd, buffer, static_cast<size_t>(nbytes)));
#endif

if (*bytes_read == -1) {
Expand All @@ -269,7 +269,7 @@ static inline Status FileWrite(int fd, const uint8_t* buffer, int64_t nbytes) {
if (nbytes > INT32_MAX) {
return Status::IOError("Unable to write > 2GB blocks to file yet");
}
ret = static_cast<int>(_write(fd, buffer, static_cast<size_t>(nbytes)));
ret = static_cast<int>(_write(fd, buffer, static_cast<uint32_t>(nbytes)));
#else
ret = static_cast<int>(write(fd, buffer, static_cast<size_t>(nbytes)));
#endif
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/io/io-hdfs-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class TestHdfsClient : public ::testing::Test {
const char* port = std::getenv("ARROW_HDFS_TEST_PORT");
const char* user = std::getenv("ARROW_HDFS_TEST_USER");

ASSERT_TRUE(user) << "Set ARROW_HDFS_TEST_USER";
ASSERT_TRUE(user != nullptr) << "Set ARROW_HDFS_TEST_USER";

conf_.host = host == nullptr ? "localhost" : host;
conf_.user = user;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/json-internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ class JsonArrayReader {
std::vector<bool> is_valid;
for (const rj::Value& val : json_validity) {
DCHECK(val.IsInt());
is_valid.push_back(static_cast<bool>(val.GetInt()));
is_valid.push_back(val.GetInt() != 0);
}

#define TYPE_CASE(TYPE) \
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/test-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Status MakeRandomListArray(const std::shared_ptr<Array>& child_array, int num_li
std::partial_sum(list_sizes.begin(), list_sizes.end(), ++offsets.begin());

// Force invariants
const int64_t child_length = child_array->length();
const int32_t child_length = static_cast<int32_t>(child_array->length());
offsets[0] = 0;
std::replace_if(offsets.begin(), offsets.end(),
[child_length](int32_t offset) { return offset > child_length; }, child_length);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const std::string& Tensor::dim_name(int i) const {
}

int64_t Tensor::size() const {
return std::accumulate(shape_.begin(), shape_.end(), 1, std::multiplies<int64_t>());
return std::accumulate(shape_.begin(), shape_.end(), 1LL, std::multiplies<int64_t>());
}

bool Tensor::is_contiguous() const {
Expand Down