Skip to content
Merged
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
22 changes: 6 additions & 16 deletions benchmarks/duckdb-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use vortex_bench::Format;
use vortex_bench::IdempotentPath;
use vortex_bench::generate_duckdb_registration_sql;
use vortex_bench::runner::BenchmarkQueryResult;
use vortex_duckdb::duckdb::Config;
use vortex_duckdb::duckdb::Connection;
use vortex_duckdb::duckdb::Database;
use vortex_duckdb::duckdb::QueryResult;
Expand Down Expand Up @@ -75,30 +74,21 @@ impl DuckClient {
path: Option<PathBuf>,
threads: Option<usize>,
) -> Result<(Database, Connection)> {
let mut config = Config::new().vortex_expect("failed to create duckdb config");

// Set DuckDB thread count if specified
if let Some(thread_count) = threads {
config.set("threads", &format!("{}", thread_count))?;
}

let db = match path {
Some(path) => Database::open_with_config(path, config),
None => Database::open_in_memory_with_config(config),
Some(path) => Database::open(path),
None => Database::open_in_memory(),
}?;

let connection = db.connect()?;
vortex_duckdb::initialize(&db)?;

// Enable Parquet metadata cache for all benchmark runs.
//
if let Some(thread_count) = threads {
connection.query(&format!("SET threads = {thread_count}"))?;
}

// `parquet_metadata_cache` is an extension-specific option that's
// only available after the Parquet extension is loaded. The Parquet
// extension is loaded after the connection is established.
//
// Passing the option to `open_with_config` before leads to
// "Invalid Input Error: The following options were not recognized:
// parquet_metadata_cache" when running DuckDB in debug mode.
connection.query("SET parquet_metadata_cache = true")?;

Ok((db, connection))
Expand Down
30 changes: 14 additions & 16 deletions vortex-duckdb/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,19 @@ const DEFAULT_DUCKDB_VERSION: &str = "1.5.3";

const BUILD_ARTIFACTS: [&str; 3] = ["libduckdb.dylib", "libduckdb.so", "libduckdb_static.a"];

const SOURCE_FILES: [&str; 18] = [
"cpp/client_context.cpp",
"cpp/config.cpp",
const SOURCE_FILES: [&str; 7] = [
"cpp/vortex_duckdb.cpp",
"cpp/copy_function.cpp",
"cpp/data.cpp",
"cpp/data_chunk.cpp",
"cpp/error.cpp",
"cpp/expr.cpp",
"cpp/file_system.cpp",
"cpp/logical_type.cpp",
"cpp/optimizer.cpp",
"cpp/replacement_scan.cpp",
"cpp/reusable_dict.cpp",
"cpp/scalar_function.cpp",
"cpp/table_filter.cpp",
"cpp/table_function.cpp",
"cpp/value.cpp",
"cpp/vector.cpp",
"cpp/vector_buffer.cpp",
];

// Duckdb C API function we use.
// This lowers codegen'd src/cpp.rs by four times.
const DUCKDB_C_API_FUNCTIONS: [&str; 134] = [
const DUCKDB_C_API_FUNCTIONS: [&str; 133] = [
"duckdb_array_type_array_size",
"duckdb_array_type_child_type",
"duckdb_array_vector_get_child",
Expand Down Expand Up @@ -184,7 +173,16 @@ const DUCKDB_C_API_FUNCTIONS: [&str; 134] = [
"duckdb_vector_reference_value",
"duckdb_vector_reference_vector",
"duckdb_vector_size",
"duckdb_vector_to_string",
];

const DUCKDB_C_API_HEADERS: [&str; 7] = [
"cpp/include/vortex_duckdb.h",
"cpp/include/expr.h",
"cpp/include/table_filter.h",
"cpp/include/vector.h",
"cpp/include/copy_function.h",
"cpp/include/table_function.h",
"cpp/include/optimizer.h",
];

const DOWNLOAD_MAX_RETRIES: i32 = 3;
Expand Down Expand Up @@ -462,7 +460,7 @@ fn try_build_duckdb(
/// Generate rust functions with bindgen from C sources.
fn bindgen_c2rust(crate_dir: &Path, duckdb_include_dir: &Path) {
let mut builder = bindgen::Builder::default()
.header("cpp/include/duckdb_vx.h")
.headers(DUCKDB_C_API_HEADERS)
.override_abi(Abi::CUnwind, ".*")
.raw_line("#![allow(dead_code)]")
.raw_line("#![allow(non_camel_case_types)]")
Expand Down
35 changes: 0 additions & 35 deletions vortex-duckdb/cpp/client_context.cpp

This file was deleted.

153 changes: 0 additions & 153 deletions vortex-duckdb/cpp/config.cpp

This file was deleted.

9 changes: 4 additions & 5 deletions vortex-duckdb/cpp/copy_function.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
#include "duckdb_vx/data.hpp"
#include "duckdb_vx/error.hpp"
#include "duckdb_vx/table_function.h"
#include "data.hpp"
#include "error.hpp"
#include "vortex_duckdb.h"
#include "table_function.h"
#include "vortex.h"
#include "duckdb/function/copy_function.hpp"
#include "duckdb/main/capi/capi_internal.hpp"
Expand All @@ -11,8 +12,6 @@
#include "duckdb/parser/parsed_data/create_copy_function_info.hpp"

using namespace duckdb;
using vortex::CData;
using vortex::IntoErrString;

struct CopyBindData final : TableFunctionData {
CopyBindData(unique_ptr<CData> ffi_data) : ffi_data(std::move(ffi_data)) {
Expand Down
29 changes: 0 additions & 29 deletions vortex-duckdb/cpp/data.cpp

This file was deleted.

31 changes: 0 additions & 31 deletions vortex-duckdb/cpp/data_chunk.cpp

This file was deleted.

Loading
Loading