From 7f34a5c8f002731e8f670da0daf9c4855199ca58 Mon Sep 17 00:00:00 2001 From: "Shankar.KV" Date: Fri, 11 Sep 2026 13:22:42 +0530 Subject: [PATCH 1/6] Adding clang tidy to bazel via bazelrc and aspect --- .github/workflows/check_bazel_tests.yml | 32 + udf-runner-cpp/v2/.bazelrc | 19 + udf-runner-cpp/v2/MODULE.bazel | 12 + .../v2/tools/clang-format/.clang-format | 83 +++ udf-runner-cpp/v2/tools/clang-format/BUILD | 5 + .../v2/tools/clang-tidy/.clang-tidy | 566 ++++++++++++++++++ udf-runner-cpp/v2/tools/clang-tidy/BUILD | 17 + .../clang-apply-replacements-wrapper.sh | 2 + .../v2/tools/clang-tidy/clang-tidy-wrapper.sh | 2 + 9 files changed, 738 insertions(+) create mode 100644 udf-runner-cpp/v2/.bazelrc create mode 100644 udf-runner-cpp/v2/tools/clang-format/.clang-format create mode 100644 udf-runner-cpp/v2/tools/clang-format/BUILD create mode 100644 udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy create mode 100644 udf-runner-cpp/v2/tools/clang-tidy/BUILD create mode 100755 udf-runner-cpp/v2/tools/clang-tidy/clang-apply-replacements-wrapper.sh create mode 100755 udf-runner-cpp/v2/tools/clang-tidy/clang-tidy-wrapper.sh diff --git a/.github/workflows/check_bazel_tests.yml b/.github/workflows/check_bazel_tests.yml index a24aa99..03d3e32 100644 --- a/.github/workflows/check_bazel_tests.yml +++ b/.github/workflows/check_bazel_tests.yml @@ -15,6 +15,38 @@ env: ZMQ_LIBRARY_PREFIX: /usr/lib/x86_64-linux-gnu ZMQ_INCLUDE_PREFIX: /usr/include jobs: + v2: + runs-on: ubuntu-24.04 + env: + USE_BAZEL_VERSION: 9.0.2 + 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: diff --git a/udf-runner-cpp/v2/.bazelrc b/udf-runner-cpp/v2/.bazelrc new file mode 100644 index 0000000..8411421 --- /dev/null +++ b/udf-runner-cpp/v2/.bazelrc @@ -0,0 +1,19 @@ +# 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-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-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 diff --git a/udf-runner-cpp/v2/MODULE.bazel b/udf-runner-cpp/v2/MODULE.bazel index 5371491..7f560ec 100644 --- a/udf-runner-cpp/v2/MODULE.bazel +++ b/udf-runner-cpp/v2/MODULE.bazel @@ -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. diff --git a/udf-runner-cpp/v2/tools/clang-format/.clang-format b/udf-runner-cpp/v2/tools/clang-format/.clang-format new file mode 100644 index 0000000..48eed84 --- /dev/null +++ b/udf-runner-cpp/v2/tools/clang-format/.clang-format @@ -0,0 +1,83 @@ +######################################################################################################################## +# Copied and slightly adapted from https://github.com/exasol/db/blob/master/.clang-format # +######################################################################################################################## + +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: false +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: true +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 3 +NamespaceIndentation: Inner +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: true +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++20 +TabWidth: 4 +UseTab: Never diff --git a/udf-runner-cpp/v2/tools/clang-format/BUILD b/udf-runner-cpp/v2/tools/clang-format/BUILD new file mode 100644 index 0000000..2d65a0a --- /dev/null +++ b/udf-runner-cpp/v2/tools/clang-format/BUILD @@ -0,0 +1,5 @@ +filegroup( + name = "clang-format-config", + srcs = [".clang-format"], + visibility = ["//visibility:public"], +) diff --git a/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy b/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy new file mode 100644 index 0000000..3432c56 --- /dev/null +++ b/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy @@ -0,0 +1,566 @@ +######################################################################################################################## +# Copied and slightly adapted from https://github.com/exasol/db/blob/master/.clang-tidy.template # +######################################################################################################################## + +# Global canonical list of clang-tidy activated and deactivated checks for full code base. +# Activate Disabled Check: Remove the leading "-" from check entry below if applicable. +# The general rule for check disabling: Discuss/vote with all affected developers if a disable is common sense. +Checks: > + bugprone-argument-comment, + bugprone-assert-side-effect, + bugprone-bad-signal-to-kill-thread, + bugprone-bool-pointer-implicit-conversion, + bugprone-branch-clone, + bugprone-copy-constructor-init, + bugprone-dangling-handle, + bugprone-dynamic-static-initializers, + bugprone-exception-escape, + bugprone-fold-init-type, + bugprone-forward-declaration-namespace, + bugprone-forwarding-reference-overload, + bugprone-inaccurate-erase, + bugprone-incorrect-roundings, + bugprone-infinite-loop, + bugprone-integer-division, + bugprone-lambda-function-name, + bugprone-macro-parentheses, + bugprone-macro-repeated-side-effects, + bugprone-misplaced-operator-in-strlen-in-alloc, + bugprone-misplaced-widening-cast, + bugprone-move-forwarding-reference, + bugprone-multiple-statement-macro, + bugprone-not-null-terminated-result, + bugprone-parent-virtual-call, + bugprone-posix-return, + bugprone-signed-char-misuse, + bugprone-sizeof-container, + bugprone-sizeof-expression, + bugprone-string-constructor, + bugprone-string-integer-assignment, + bugprone-string-literal-with-embedded-nul, + bugprone-suspicious-enum-usage, + bugprone-suspicious-memset-usage, + bugprone-suspicious-missing-comma, + bugprone-suspicious-semicolon, + bugprone-suspicious-string-compare, + bugprone-swapped-arguments, + bugprone-terminating-continue, + bugprone-throw-keyword-missing, + bugprone-too-small-loop-variable, + bugprone-undefined-memory-manipulation, + bugprone-undelegated-constructor, + bugprone-unhandled-self-assignment, + bugprone-unused-raii, + bugprone-unused-return-value, + bugprone-use-after-move, + bugprone-virtual-near-miss, + cert-dcl50-cpp, + cert-dcl58-cpp, + cert-env33-c, + cert-err34-c, + cert-err52-cpp, + cert-err58-cpp, + cert-flp30-c, + cert-mem57-cpp, + cert-msc50-cpp, + cert-msc51-cpp, + cert-oop58-cpp, + clang-analyzer-apiModeling.TrustNonnull, + clang-analyzer-apiModeling.google.GTest, + clang-analyzer-apiModeling.llvm.CastValue, + clang-analyzer-apiModeling.llvm.ReturnValue, + clang-analyzer-core.CallAndMessage, + clang-analyzer-core.DivideZero, + clang-analyzer-core.DynamicTypePropagation, + clang-analyzer-core.NonNullParamChecker, + clang-analyzer-core.NonnilStringConstants, + clang-analyzer-core.NullDereference, + clang-analyzer-core.StackAddrEscapeBase, + clang-analyzer-core.StackAddressEscape, + clang-analyzer-core.UndefinedBinaryOperatorResult, + clang-analyzer-core.VLASize, + clang-analyzer-core.builtin.BuiltinFunctions, + clang-analyzer-core.builtin.NoReturnFunctions, + clang-analyzer-core.uninitialized.ArraySubscript, + clang-analyzer-core.uninitialized.Assign, + clang-analyzer-core.uninitialized.Branch, + clang-analyzer-core.uninitialized.CapturedBlockVariable, + clang-analyzer-core.uninitialized.UndefReturn, + clang-analyzer-cplusplus.InnerPointer, + clang-analyzer-cplusplus.Move, + clang-analyzer-cplusplus.NewDelete, + clang-analyzer-cplusplus.NewDeleteLeaks, + clang-analyzer-cplusplus.PureVirtualCall, + clang-analyzer-cplusplus.SelfAssignment, + clang-analyzer-cplusplus.SmartPtrModeling, + clang-analyzer-cplusplus.VirtualCallModeling, + clang-analyzer-deadcode.DeadStores, + clang-analyzer-fuchsia.HandleChecker, + clang-analyzer-nullability.NullPassedToNonnull, + clang-analyzer-nullability.NullReturnedFromNonnull, + clang-analyzer-nullability.NullabilityBase, + clang-analyzer-nullability.NullableDereferenced, + clang-analyzer-nullability.NullablePassedToNonnull, + clang-analyzer-nullability.NullableReturnedFromNonnull, + clang-analyzer-optin.cplusplus.UninitializedObject, + clang-analyzer-optin.cplusplus.VirtualCall, + clang-analyzer-optin.performance.GCDAntipattern, + clang-analyzer-optin.performance.Padding, + clang-analyzer-optin.portability.UnixAPI, + clang-analyzer-security.FloatLoopCounter, + clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, + clang-analyzer-security.insecureAPI.SecuritySyntaxChecker, + clang-analyzer-security.insecureAPI.UncheckedReturn, + clang-analyzer-security.insecureAPI.bcmp, + clang-analyzer-security.insecureAPI.bcopy, + clang-analyzer-security.insecureAPI.bzero, + clang-analyzer-security.insecureAPI.decodeValueOfObjCType, + clang-analyzer-security.insecureAPI.getpw, + clang-analyzer-security.insecureAPI.gets, + clang-analyzer-security.insecureAPI.mkstemp, + clang-analyzer-security.insecureAPI.mktemp, + clang-analyzer-security.insecureAPI.rand, + clang-analyzer-security.insecureAPI.strcpy, + clang-analyzer-security.insecureAPI.vfork, + clang-analyzer-unix.API, + clang-analyzer-unix.DynamicMemoryModeling, + clang-analyzer-unix.Malloc, + clang-analyzer-unix.MallocSizeof, + clang-analyzer-unix.MismatchedDeallocator, + clang-analyzer-unix.StdCLibraryFunctions, + clang-analyzer-unix.Vfork, + clang-analyzer-unix.cstring.BadSizeArg, + clang-analyzer-unix.cstring.CStringModeling, + clang-analyzer-unix.cstring.NullArg, + clang-analyzer-valist.CopyToSelf, + clang-analyzer-valist.Uninitialized, + clang-analyzer-valist.Unterminated, + clang-analyzer-valist.ValistBase, + cppcoreguidelines-avoid-goto, + cppcoreguidelines-init-variables, + cppcoreguidelines-interfaces-global-init, + cppcoreguidelines-macro-usage, + cppcoreguidelines-narrowing-conversions, + cppcoreguidelines-no-malloc, + cppcoreguidelines-pro-bounds-constant-array-index, + cppcoreguidelines-pro-type-const-cast, + cppcoreguidelines-pro-type-cstyle-cast, + cppcoreguidelines-pro-type-member-init, + cppcoreguidelines-pro-type-static-cast-downcast, + cppcoreguidelines-pro-type-union-access, + cppcoreguidelines-slicing, + cppcoreguidelines-special-member-functions, + fuchsia-multiple-inheritance, + fuchsia-statically-constructed-objects, + fuchsia-trailing-return, + fuchsia-virtual-inheritance, + google-build-explicit-make-pair, + google-build-namespaces, + google-default-arguments, + google-explicit-constructor, + google-global-names-in-headers, + google-readability-avoid-underscore-in-googletest-name, + google-readability-casting, + google-runtime-int, + google-runtime-operator, + google-upgrade-googletest-case, + hicpp-exception-baseclass, + hicpp-multiway-paths-covered, + hicpp-no-assembler, + hicpp-signed-bitwise, + llvm-namespace-comment, + misc-definitions-in-headers, + misc-misplaced-const, + misc-new-delete-overloads, + misc-non-copyable-objects, + misc-non-private-member-variables-in-classes, + misc-redundant-expression, + misc-static-assert, + misc-throw-by-value-catch-by-reference, + misc-unconventional-assign-operator, + misc-uniqueptr-reset-release, + misc-unused-alias-decls, + misc-unused-parameters, + misc-unused-using-decls, + modernize-avoid-bind, + modernize-avoid-c-arrays, + modernize-concat-nested-namespaces, + modernize-deprecated-headers, + modernize-deprecated-ios-base-aliases, + modernize-loop-convert, + modernize-make-shared, + modernize-make-unique, + modernize-pass-by-value, + modernize-raw-string-literal, + modernize-redundant-void-arg, + modernize-replace-auto-ptr, + modernize-replace-random-shuffle, + modernize-shrink-to-fit, + modernize-unary-static-assert, + modernize-use-auto, + modernize-use-bool-literals, + modernize-use-default-member-init, + modernize-use-emplace, + modernize-use-equals-default, + modernize-use-equals-delete, + modernize-use-nodiscard, + modernize-use-noexcept, + modernize-use-nullptr, + modernize-use-override, + modernize-use-transparent-functors, + modernize-use-uncaught-exceptions, + modernize-use-using, + performance-faster-string-find, + performance-for-range-copy, + performance-implicit-conversion-in-loop, + performance-inefficient-algorithm, + performance-inefficient-string-concatenation, + performance-inefficient-vector-operation, + performance-move-const-arg, + performance-move-constructor-init, + performance-no-automatic-move, + performance-noexcept-move-constructor, + performance-trivially-destructible, + performance-type-promotion-in-math-fn, + performance-unnecessary-copy-initialization, + performance-unnecessary-value-param, + portability-simd-intrinsics, + readability-braces-around-statements, + readability-const-return-type, + readability-container-size-empty, + readability-delete-null-pointer, + readability-function-size, + readability-identifier-naming, + readability-implicit-bool-conversion, + readability-inconsistent-declaration-parameter-name, + readability-isolate-declaration, + readability-make-member-function-const, + readability-misleading-indentation, + readability-misplaced-array-index, + readability-named-parameter, + readability-non-const-parameter, + readability-qualified-auto, + readability-redundant-access-specifiers, + readability-redundant-control-flow, + readability-redundant-declaration, + readability-redundant-function-ptr-dereference, + readability-redundant-member-init, + readability-redundant-preprocessor, + readability-redundant-smartptr-get, + readability-redundant-string-cstr, + readability-redundant-string-init, + readability-simplify-boolean-expr, + readability-simplify-subscript-expr, + readability-static-accessed-through-instance, + readability-static-definition-in-anonymous-namespace, + readability-string-compare, + readability-uniqueptr-delete-release, + readability-uppercase-literal-suffix + # The following lists the deactivated checks. + # + # Part 1: New checks in clang 18 yet to be discussed/voted on (SPOT-15632) + # + # -altera-id-dependent-backward-branch, + # -altera-kernel-name-restriction, + # -altera-single-work-item-barrier, + # -altera-struct-pack-align, + # -altera-unroll-loops, + # -bugprone-assignment-in-if-condition, + # -bugprone-casting-through-void, + # -bugprone-chained-comparison, + # -bugprone-compare-pointer-to-member-virtual-function, + # -bugprone-easily-swappable-parameters, + # -bugprone-empty-catch, + # -bugprone-implicit-widening-of-multiplication-result, + # -bugprone-inc-dec-in-conditions, + # -bugprone-incorrect-enable-if, + # -bugprone-misplaced-pointer-arithmetic-in-alloc, + # -bugprone-multi-level-implicit-pointer-conversion, + # -bugprone-multiple-new-in-one-expression, + # -bugprone-no-escape, + # -bugprone-non-zero-enum-to-bool-conversion, + # -bugprone-optional-value-conversion, + # -bugprone-redundant-branch-condition, + # -bugprone-reserved-identifier, + # -bugprone-shared-ptr-array-mismatch, + # -bugprone-signal-handler, + # -bugprone-spuriously-wake-up-functions, + # -bugprone-standalone-empty, + # -bugprone-stringview-nullptr, + # -bugprone-suspicious-include, + # -bugprone-suspicious-memory-comparison, + # -bugprone-suspicious-realloc-usage, + # -bugprone-switch-missing-default-case, + # -bugprone-unchecked-optional-access, + # -bugprone-unhandled-exception-at-new, + # -bugprone-unique-ptr-array-mismatch, + # -bugprone-unsafe-functions, + # -bugprone-unused-local-non-trivial-variable, + # -cert-err33-c, + # -cert-oop57-cpp, + # -clang-analyzer-apiModeling.Errno, + # -clang-analyzer-apiModeling.TrustReturnsNonnull, + # -clang-analyzer-core.BitwiseShift, + # -clang-analyzer-core.CallAndMessageModeling, + # -clang-analyzer-core.uninitialized.NewArraySize, + # -clang-analyzer-cplusplus.PlacementNew, + # -clang-analyzer-cplusplus.StringChecker, + # -clang-analyzer-optin.core.EnumCastOutOfRange, + # -clang-analyzer-security.cert.env.InvalidPtr, + # -clang-analyzer-unix.Errno, + # -clang-analyzer-webkit.NoUncountedMemberChecker, + # -clang-analyzer-webkit.RefCntblBaseVirtualDtor, + # -clang-analyzer-webkit.UncountedLambdaCapturesChecker, + # -concurrency-mt-unsafe, + # -concurrency-thread-canceltype-asynchronous, + # -cppcoreguidelines-avoid-capturing-lambda-coroutines, + # -cppcoreguidelines-avoid-const-or-ref-data-members, + # -cppcoreguidelines-avoid-do-while, + # -cppcoreguidelines-avoid-reference-coroutine-parameters, + # -cppcoreguidelines-avoid-non-const-global-variables, + # -cppcoreguidelines-misleading-capture-default-by-value, + # -cppcoreguidelines-missing-std-forward, + # -cppcoreguidelines-no-suspend-with-lock, + # -cppcoreguidelines-prefer-member-initializer, + # -cppcoreguidelines-rvalue-reference-param-not-moved, + # -cppcoreguidelines-virtual-class-destructor, + # -llvmlibc-callee-namespace, + # -llvmlibc-implementation-in-namespace, + # -llvmlibc-restrict-system-libc-headers, + # -misc-confusable-identifiers, + # -misc-const-correctness, + # -misc-coroutine-hostile-raii, + # -misc-header-include-cycle, + # -misc-include-cleaner, + # -misc-misleading-bidirectional, + # -misc-misleading-identifier, + # -misc-no-recursion, + # -misc-use-anonymous-namespace, + # -modernize-macro-to-enum, + # -modernize-replace-disallow-copy-and-assign-macro, + # -modernize-type-traits, + # -modernize-use-constraints, + # -modernize-use-starts-ends-with, + # -modernize-use-std-numbers, + # -modernize-use-std-print, + # -performance-avoid-endl, + # -performance-enum-size, + # -performance-no-int-to-ptr, + # -performance-noexcept-destructor, + # -performance-noexcept-swap, + # -portability-restrict-system-includes, + # -portability-std-allocator-const, + # -readability-avoid-nested-conditional-operator, + # -readability-avoid-return-with-void-value, + # -readability-avoid-unconditional-preprocessor-if, + # -readability-container-contains, + # -readability-container-data-pointer, + # -readability-duplicate-include, + # -readability-function-cognitive-complexity, + # -readability-identifier-length, + # -readability-operators-representation, + # -readability-redundant-casting, + # -readability-redundant-inline-specifier, + # -readability-reference-to-constructed-temporary, + # -readability-suspicious-call-argument, + # -readability-use-anyofallof, + # + # Part 2: Disabled checks - Genrally disabled after vote. + # + # -cert-dcl21-cpp, + # -cert-err60-cpp, + # -clang-diagnostic-error, + # -clang-diagnostic-unused-command-line-argument, + # -cppcoreguidelines-owning-memory, + # -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + # -cppcoreguidelines-pro-bounds-pointer-arithmetic, + # -cppcoreguidelines-pro-type-reinterpret-cast, + # -cppcoreguidelines-pro-type-vararg, + # -fuchsia-default-arguments-calls, + # -fuchsia-default-arguments-declarations, + # -fuchsia-overloaded-operator, + # -google-readability-todo, + # -llvm-header-guard, + # -llvm-include-order, + # -modernize-return-braced-init-list, + # -readability-else-after-return, + # -modernize-use-trailing-return-type, + # -readability-avoid-const-params-in-decls, + # + # Part 3: Aliases (taken from https://releases.llvm.org/18.1.8/tools/clang/tools/extra/docs/clang-tidy/checks/list.html excluding clang-analyzer-*) + # + # -bugprone-narrowing-conversions, # cppcoreguidelines-narrowing-conversions + # -cert-con36-c, # bugprone-spuriously-wake-up-functions + # -cert-con54-cpp, # bugprone-spuriously-wake-up-functions + # -cert-dcl37-c, # bugprone-reserved-identifier + # -cert-dcl51-cpp, # bugprone-reserved-identifier + # -cert-dcl03-c, # misc-static-assert + # -cert-dcl16-c, # readability-uppercase-literal-suffix + # -cert-dcl54-cpp, # misc-new-delete-overloads + # -cert-dcl59-cpp, # google-build-namespaces + # -cert-err09-cpp, # misc-throw-by-value-catch-by-reference + # -cert-err61-cpp, # misc-throw-by-value-catch-by-reference + # -cert-exp42-c, # bugprone-suspicious-memory-comparison + # -cert-fio38-c, # misc-non-copyable-objects + # -cert-flp37-c, # bugprone-suspicious-memory-comparison + # -cert-msc24-c, # bugprone-unsafe-functions + # -cert-msc30-c, # cert-msc50-cpp + # -cert-msc32-c, # cert-msc51-cpp + # -cert-msc33-c, # bugprone-unsafe-functions + # -cert-msc54-cpp, # bugprone-signal-handler + # -cert-oop11-cpp, # performance-move-constructor-init + # -cert-oop54-cpp, # bugprone-unhandled-self-assignment + # -cert-pos44-c, # bugprone-bad-signal-to-kill-thread + # -cert-pos47-c, # concurrency-thread-canceltype-asynchronous + # -cert-sig30-c, # bugprone-signal-handler + # -cert-str34-c, # bugprone-signed-char-misuse + # -clang-analyzer-optin.mpi.MPI-Checker, # Clang Static Analyzer optin.mpi.MPI-Checker + # -clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, # Clang Static Analyzer optin.osx.cocoa.localizability.EmptyLocalizationContextChecker + # -clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker, # Clang Static Analyzer optin.osx.cocoa.localizability.NonLocalizedStringChecker + # -clang-analyzer-osx.API, # Clang Static Analyzer osx.API + # -clang-analyzer-osx.SecKeychainAPI, # Clang Static Analyzer osx.SecKeychainAPI + # -clang-analyzer-osx.cocoa.AtSync, # Clang Static Analyzer osx.cocoa.AtSync + # -clang-analyzer-osx.cocoa.ClassRelease, # Clang Static Analyzer osx.cocoa.ClassRelease + # -clang-analyzer-osx.cocoa.Dealloc, # Clang Static Analyzer osx.cocoa.Dealloc + # -clang-analyzer-osx.cocoa.IncompatibleMethodTypes, # Clang Static Analyzer osx.cocoa.IncompatibleMethodTypes + # -clang-analyzer-osx.cocoa.NSAutoreleasePool, # Clang Static Analyzer osx.cocoa.NSAutoreleasePool + # -clang-analyzer-osx.cocoa.NSError, # Clang Static Analyzer osx.cocoa.NSError + # -clang-analyzer-osx.cocoa.NilArg, # Clang Static Analyzer osx.cocoa.NilArg + # -clang-analyzer-osx.cocoa.ObjCGenerics, # Clang Static Analyzer osx.cocoa.ObjCGenerics + # -clang-analyzer-osx.cocoa.RetainCount, # Clang Static Analyzer osx.cocoa.RetainCount + # -clang-analyzer-osx.cocoa.SelfInit, # Clang Static Analyzer osx.cocoa.SelfInit + # -clang-analyzer-osx.cocoa.SuperDealloc, # Clang Static Analyzer osx.cocoa.SuperDealloc + # -clang-analyzer-osx.cocoa.UnusedIvars, # Clang Static Analyzer osx.cocoa.UnusedIvars + # -clang-analyzer-osx.cocoa.VariadicMethodTypes, # Clang Static Analyzer osx.cocoa.VariadicMethodTypes + # -clang-analyzer-osx.coreFoundation.CFError, # Clang Static Analyzer osx.coreFoundation.CFError + # -clang-analyzer-osx.coreFoundation.CFNumber, # Clang Static Analyzer osx.coreFoundation.CFNumber + # -clang-analyzer-osx.coreFoundation.CFRetainRelease, # Clang Static Analyzer osx.coreFoundation.CFRetainRelease + # -clang-analyzer-osx.coreFoundation.containers.OutOfBounds, # Clang Static Analyzer osx.coreFoundation.containers.OutOfBounds + # -clang-analyzer-osx.coreFoundation.containers.PointerSizedValues, # Clang Static Analyzer osx.coreFoundation.containers.PointerSizedValues + # -cppcoreguidelines-avoid-c-arrays, # modernize-avoid-c-arrays + # -cppcoreguidelines-avoid-magic-numbers, # readability-magic-numbers + # -cppcoreguidelines-c-copy-assignment-signature, # misc-unconventional-assign-operator + # -cppcoreguidelines-explicit-virtual-functions, # modernize-use-override + # -cppcoreguidelines-macro-to-enum, # modernize-macro-to-enum + # -cppcoreguidelines-noexcept-destructor, # performance-noexcept-destructor + # -cppcoreguidelines-noexcept-move-operations, # performance-noexcept-move-constructor + # -cppcoreguidelines-noexcept-swap, # performance-noexcept-swap + # -cppcoreguidelines-non-private-member-variables-in-classes, # misc-non-private-member-variables-in-classes + # -cppcoreguidelines-use-default-member-init, # modernize-use-default-member-init + # -fuchsia-header-anon-namespaces, # google-build-namespaces + # -google-readability-braces-around-statements, # readability-braces-around-statements + # -google-readability-function-size, # readability-function-size + # -google-readability-namespace-comments, # llvm-namespace-comment + # -hicpp-avoid-c-arrays, # modernize-avoid-c-arrays + # -hicpp-braces-around-statements, # readability-braces-around-statements + # -hicpp-deprecated-headers, # modernize-deprecated-headers + # -hicpp-explicit-conversions, # google-explicit-constructor + # -hicpp-function-size, # readability-function-size + # -hicpp-ignored-remove-result, # bugprone-unused-return-value + # -hicpp-invalid-access-moved, # bugprone-use-after-move + # -hicpp-member-init, # cppcoreguidelines-pro-type-member-init + # -hicpp-move-const-arg, # performance-move-const-arg + # -hicpp-named-parameter, # readability-named-parameter + # -hicpp-new-delete-operators, # misc-new-delete-overloads + # -hicpp-no-array-decay, # cppcoreguidelines-pro-bounds-array-to-pointer-decay + # -hicpp-no-malloc, # cppcoreguidelines-no-malloc + # -hicpp-noexcept-move, # performance-noexcept-move-constructor + # -hicpp-special-member-functions, # cppcoreguidelines-special-member-functions + # -hicpp-static-assert, # misc-static-assert + # -hicpp-undelegated-constructor, # bugprone-undelegated-constructor + # -hicpp-uppercase-literal-suffix, # readability-uppercase-literal-suffix + # -hicpp-use-auto, # modernize-use-auto + # -hicpp-use-emplace, # modernize-use-emplace + # -hicpp-use-equals-default, # modernize-use-equals-default + # -hicpp-use-equals-delete, # modernize-use-equals-delete + # -hicpp-use-noexcept, # modernize-use-noexcept + # -hicpp-use-nullptr, # modernize-use-nullptr + # -hicpp-use-override, # modernize-use-override + # -hicpp-vararg, # cppcoreguidelines-pro-type-vararg + # -llvm-else-after-return, # readability-else-after-return + # -llvm-qualified-auto, # readability-qualified-auto + # abseil suggestion do not apply to our codebase (taken from https://releases.llvm.org/18.1.8/tools/clang/tools/extra/docs/clang-tidy/checks/list.html) + # -abseil-cleanup-ctad, + # -abseil-duration-addition, + # -abseil-duration-comparison, + # -abseil-duration-conversion-cast, + # -abseil-duration-division, + # -abseil-duration-factory-float, + # -abseil-duration-factory-scale, + # -abseil-duration-subtraction, + # -abseil-duration-unnecessary-conversion, + # -abseil-faster-strsplit-delimiter, + # -abseil-no-internal-dependencies, + # -abseil-no-namespace, + # -abseil-redundant-strcat-calls, + # -abseil-str-cat-append, + # -abseil-string-find-startswith, + # -abseil-string-find-str-contains, + # -abseil-time-comparison, + # -abseil-time-subtraction, + # -abseil-upgrade-duration-conversions, + # SPOT-13713: The following checks are irrelevant to our codebase + # -android-cloexec-accept, + # -android-cloexec-accept4, + # -android-cloexec-creat, + # -android-cloexec-dup, + # -android-cloexec-epoll-create, + # -android-cloexec-epoll-create1, + # -android-cloexec-fopen, + # -android-cloexec-inotify-init, + # -android-cloexec-inotify-init1, + # -android-cloexec-memfd-create, + # -android-cloexec-open, + # -android-cloexec-pipe, + # -android-cloexec-pipe2, + # -android-cloexec-socket, + # -android-comparison-in-temp-failure-retry, + # -boost-use-to-string, + # -clang-analyzer-optin.osx.OSObjectCStyleCast, + # -clang-analyzer-osx.MIG, + # -clang-analyzer-osx.NSOrCFErrorDerefChecker, + # -clang-analyzer-osx.NumberObjectConversion, + # -clang-analyzer-osx.OSObjectRetainCount, + # -clang-analyzer-osx.ObjCProperty, + # -clang-analyzer-osx.cocoa.AutoreleaseWrite, + # -clang-analyzer-osx.cocoa.Loops, + # -clang-analyzer-osx.cocoa.MissingSuperCall, + # -clang-analyzer-osx.cocoa.NonNilReturnValue, + # -clang-analyzer-osx.cocoa.RetainCountBase, + # -clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak, + # -darwin-avoid-spinlock, + # -darwin-dispatch-once-nonstatic, + # -google-objc-avoid-nsobject-new, + # -google-objc-avoid-throwing-exception, + # -google-objc-function-naming, + # -google-objc-global-variable-declaration, + # -hicpp-avoid-goto, + # -linuxkernel-must-check-errs, + # -llvm-prefer-isa-or-dyn-cast-in-conditionals, + # -llvm-prefer-register-over-unsigned, + # -llvm-twine-local, + # -llvmlibc-inline-function-decl, + # -mpi-buffer-deref, + # -mpi-type-mismatch, + # -objc-assert-equals, + # -objc-avoid-nserror-init, + # -objc-dealloc-in-category, + # -objc-forbidden-subclassing, + # -objc-missing-hash, + # -objc-nsdate-formatter, + # -objc-nsinvocation-argument-lifetime, + # -objc-property-declaration, + # -objc-super-self, + # -openmp-exception-escape, + # -openmp-use-default-none, + # -zircon-temporary-objects, +HeaderFilterRegex: "" +WarningsAsErrors: "*" +CheckOptions: + - key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals + value: 'true' + - key: readability-magic-numbers.IgnoredIntegerValues + value: '1;2;3;4;10' +ExtraArgsBefore: + - "-std=c++17" + - "-xc++" diff --git a/udf-runner-cpp/v2/tools/clang-tidy/BUILD b/udf-runner-cpp/v2/tools/clang-tidy/BUILD new file mode 100644 index 0000000..0d325fb --- /dev/null +++ b/udf-runner-cpp/v2/tools/clang-tidy/BUILD @@ -0,0 +1,17 @@ +filegroup( + name = "config", + srcs = [".clang-tidy"], + visibility = ["//visibility:public"], +) + +filegroup( + name = "wrapper", + srcs = ["clang-tidy-wrapper.sh"], + visibility = ["//visibility:public"], +) + +filegroup( + name = "apply-replacements-wrapper", + srcs = ["clang-apply-replacements-wrapper.sh"], + visibility = ["//visibility:public"], +) diff --git a/udf-runner-cpp/v2/tools/clang-tidy/clang-apply-replacements-wrapper.sh b/udf-runner-cpp/v2/tools/clang-tidy/clang-apply-replacements-wrapper.sh new file mode 100755 index 0000000..d44214c --- /dev/null +++ b/udf-runner-cpp/v2/tools/clang-tidy/clang-apply-replacements-wrapper.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec clang-apply-replacements-22 "$@" diff --git a/udf-runner-cpp/v2/tools/clang-tidy/clang-tidy-wrapper.sh b/udf-runner-cpp/v2/tools/clang-tidy/clang-tidy-wrapper.sh new file mode 100755 index 0000000..3338257 --- /dev/null +++ b/udf-runner-cpp/v2/tools/clang-tidy/clang-tidy-wrapper.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec clang-tidy-22 --removed-arg=-fno-canonical-system-headers "$@" From a811c7b18aece43826a59a3104e17b83d2c06441 Mon Sep 17 00:00:00 2001 From: "Shankar.KV" Date: Fri, 11 Sep 2026 15:55:38 +0530 Subject: [PATCH 2/6] whoever wants rules_swift has to use 3.1.2 ver --- udf-runner-cpp/v2/MODULE.bazel | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udf-runner-cpp/v2/MODULE.bazel b/udf-runner-cpp/v2/MODULE.bazel index 7f560ec..38b240c 100644 --- a/udf-runner-cpp/v2/MODULE.bazel +++ b/udf-runner-cpp/v2/MODULE.bazel @@ -39,6 +39,10 @@ single_version_override( module_name = "aspect_rules_esbuild", version = "0.24.0", ) +single_version_override( + module_name = "rules_swift", + version = "3.1.2", +) http_archive = use_repo_rule( "@bazel_tools//tools/build_defs/repo:http.bzl", From e8ce9f2de2c7560e2b64d675405c5e5711ae313d Mon Sep 17 00:00:00 2001 From: "Shankar.KV" Date: Fri, 11 Sep 2026 16:04:07 +0530 Subject: [PATCH 3/6] remove unnecessary lines --- udf-runner-cpp/v2/tools/clang-format/.clang-format | 4 +--- udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/udf-runner-cpp/v2/tools/clang-format/.clang-format b/udf-runner-cpp/v2/tools/clang-format/.clang-format index 48eed84..6a36218 100644 --- a/udf-runner-cpp/v2/tools/clang-format/.clang-format +++ b/udf-runner-cpp/v2/tools/clang-format/.clang-format @@ -1,6 +1,4 @@ -######################################################################################################################## -# Copied and slightly adapted from https://github.com/exasol/db/blob/master/.clang-format # -######################################################################################################################## + --- Language: Cpp diff --git a/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy b/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy index 3432c56..ccc41d9 100644 --- a/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy +++ b/udf-runner-cpp/v2/tools/clang-tidy/.clang-tidy @@ -1,6 +1,3 @@ -######################################################################################################################## -# Copied and slightly adapted from https://github.com/exasol/db/blob/master/.clang-tidy.template # -######################################################################################################################## # Global canonical list of clang-tidy activated and deactivated checks for full code base. # Activate Disabled Check: Remove the leading "-" from check entry below if applicable. @@ -258,7 +255,7 @@ Checks: > readability-uppercase-literal-suffix # The following lists the deactivated checks. # - # Part 1: New checks in clang 18 yet to be discussed/voted on (SPOT-15632) + # Part 1: New checks in clang 18 yet to be discussed/voted # # -altera-id-dependent-backward-branch, # -altera-kernel-name-restriction, From 4c0c84f33228f4329c6dad10fe09cd68f3418c22 Mon Sep 17 00:00:00 2001 From: "Shankar.KV" Date: Fri, 11 Sep 2026 16:05:57 +0530 Subject: [PATCH 4/6] add the accidentally delete file --- udf-runner-cpp/v2/udf_protocol.fbs | 264 +++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 udf-runner-cpp/v2/udf_protocol.fbs diff --git a/udf-runner-cpp/v2/udf_protocol.fbs b/udf-runner-cpp/v2/udf_protocol.fbs new file mode 100644 index 0000000..2fab908 --- /dev/null +++ b/udf-runner-cpp/v2/udf_protocol.fbs @@ -0,0 +1,264 @@ +// First draft of the wire-level flatbuffer schema for the new UDF protocol. + +namespace exasol.udf.protocol; + +enum BufferTransport : uint8 { + Inline = 0, // buffers follow immediately on the same socket, unframed + Memfd = 1, // buffers are backed by a memfd passed out of band (e.g. SCM_RIGHTS) + OutOfBand = 2, // some other out-of-band mechanism +} + +// A small, self-owned subset of Apache Arrow's Schema.fbs/Message.fbs shape, +// NOT Arrow's own flatbuffer types. We define these natively so producing them +// only requires Arrow's stable public C++ API (Array::length(), +// Array::null_count(), ArrayData::buffers, Field::type(), ...) -- Arrow's own +// bare (unframed) IPC message bytes are only reachable via Arrow-internal +// headers (arrow/ipc/metadata_internal.h, what Flight itself uses), which +// aren't part of the installed public SDK. + +enum Precision : uint8 { Half = 0, Single = 1, Double = 2 } +enum DateUnit : uint8 { Day = 0, Millisecond = 1 } +enum TimeUnit : uint8 { Second = 0, Millisecond = 1, Microsecond = 2, Nanosecond = 3 } +enum IntervalUnit : uint8 { YearMonth = 0, DayTime = 1, MonthDayNano = 2 } +enum UnionMode : uint8 { Sparse = 0, Dense = 1 } + +table Null {} +table Int { bit_width: int32; is_signed: bool; } +table FloatingPoint { precision: Precision; } +table Binary {} +table Utf8 {} +table LargeBinary {} +table LargeUtf8 {} +table BinaryView {} +table Utf8View {} +table FixedSizeBinary { byte_width: int32; } +table Bool {} +table Date { unit: DateUnit; } +table Time { + unit: TimeUnit = Millisecond; + bit_width: int32 = 32; +} +table Timestamp { unit: TimeUnit; timezone: string; } +// Arrow calendar interval storage: +// YearMonth: signed int32 total months. +// DayTime: signed int32 days plus signed int32 milliseconds. +// MonthDayNano: signed int32 months, signed int32 days, and signed int64 nanoseconds. +table Interval { unit: IntervalUnit; } +table Decimal { precision: int32; scale: int32; bit_width: int32 = 128; } +table List {} +table LargeList {} +table ListView {} +table LargeListView {} +table FixedSizeList { list_size: int32; } +table Map { keys_sorted: bool; } +table Union { + mode: UnionMode; + type_ids: [int32]; +} +table Duration { unit: TimeUnit = Millisecond; } +// Trailing underscore mirrors Arrow's own Schema.fbs naming for this union member. +table Struct_ {} +// Run-End Encoded (REE): a compact encoding for runs of values (Arrow's own +// RunEndEncodedType). Has 0 buffers of its own -- no validity bitmap at this +// level, per the Arrow columnar spec -- and exactly 2 children in Field's +// children list, in fixed order: run_ends (an integer type), then values +// (any type). Reused as the storage type for extension types like a +// "range run" encoding (runs of s..s+n-1 instead of RLE's repeated value), +// where n_i is derived as run_ends[i] - run_ends[i-1] instead of being stored. +table RunEndEncoded {} + +union Type { + Null, Int, FloatingPoint, Binary, Utf8, Bool, Decimal, Date, Time, Timestamp, Interval, List, Struct_, Union, + FixedSizeBinary, FixedSizeList, Map, Duration, LargeBinary, LargeUtf8, LargeList, RunEndEncoded, BinaryView, + Utf8View, ListView, LargeListView, +} + +// Mirrors Arrow's own Schema.fbs KeyValue: a single string/string metadata +// entry. +table KeyValue { + key: string; + value: string; +} + +table Field { + name: string (required); + nullable: bool; + type: Type (required); + children: [Field]; // List/view/fixed-size-list's element type, Struct_'s + // member fields, Map's entries field, Union's members, + // or RunEndEncoded's [run_ends, values] pair + // Extension-type annotation, mirroring Arrow's own convention: a field + // representing an extension type is serialized using its storage type for + // `type` above, with the extension name/params carried here as + // ARROW:extension:name / ARROW:extension:metadata entries. A reader that + // doesn't recognize the name falls back to the plain storage type. + custom_metadata: [KeyValue]; +} + +table Schema { + fields: [Field]; +} + +struct FieldNode { + length: int64; + null_count: int64; +} + +struct Buffer { + offset: int64; + length: int64; +} + +table RecordBatchMetadata { + length: int64; + nodes: [FieldNode]; + buffers: [Buffer]; + // For each variable-buffer field in the flattened schema, in preorder, + // records the number of variable buffers belonging to that field. + // Empty when the schema has no variable-buffer fields (for example, no + // Utf8View or BinaryView fields). + variadic_buffer_counts: [int64]; +} + +table Version { + major: uint32; + minor: uint32; +} + +table ServerCapabilities { + supported_version: Version; + // TODO: high level protocol + // TODO: number of worker +} + +table KeepAlive {} + +// A JSON-encoded payload (the common case for call metadata, connection info, +// script content, etc.) or a raw binary payload (escape hatch for large/binary +// values that shouldn't be forced through JSON). +table StringPayload { + value: string; +} + +table BinaryPayload { + value: [ubyte]; +} + +union PayloadValue { + StringPayload, + BinaryPayload, +} + +// Opens a call. The enclosing connection and StreamMessage's stream_id identify +// this call for the connection's lifetime. The connection is implicit in the +// transport session, so it is not encoded in Frame. The same numeric stream_id +// on a different connection identifies a different logical stream. +// +// A call opened while another is active (e.g. a callback opened during Run) is +// just another independent call -- no parent/child link is carried on the wire. +// OpenCall carries no payload of its own: opening payloads travel as +// payloads set on the same StreamMessage instead of a duplicate field here. +// Additional payloads may also be sent later on the same connection-scoped +// stream_id while the call remains active. +table OpenCall { + call_name: string; +} + +// One named payload item sent by either side either on an active call's +// connection-scoped stream_id or on stream_id = 0 without any active call. `name` identifies the +// payload schema/meaning and therefore which parser to use for `payload` on the +// receiving side. +table Payload { + name: string; + payload: PayloadValue; +} + +// A StreamMessage may carry multiple payload items, including the opening +// payload(s) set alongside open_call on the same StreamMessage. Payloads +// may also be sent on a connection-scoped stream_id whose call is already active, or on +// stream_id = 0 without any active call. +table Payloads { + payloads: [Payload]; +} + +table Error { + code: string; + message: string; +} + +// Closes the call on this non-zero stream. When the enclosing StreamMessage +// also has error set, the close is abnormal; otherwise it is normal. +table CloseCall {} + +// Starts or acknowledges connection shutdown. This field is valid only on the +// control stream (stream_id = 0). The receiver replies with CloseConnection, +// then both peers close the underlying transport. +table CloseConnection {} + +// Grants transfer credit for one direction of a call's data stream. size is a +// byte budget for the permitted transfer window. row_id is the position to +// resume from when reset is true -- it is a seek position, not a row- +// correlation field between the two directions. +table Next { + byte_budget: uint32; + reset: bool = false; + row_id: uint64 = 0; +} + +// Sent once per direction of a call's data stream before, or in the same +// StreamMessage as, that direction's first DataRecordBatch. It contains this +// direction's column layout as our own native Schema table (see above -- not +// Arrow's own flatbuffer Schema). It is split from DataRecordBatch because the +// schema is only needed once, not repeated per batch. +// +// When present, correlation fields form an ordered prefix of schema.fields: +// group ID is field 0; row ID follows it, or is field 0 when no group ID is +// present. Call-specific rules decide which combinations are required. +table DataSchema { + schema: Schema; + has_group_id: bool = false; + has_row_id: bool = false; +} + +// Precedes the buffers for one RecordBatch in a direction of a call's data +// stream. metadata is our own native RecordBatchMetadata (row count, per- +// flattened FieldNode, per-buffer Buffer), populated from a real Arrow +// RecordBatch's public introspection API (Array::length(), null_count(), +// ArrayData::buffers) -- not Arrow's own flatbuffer RecordBatch message. The +// actual column buffers are transported separately per buffer_transport; view +// fields additionally use metadata.variadic_buffer_counts to delimit their +// variable buffer portions. +table DataRecordBatch { + buffer_transport: BufferTransport = Inline; + is_end_of_group: bool = false; + metadata: RecordBatchMetadata; +} + +// A StreamMessage is the typed composite payload carried inside a Frame. Each +// field is independently optional, so related parts such as CloseCall and +// Error can travel in one frame. Error without a close field is a non-terminal, +// stream-scoped diagnostic. stream_id = 0 is reserved for out-of-call control +// traffic such as ServerCapabilities, KeepAlive, and CloseConnection. +table StreamMessage { + server_capabilities: ServerCapabilities; + keep_alive: KeepAlive; + open_call: OpenCall; + payloads: Payloads; + close_call: CloseCall; + close_connection: CloseConnection; + next: Next; + data_schema: DataSchema; + data_record_batch: DataRecordBatch; + error: Error; +} + +// The single length-framed message type on the wire. The implicit transport +// connection and stream_id identify a logical stream. stream_id = 0 is the +// per-connection control stream used when client and server exchange messages +// independently of a call. A stream_id is not reused on its connection. +table Frame { + stream_id: uint64; + message: StreamMessage; +} + +root_type Frame; From d668cec4e0c1932e5f96dc02a5a4cedc23648f7d Mon Sep 17 00:00:00 2001 From: "Shankar.KV" Date: Fri, 11 Sep 2026 16:34:51 +0530 Subject: [PATCH 5/6] bring bazel back to 8.3.0 --- .github/workflows/check_bazel_tests.yml | 2 -- udf-runner-cpp/v2/MODULE.bazel | 4 ---- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/check_bazel_tests.yml b/.github/workflows/check_bazel_tests.yml index 03d3e32..19aa5bc 100644 --- a/.github/workflows/check_bazel_tests.yml +++ b/.github/workflows/check_bazel_tests.yml @@ -17,8 +17,6 @@ env: jobs: v2: runs-on: ubuntu-24.04 - env: - USE_BAZEL_VERSION: 9.0.2 steps: - uses: actions/checkout@v6 - name: Install system dependencies diff --git a/udf-runner-cpp/v2/MODULE.bazel b/udf-runner-cpp/v2/MODULE.bazel index 38b240c..7f560ec 100644 --- a/udf-runner-cpp/v2/MODULE.bazel +++ b/udf-runner-cpp/v2/MODULE.bazel @@ -39,10 +39,6 @@ single_version_override( module_name = "aspect_rules_esbuild", version = "0.24.0", ) -single_version_override( - module_name = "rules_swift", - version = "3.1.2", -) http_archive = use_repo_rule( "@bazel_tools//tools/build_defs/repo:http.bzl", From 0f1e95ce81515551709ec5b5d9fee912856f0aed Mon Sep 17 00:00:00 2001 From: "Shankar.KV" Date: Sat, 12 Sep 2026 17:56:00 +0530 Subject: [PATCH 6/6] let clang-tidy not inspect third_party folder --- udf-runner-cpp/v2/.bazelrc | 3 +++ udf-runner-cpp/v2/BUILD.bazel | 3 +++ 2 files changed, 6 insertions(+) diff --git a/udf-runner-cpp/v2/.bazelrc b/udf-runner-cpp/v2/.bazelrc index 8411421..644d06a 100644 --- a/udf-runner-cpp/v2/.bazelrc +++ b/udf-runner-cpp/v2/.bazelrc @@ -8,10 +8,13 @@ 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 diff --git a/udf-runner-cpp/v2/BUILD.bazel b/udf-runner-cpp/v2/BUILD.bazel index b58b2d2..1b6a2f4 100644 --- a/udf-runner-cpp/v2/BUILD.bazel +++ b/udf-runner-cpp/v2/BUILD.bazel @@ -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(