Skip to content
3 changes: 2 additions & 1 deletion vortex-cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project(vortex)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_program(SCCACHE_PROGRAM sccache)
if (SCCACHE_PROGRAM)
Expand All @@ -24,7 +25,7 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wpedantic -Wno-dollar-in-identifier-extension")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wno-dollar-in-identifier-extension")

option(VORTEX_ENABLE_TESTING "Enable building test binary for vortex-cxx" OFF)
option(VORTEX_ENABLE_ASAN "Enable address sanitizer" OFF)
Expand Down
3 changes: 2 additions & 1 deletion vortex-cxx/cpp/src/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ DEFINE_BINARY_OP(checked_add)

Expr select(const std::vector<std::string_view> &fields, Expr child) {
::rust::Vec<::rust::String> rs_fields;
for (auto f : fields) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rs_fields.resize(fields.size());
for (size_t i = 0; i < fields.size(); ++i)
    rs_fields[i] = fields[i];

rs_fields.reserve(fields.size());
for (std::string_view f : fields) {
rs_fields.emplace_back(f.data(), f.length());
}
return Expr(ffi::select(rs_fields, std::move(child).IntoImpl()));
Expand Down
3 changes: 0 additions & 3 deletions vortex-cxx/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ project(vortex-examples)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


find_program(SCCACHE_PROGRAM sccache)
if (SCCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
Expand All @@ -32,6 +31,4 @@ if(APPLE)
set(APPLE_LINK_FLAGS "-framework CoreFoundation -framework Security")
endif()


target_link_libraries(hello-vortex PRIVATE vortex ${APPLE_LINK_FLAGS})

8 changes: 4 additions & 4 deletions vortex-duckdb/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
# If your editor relies on a compilation database to enable LSP functionality,
# you can generate it by running `cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON` or
# `bear -- cargo build` (https://github.com/rizsotto/Bear).

cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)
Copy link
Contributor Author

@0ax1 0ax1 Mar 12, 2026

Choose a reason for hiding this comment

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

Just to make the CMake version we use consistent.

project(vortex_duckdb_cpp)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Default to debug if build config is not explicitly set.
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif ()
endif()

# Enable compiler warnings (matching build.rs flags).
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wno-unused-parameter")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this CMake file is not used for building only provided for people using CLion.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")

# Find DuckDB include directory via the symlink created by build.rs.
# The symlink points to target/duckdb-source-vX.Y.Z which contains duckdb-X.Y.Z/
Expand Down
16 changes: 7 additions & 9 deletions vortex-duckdb/cpp/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ duckdb_state duckdb_vx_get_config_value(duckdb_config config, const char *key, d
std::string key_str(key);

// First check set_variable_defaults (the primary location for config values)
auto set_it = db_config->options.set_variable_defaults.find(key_str);
if (set_it != db_config->options.set_variable_defaults.end()) {
*out_value = reinterpret_cast<duckdb_value>(new Value(set_it->second));
if (db_config->options.set_variable_defaults.contains(key_str)) {
*out_value =
reinterpret_cast<duckdb_value>(new Value(db_config->options.set_variable_defaults[key_str]));
return DuckDBSuccess;
}

// Then check user_options
auto user_it = db_config->options.user_options.find(key_str);
if (user_it != db_config->options.user_options.end()) {
*out_value = reinterpret_cast<duckdb_value>(new Value(user_it->second));
if (db_config->options.user_options.contains(key_str)) {
*out_value = reinterpret_cast<duckdb_value>(new Value(db_config->options.user_options[key_str]));
return DuckDBSuccess;
}

Expand All @@ -81,13 +80,12 @@ int duckdb_vx_config_has_key(duckdb_config config, const char *key) {
std::string key_str(key);

// Check if the key exists in set_variable_defaults (primary location)
if (db_config->options.set_variable_defaults.find(key_str) !=
db_config->options.set_variable_defaults.end()) {
if (db_config->options.set_variable_defaults.contains(key_str)) {
return 1;
}

// Check if the key exists in user_options
if (db_config->options.user_options.find(key_str) != db_config->options.user_options.end()) {
if (db_config->options.user_options.contains(key_str)) {
return 1;
}

Expand Down
13 changes: 4 additions & 9 deletions vortex-duckdb/cpp/table_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,8 @@ void c_pushdown_complex_filter(ClientContext & /*context*/,
throw BinderException(IntoErrString(error_out));
}

if (pushed) {
// If the pushdown complex filter returns true, we can remove the filter from the list.
iter = filters.erase(iter);
} else {
++iter;
}
// If the pushdown complex filter returns true, we can remove the filter from the list.
iter = pushed ? filters.erase(iter) : std::next(iter);
}
}

Expand Down Expand Up @@ -257,11 +253,10 @@ extern "C" duckdb_value duckdb_vx_tfunc_bind_input_get_named_parameter(duckdb_vx
}
const auto info = reinterpret_cast<TableFunctionBindInput *>(ffi_input);

auto t = info->named_parameters.find(name);
if (t == info->named_parameters.end()) {
if (!info->named_parameters.contains(name)) {
return nullptr;
}
auto value = duckdb::make_uniq<Value>(t->second);
auto value = duckdb::make_uniq<Value>(info->named_parameters.at(name));
return reinterpret_cast<duckdb_value>(value.release());
}

Expand Down
Loading