Skip to content

New C++ api#8651

Draft
myrrc wants to merge 1 commit into
developfrom
myrrc/cxx2
Draft

New C++ api#8651
myrrc wants to merge 1 commit into
developfrom
myrrc/cxx2

Conversation

@myrrc

@myrrc myrrc commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Replace C++ api with a new one which depends on vortex-ffi. Remove cxx from workspace. Port FFI examples and tests to C++ examples as tests.

Add vx_expression_clone to C FFI.
Remove const modifier from output from vx_expression_not

@myrrc myrrc added the changelog/break A breaking API change label Jul 3, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 3 improved benchmarks
❌ 1 regressed benchmark
✅ 1641 untouched benchmarks
⏩ 4 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rebuild_naive 91.2 µs 105.4 µs -13.45%
WallTime cuda/bitpacked_u8/unpack/3bw[100M] 350.4 µs 299.4 µs +17.05%
Simulation chunked_varbinview_into_canonical[(100, 100)] 307.5 µs 272.5 µs +12.84%
Simulation bitwise_not_vortex_buffer_mut[128] 273.6 ns 244.4 ns +11.93%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing myrrc/cxx2 (de2512a) with develop (f1465af)2

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on develop (596099c) during the generation of this report, so f1465af was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@myrrc myrrc force-pushed the myrrc/cxx2 branch 2 times, most recently from 05babc3 to 5795c45 Compare July 3, 2026 16:35
@myrrc myrrc requested a review from 0ax1 July 3, 2026 16:47
@myrrc myrrc force-pushed the myrrc/cxx2 branch 2 times, most recently from a044015 to a5c7567 Compare July 3, 2026 16:56
@myrrc myrrc added the lang/cpp Relates to the Vortex C++ API label Jul 7, 2026
@myrrc myrrc force-pushed the myrrc/cxx2 branch 7 times, most recently from 6b2036e to 66bfb31 Compare July 8, 2026 10:00
Signed-off-by: Mikhail Kot <mikhail@spiraldb.com>

@0ax1 0ax1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
@@ -490,20 +490,32 @@ jobs:
- uses: ./.github/actions/setup-prebuild
with:
enable-sccache: "true"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't delete vortex-cxx/src/read.rs?

Comment thread .github/workflows/ci.yml
@@ -475,8 +475,8 @@ jobs:
command: check ${{ matrix.checks }}

cxx-test:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta fix up CI breaks.

Comment thread vortex-cxx/vortex.hpp
@@ -0,0 +1,1152 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
#pragma once

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this header checked by .clang-tidy? (and the src file)

Comment thread vortex-cxx/.clang-format
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright the Vortex contributors
NamespaceIndentation: None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we introduce a new formatting here? We have a ref formatting .clang-format at the repo top-level.

Comment thread vortex-cxx/vortex.hpp
};

// 16-bit float
struct f16 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could detect at build time what C++ version the compiler supports and branch on using the C++23 std lib f16 or our custom one.

Comment thread vortex-cxx/vortex.hpp

// Types that a PrimitiveView can hold
template <class T>
concept view_type = primitive_type<T> || std::is_same_v<T, bool>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

primitive_view? view_type in isolation reads vague.

Comment thread vortex-cxx/vortex.hpp
* Estimated count. Throws if not known(). For inexact estimates this is
* is an upper bound.
*/
uint64_t value() const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this API. Why not just have value? What's the flow when the caller passes in the fallback. And why does that need to handled in a method of Estimate?

Comment thread vortex-cxx/vortex.hpp

// List accessors. Valid only on List and FixedSizeList dtypes

DataType list_element() const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every public fn in this PR added needs docs.

Comment thread vortex-cxx/vortex.hpp

namespace dtype {

inline constexpr bool Nullable = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the naming convention we wanna go for? Nullable reads like a type. Google convention is kNullable, using the k prefix for constants.

@vortex-data vortex-data deleted a comment from github-actions Bot Jul 8, 2026

@0ax1 0ax1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second pass

@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright the Vortex contributors
InheritParentConfig: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as for .clang-format. Whatever we do for vortex-cxx should be repo global I think.


int main(int argc, char** argv) {
if (argc != 2) {
std::cerr << "Usage: dtype <file glob>\n";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Isn't it Usage: <dtype> <file glob>\

fs::temp_directory_path() / "hello_vortex_example.vortex";
std::cout << "Writing to: " << out.string() << '\n';

Session session;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> rename to VortexSession, given that session is a generic description?

Comment thread vortex-cxx/tests/CMakeLists.txt

private:
void reset() noexcept {
if (!path_.empty()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about checking the error in tests?

Comment thread vortex-cxx/vortex.cpp
return BytesView(std::move(canonical), std::move(validity), n);
}

Array make_struct(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why actually not && in the signature for the return type?

Comment thread vortex-cxx/vortex.cpp
}

void StructArrayBuilder::Deleter::operator()(
vx_struct_column_builder* ptr) const noexcept {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our rule of thumb for sprinkling noexcept?

Comment thread vortex-cxx/vortex.cpp
bits_ = other.bits_;
bit_offset_ = other.bit_offset_;
all_invalid_ = other.all_invalid_;
other.owner_ = nullptr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is = nullptr responsibility of the assignment operator?

Comment thread vortex-cxx/vortex.cpp
}
session_ = std::move(other.session_);
stream_ = other.stream_;
other.stream_ = ArrowArrayStream{};

@0ax1 0ax1 Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here we do why change other? other.stream_ = ArrowArrayStream{};

Comment thread vortex-cxx/vortex.hpp
#include <utility>
#include <vector>

/**

@0ax1 0ax1 Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, let's think about whether all of this should go into a single header. We can still have a convenience vortex.hpp header with only include statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change lang/cpp Relates to the Vortex C++ API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants