Skip to content

New C++ api#8651

Draft
myrrc wants to merge 2 commits into
developfrom
myrrc/cxx2
Draft

New C++ api#8651
myrrc wants to merge 2 commits 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.

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

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation chunked_varbinview_canonical_into[(1000, 10)] 154.7 µs 190.5 µs -18.8%
Simulation chunked_varbinview_into_canonical[(1000, 10)] 206.1 µs 170.1 µs +21.18%

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 (46cf4f5) with develop (aff0bd3)

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.

@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
Comment thread .github/workflows/ci.yml
Comment thread vortex-cxx/vortex.hpp
Comment thread vortex-cxx/.clang-format Outdated
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

Comment thread vortex-cxx/examples/.clang-tidy
Comment thread vortex-cxx/examples/dtype.cpp
Comment thread vortex-cxx/examples/hello-vortex.cpp
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 Outdated
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 Outdated
}

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 Outdated
}
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