Skip to content
Open
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
30 changes: 30 additions & 0 deletions .github/workflows/check_bazel_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,36 @@ env:
ZMQ_LIBRARY_PREFIX: /usr/lib/x86_64-linux-gnu
ZMQ_INCLUDE_PREFIX: /usr/include
jobs:
v2:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
- name: Build
run: bazel build --verbose_failures //...
working-directory: ./udf-runner-cpp/v2
- name: Install clang-tidy
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" -- 22
sudo apt-get install -y clang-tidy-22
- name: Run clang-tidy
run: bazel build --verbose_failures --config clang-tidy //...
working-directory: ./udf-runner-cpp/v2
- name: Install clang-format
run: sudo apt-get install -y clang-format
- name: Run clang-format
run: bazel build --verbose_failures --config clang-format //...
working-directory: ./udf-runner-cpp/v2
- name: Run tests
run: bazel test --verbose_failures //...
working-directory: ./udf-runner-cpp/v2

build:
runs-on: ubuntu-24.04
steps:
Expand Down
18 changes: 18 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Summary


## Bug Fixes

n/a

## Features / Enhancements

- 32: Added clang tidy to v2

## Refactorings

n/a

## Internal

* Updated Poetry dependencies and added developer guide and added .gitignore
22 changes: 22 additions & 0 deletions udf-runner-cpp/v2/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The clang-tidy and clang-format rule packages are published in this registry.
common --registry=https://raw.githubusercontent.com/digiboys/bazel-registry/main
common --registry=https://bcr.bazel.build

build:clang-tidy --@rules_clang_tidy//:config=//tools/clang-tidy:config
build:clang-tidy --@rules_clang_tidy//:clang-tidy=//tools/clang-tidy:wrapper
build:clang-tidy --aspects=@rules_clang_tidy//:aspects.bzl%check
build:clang-tidy --output_groups=report
build:clang-tidy --remote_download_outputs=toplevel
build:clang-tidy --keep_going
build:clang-tidy --build_tag_filters=-noclangtidy
build:clang-tidy --copt=-Wno-pragma-once-outside-header

build:clang-format --aspects=@bazel_clang_format//:defs.bzl%check_aspect
build:clang-format --output_groups=report
build:clang-format --@bazel_clang_format//:config=//tools/clang-format:clang-format-config
build:clang-format --build_tag_filters=-noclangtidy

build:clang-format-fix --aspects=@bazel_clang_format//:defs.bzl%fix_aspect
build:clang-format-fix --output_groups=report
build:clang-format-fix --use_action_cache=false
build:clang-format-fix --@bazel_clang_format//:config=//tools/clang-format:clang-format-config
7 changes: 5 additions & 2 deletions udf-runner-cpp/v2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cc_binary(

cc_test(
name = "udf_protocol_symbol_leak_test",
srcs = ["udf_protocol_symbol_leak_test.cc"],
srcs = ["nm_runner.hpp", "udf_protocol_symbol_leak_test.cc"],
copts = ["-std=c++20"],
# The test inspects the built shared object with nm. data makes the
# artifact available at runtime and args passes its runfiles path.
Expand All @@ -121,7 +121,7 @@ cc_test(

cc_test(
name = "udf_protocol_static_symbol_leak_test",
srcs = ["udf_protocol_static_symbol_leak_test.cc"],
srcs = ["nm_runner.hpp", "udf_protocol_static_symbol_leak_test.cc"],
copts = ["-std=c++20"],
# cc_library produces multiple artifacts, so the test receives all
# locations and selects the static .a archive for nm inspection.
Expand All @@ -146,6 +146,9 @@ cc_test(
alias(
name = "arrow_core",
actual = "@v2_arrow//:arrow_core",
# Arrow and its vendored sources are third-party code. Keep them out of
# the repository's clang-tidy and clang-format CI profiles.
tags = ["noclangtidy"],
)

filegroup(
Expand Down
12 changes: 12 additions & 0 deletions udf-runner-cpp/v2/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "flatbuffers", version = "25.2.10")
bazel_dep(name = "google_benchmark", version = "1.9.5")

bazel_dep(
name = "rules_clang_tidy",
version = "0.0.0",
dev_dependency = True,
)

bazel_dep(
name = "bazel_clang_format",
version = "0.0.0",
dev_dependency = True,
)

# FlatBuffers currently selects versions of these transitive build tools that
# still use the removed incompatible_use_toolchain_transition rule attribute.
# Override them so the v2 module can be analyzed by Bazel 9.
Expand Down
24 changes: 12 additions & 12 deletions udf-runner-cpp/v2/arrow_c_data_demo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ arrow::Result<std::shared_ptr<arrow::RecordBatch>> MakeDemoRecordBatch() {

arrow::Status ExportDemoRecordBatch(ArrowArray* out_array, ArrowSchema* out_schema) {
if (out_array == nullptr || out_schema == nullptr) {
return arrow::Status::Invalid("output ArrowArray and ArrowSchema pointers must not be null");
return arrow::Status::Invalid(
"output ArrowArray and ArrowSchema pointers must not be null");
}

std::memset(out_array, 0, sizeof(*out_array));
Expand All @@ -64,8 +65,10 @@ arrow::Status ExportDemoRecordBatch(ArrowArray* out_array, ArrowSchema* out_sche
return arrow::Status::OK();
}

arrow::Status ConsumeDemoRecordBatch(ArrowArray* array, ArrowSchema* schema,
int64_t* out_row_count, int64_t* out_id_sum) {
arrow::Status ConsumeDemoRecordBatch(ArrowArray* array,
ArrowSchema* schema,
int64_t* out_row_count,
int64_t* out_id_sum) {
if (array == nullptr || schema == nullptr || out_row_count == nullptr ||
out_id_sum == nullptr) {
return arrow::Status::Invalid("input and output pointers must not be null");
Expand All @@ -75,12 +78,11 @@ arrow::Status ConsumeDemoRecordBatch(ArrowArray* array, ArrowSchema* schema,
if (batch->num_columns() != 2) {
return arrow::Status::Invalid("expected two columns");
}
if (batch->schema()->field(0)->name() != "id" ||
batch->schema()->field(1)->name() != "name") {
if (batch->schema()->field(0)->name() != "id" || batch->schema()->field(1)->name() != "name") {
return arrow::Status::Invalid("unexpected schema");
}

auto ids = std::static_pointer_cast<arrow::Int64Array>(batch->column(0));
auto ids = std::static_pointer_cast<arrow::Int64Array>(batch->column(0));
int64_t sum = 0;
for (int64_t index = 0; index < ids->length(); ++index) {
if (!ids->IsNull(index)) {
Expand All @@ -89,11 +91,11 @@ arrow::Status ConsumeDemoRecordBatch(ArrowArray* array, ArrowSchema* schema,
}

*out_row_count = batch->num_rows();
*out_id_sum = sum;
*out_id_sum = sum;
return arrow::Status::OK();
}

} // namespace
} // namespace

extern "C" UDF_RUNNER_CPP_V2_EXPORT int udf_runner_cpp_v2_demo_export_record_batch(
ArrowArray* out_array, ArrowSchema* out_schema) {
Expand All @@ -107,10 +109,8 @@ extern "C" UDF_RUNNER_CPP_V2_EXPORT int udf_runner_cpp_v2_demo_export_record_bat
}

extern "C" UDF_RUNNER_CPP_V2_EXPORT int udf_runner_cpp_v2_demo_consume_record_batch(
ArrowArray* array, ArrowSchema* schema, int64_t* out_row_count,
int64_t* out_id_sum) {
const arrow::Status status =
ConsumeDemoRecordBatch(array, schema, out_row_count, out_id_sum);
ArrowArray* array, ArrowSchema* schema, int64_t* out_row_count, int64_t* out_id_sum) {
const arrow::Status status = ConsumeDemoRecordBatch(array, schema, out_row_count, out_id_sum);
if (!status.ok()) {
SetLastError(status);
return 1;
Expand Down
10 changes: 5 additions & 5 deletions udf-runner-cpp/v2/arrow_c_data_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ extern "C" {
UDF_RUNNER_CPP_V2_EXPORT int udf_runner_cpp_v2_demo_export_record_batch(
struct ArrowArray* out_array, struct ArrowSchema* out_schema);

UDF_RUNNER_CPP_V2_EXPORT int udf_runner_cpp_v2_demo_consume_record_batch(
struct ArrowArray* array, struct ArrowSchema* schema, int64_t* out_row_count,
int64_t* out_id_sum);
UDF_RUNNER_CPP_V2_EXPORT int udf_runner_cpp_v2_demo_consume_record_batch(struct ArrowArray* array,
struct ArrowSchema* schema,
int64_t* out_row_count,
int64_t* out_id_sum);

UDF_RUNNER_CPP_V2_EXPORT const char* udf_runner_cpp_v2_demo_last_error(void);

#ifdef __cplusplus
} // extern "C"
} // extern "C"
#endif

Loading