Skip to content

Commit 11ada49

Browse files
committed
6627
1 parent 9327a9e commit 11ada49

File tree

23 files changed

+291
-92
lines changed

23 files changed

+291
-92
lines changed

.github/actions/setup-rust/action.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ description: "Toolchain setup and Initial compilation"
33

44
inputs:
55
repo-token:
6-
description: "Deprecated: no longer used. Protoc is now downloaded directly from GitHub releases CDN."
6+
description: "GitHub token for accessing the repository (typically secrets.GITHUB_TOKEN)"
77
required: false
8-
default: ""
8+
default: "${{ github.token }}"
99
toolchain:
1010
description: "optional override for the toolchain version (e.g. nightly)"
1111
required: false
@@ -50,9 +50,23 @@ runs:
5050
- name: Rust Compile Cache
5151
if: inputs.enable-sccache == 'true'
5252
uses: mozilla-actions/sccache-action@v0.0.9
53-
with:
54-
version: "v0.14.0"
5553

5654
- name: Install Protoc (for lance-encoding build step)
5755
if: runner.os != 'Windows'
58-
uses: ./.github/actions/setup-protoc
56+
uses: arduino/setup-protoc@v3
57+
with:
58+
version: "29.3"
59+
repo-token: ${{ inputs.repo-token }}
60+
61+
- name: Install Ninja (for DuckDB build system)
62+
uses: seanmiddleditch/gha-setup-ninja@master
63+
64+
- name: Install Sweep
65+
shell: bash
66+
if: ${{ inputs.timestamp == 'true' && github.ref_name == 'develop' }}
67+
run: cargo install cargo-sweep
68+
69+
- name: Timestamp Cache
70+
shell: bash
71+
if: ${{ inputs.timestamp == 'true' && github.ref_name == 'develop' }}
72+
run: cargo sweep --stamp

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ __pycache__/
1212
# Distribution / packaging
1313
.Python
1414
build/
15+
ninja-build/
1516
develop-eggs/
1617
dist/
1718
downloads/

benchmarks/duckdb-bench/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ impl DuckClient {
9696
// parquet_metadata_cache" when running DuckDB in debug mode.
9797
connection.query("SET parquet_metadata_cache = true")?;
9898

99+
// Try to install/load httpfs for remote data access, but don't fail if unavailable
100+
// (e.g., when using local files or when extension download fails)
101+
//if let Err(e) = connection.query("INSTALL httpfs; LOAD httpfs;") {
102+
// tracing::info!(
103+
// "Failed to load httpfs extension (may not be needed for local files): {e}"
104+
// );
105+
//}
106+
99107
Ok((db, connection))
100108
}
101109

