Skip to content

Commit

Permalink
Patch out nanoarrow issues because they cannot easily be NOLINTed.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Sep 30, 2024
1 parent ff5cfe0 commit 97b0ffc
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cpp/cmake/thirdparty/get_nanoarrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@

# This function finds nanoarrow and sets any additional necessary environment variables.
function(find_and_configure_nanoarrow)
include(${rapids-cmake-dir}/cpm/package_override.cmake)

set(cudf_patch_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/patches")
rapids_cpm_package_override("${cudf_patch_dir}/nanoarrow_override.json")

# Currently we need to always build nanoarrow so we don't pickup a previous installed version
set(CPM_DOWNLOAD_nanoarrow ON)
rapids_cpm_find(
nanoarrow 0.6.0.dev
GLOBAL_TARGETS nanoarrow
CPM_ARGS
GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git
GIT_TAG 1e2664a70ec14907409cadcceb14d79b9670bcdb
GIT_SHALLOW FALSE
OPTIONS "BUILD_SHARED_LIBS OFF" "NANOARROW_NAMESPACE cudf"
)
set_target_properties(nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down
38 changes: 38 additions & 0 deletions cpp/cmake/thirdparty/patches/nanoarrow_clang_tidy_compliance.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/src/nanoarrow/common/inline_buffer.h b/src/nanoarrow/common/inline_buffer.h
index caa6be4..70ec8a2 100644
--- a/src/nanoarrow/common/inline_buffer.h
+++ b/src/nanoarrow/common/inline_buffer.h
@@ -347,7 +347,7 @@ static inline void _ArrowBitsUnpackInt32(const uint8_t word, int32_t* out) {
}

static inline void _ArrowBitmapPackInt8(const int8_t* values, uint8_t* out) {
- *out = (uint8_t)(values[0] | ((values[1] + 0x1) & 0x2) | ((values[2] + 0x3) & 0x4) |
+ *out = (uint8_t)(values[0] | ((values[1] + 0x1) & 0x2) | ((values[2] + 0x3) & 0x4) | // NOLINT
((values[3] + 0x7) & 0x8) | ((values[4] + 0xf) & 0x10) |
((values[5] + 0x1f) & 0x20) | ((values[6] + 0x3f) & 0x40) |
((values[7] + 0x7f) & 0x80));
@@ -471,13 +471,13 @@ static inline void ArrowBitsSetTo(uint8_t* bits, int64_t start_offset, int64_t l
// set bits within a single byte
const uint8_t only_byte_mask =
i_end % 8 == 0 ? first_byte_mask : (uint8_t)(first_byte_mask | last_byte_mask);
- bits[bytes_begin] &= only_byte_mask;
+ bits[bytes_begin] &= only_byte_mask; // NOLINT
bits[bytes_begin] |= (uint8_t)(fill_byte & ~only_byte_mask);
return;
}

// set/clear trailing bits of first byte
- bits[bytes_begin] &= first_byte_mask;
+ bits[bytes_begin] &= first_byte_mask; // NOLINT
bits[bytes_begin] |= (uint8_t)(fill_byte & ~first_byte_mask);

if (bytes_end - bytes_begin > 2) {
@@ -637,7 +637,7 @@ static inline void ArrowBitmapAppendInt8Unsafe(struct ArrowBitmap* bitmap,
n_remaining -= n_full_bytes * 8;
if (n_remaining > 0) {
// Zero out the last byte
- *out_cursor = 0x00;
+ *out_cursor = 0x00; // NOLINT
for (int i = 0; i < n_remaining; i++) {
ArrowBitSetTo(bitmap->buffer.data, out_i_cursor++, values_cursor[i]);
}
18 changes: 18 additions & 0 deletions cpp/cmake/thirdparty/patches/nanoarrow_override.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

{
"packages" : {
"nanoarrow" : {
"version" : "0.6.0.dev",
"git_url" : "https://github.com/apache/arrow-nanoarrow.git",
"git_tag" : "1e2664a70ec14907409cadcceb14d79b9670bcdb",
"git_shallow" : false,
"patches" : [
{
"file" : "${current_json_dir}/nanoarrow_clang_tidy_compliance.diff",
"issue" : "https://github.com/apache/arrow-nanoarrow/issues/537",
"fixed_in" : ""
}
]
}
}
}

0 comments on commit 97b0ffc

Please sign in to comment.