vortex-duckdb/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ fn main() {
465465
.file("cpp/file_system.cpp")
466466
.file("cpp/logical_type.cpp")
467467
.file("cpp/object_cache.cpp")
468+
.file("cpp/reusable_dict.cpp")
468469
.file("cpp/replacement_scan.cpp")
469470
.file("cpp/scalar_function.cpp")
470471
.file("cpp/table_filter.cpp")

vortex-duckdb/cpp/config.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ duckdb_state duckdb_vx_get_config_value(duckdb_config config, const char *key, d
4040

4141
std::string key_str(key);
4242

43-
// First check set_variables (the primary location for config values)
44-
auto set_it = db_config->options.set_variables.find(key_str);
45-
if (set_it != db_config->options.set_variables.end()) {
43+
// First check set_variable_defaults (the primary location for config values)
44+
auto set_it = db_config->options.set_variable_defaults.find(key_str);
45+
if (set_it != db_config->options.set_variable_defaults.end()) {
4646
*out_value = reinterpret_cast<duckdb_value>(new Value(set_it->second));
4747
return DuckDBSuccess;
4848
}
@@ -75,8 +75,9 @@ int duckdb_vx_config_has_key(duckdb_config config, const char *key) {
7575

7676
std::string key_str(key);
7777

78-
// Check if the key exists in set_variables (primary location)
79-
if (db_config->options.set_variables.find(key_str) != db_config->options.set_variables.end()) {
78+
// Check if the key exists in set_variable_defaults (primary location)
79+
if (db_config->options.set_variable_defaults.find(key_str) !=
80+
db_config->options.set_variable_defaults.end()) {
8081
return 1;
8182
}
8283

vortex-duckdb/cpp/include/duckdb_vx.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
#include "duckdb_vx/data_chunk.h"
1111
#include "duckdb_vx/error.h"
1212
#include "duckdb_vx/expr.h"
13-
#include "duckdb_vx/file_system.h"
1413
#include "duckdb_vx/logical_type.h"
1514
#include "duckdb_vx/object_cache.h"
15+
#include "duckdb_vx/reusable_dict.h"
1616
#include "duckdb_vx/replacement_scan.h"
1717
#include "duckdb_vx/scalar_function.h"
18+
#include "duckdb_vx/file_system.h"
1819
#include "duckdb_vx/table_filter.h"
1920
#include "duckdb_vx/table_function.h"
2021
#include "duckdb_vx/value.h"

vortex-duckdb/cpp/include/duckdb_vx/object_cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ typedef void (*duckdb_vx_deleter_fn)(void *ptr);
2020
void duckdb_vx_object_cache_put(duckdb_vx_object_cache object_cache,
2121
const char *key,
2222
void *value,
23+
uint64_t estimated_size,
2324
duckdb_vx_deleter_fn deleter);
2425

2526
// Fetches the key from the object cache, returning nullptr if the key is not present.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+
#pragma once
5+
6+
#include "duckdb.h"
7+
#include "duckdb_vx/error.h"
8+
9+
#ifdef __cplusplus /* If compiled as C++, use C ABI */
10+
extern "C" {
11+
#endif
12+
13+
typedef struct duckdb_vx_reusable_dict_ *duckdb_vx_reusable_dict;
14+
15+
/// Creates a new reusable dictionary from a logical type and size.
16+
/// The returned dictionary can be used with duckdb_vx_vector_dictionary_reusable.
17+
duckdb_vx_reusable_dict duckdb_vx_reusable_dict_create(duckdb_logical_type logical_type, idx_t size);
18+
19+
/// Destroys the reusable dictionary.
20+
void duckdb_vx_reusable_dict_destroy(duckdb_vx_reusable_dict *dict);
21+
22+
/// Clones the reusable dictionary.
23+
duckdb_vx_reusable_dict duckdb_vx_reusable_dict_clone(duckdb_vx_reusable_dict dict);
24+
25+
/// Get the internal vector of the reusable dictionary.
26+
void duckdb_vx_reusable_dict_set_vector(duckdb_vx_reusable_dict reusable, duckdb_vector *out_vector);
27+
28+
/// Creates a dictionary vector using a reusable dictionary and a selection vector.
29+
void duckdb_vx_vector_dictionary_reusable(duckdb_vector vector,
30+
duckdb_vx_reusable_dict reusable,
31+
duckdb_selection_vector sel_vec);
32+
33+
#ifdef __cplusplus /* End C ABI */
34+
}
35+
#endif

vortex-duckdb/cpp/include/duckdb_vx/table_filter.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,16 @@ typedef enum DUCKDB_VX_TABLE_FILTER_TYPE {
2020
DUCKDB_VX_TABLE_FILTER_TYPE_OPTIONAL_FILTER = 6, // executing filter is not required for query correctness
2121
DUCKDB_VX_TABLE_FILTER_TYPE_IN_FILTER = 7, // col IN (C1, C2, C3, ...)
2222
DUCKDB_VX_TABLE_FILTER_TYPE_DYNAMIC_FILTER = 8, // dynamic filters can be updated at run-time
23-
DUCKDB_VX_TABLE_FILTER_TYPE_EXPRESSION_FILTER = 9 // an arbitrary expression
23+
DUCKDB_VX_TABLE_FILTER_TYPE_EXPRESSION_FILTER = 9, // an arbitrary expression
24+
DUCKDB_VX_TABLE_FILTER_TYPE_BLOOM_FILTER =
25+
10 // a probabilistic filter that can test whether a value is in a set of other value
2426
} duckdb_vx_table_filter_type;
2527

2628
typedef struct duckdb_vx_table_filter_set_ *duckdb_vx_table_filter_set;
2729

2830
typedef struct duckdb_vx_table_filter_ *duckdb_vx_table_filter;
2931

30-
/// If a table filter with position idx exists, return its column index,
31-
/// assign the filter to table_filter_out.
32-
/// If such filter doesn't exist, set table_filter_out to nullptr and return 0
33-
/// idx is a position in a filter array sorted by increasing column indices.
34-
///
35-
/// TODO(myrrc) is idx really filter's position or it's a column's idx?
32+
/// Returns the column index associated with idx, if `table_filter_out` is null then the idx is out of bounds.
3633
idx_t duckdb_vx_table_filter_set_get(duckdb_vx_table_filter_set filter_set,
3734
size_t idx,
3835
duckdb_vx_table_filter *table_filter_out);

vortex-duckdb/cpp/object_cache.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ namespace vortex {
1212
class OpaqueWrapper : public duckdb::ObjectCacheEntry {
1313
public:
1414
duckdb::unique_ptr<void, duckdb_vx_deleter_fn> ptr;
15+
duckdb::optional_idx estimated_size;
1516

16-
explicit OpaqueWrapper(void *p, duckdb_vx_deleter_fn del) : ptr(p, del) {
17+
explicit OpaqueWrapper(void *p, duckdb::optional_idx estimated_size, duckdb_vx_deleter_fn del)
18+
: ptr(p, del), estimated_size(estimated_size) {
1719
}
1820
~OpaqueWrapper() override = default;
1921

22+
duckdb::optional_idx GetEstimatedCacheMemory() const override {
23+
return estimated_size;
24+
}
25+
2026
duckdb::string GetObjectType() override {
2127
return "vortex_opaque_wrapper";
2228
}
@@ -32,9 +38,11 @@ class OpaqueWrapper : public duckdb::ObjectCacheEntry {
3238
extern "C" void duckdb_vx_object_cache_put(duckdb_vx_object_cache cache,
3339
const char *key,
3440
void *value,
41+
uint64_t estimated_size,
3542
duckdb_vx_deleter_fn deleter) {
3643
auto object_cache = reinterpret_cast<duckdb::ObjectCache *>(cache);
37-
auto wrapper = duckdb::make_shared_ptr<vortex::OpaqueWrapper>(value, deleter);
44+
auto wrapper =
45+
duckdb::make_shared_ptr<vortex::OpaqueWrapper>(value, duckdb::optional_idx(estimated_size), deleter);
3846
object_cache->Put(std::string(key), wrapper);
3947
}
4048

0 commit comments

Comments
 (0)