Skip to content

Commit c4feed7

Browse files
authored
Remove duckdb object cache (#7739)
We don't use it anyway as the right way is to use MultiFileSession and get file footers out of it. Signed-off-by: Mikhail Kot <to@myrrc.dev>
1 parent de36b35 commit c4feed7

11 files changed

Lines changed: 2 additions & 417 deletions

File tree

vortex-duckdb/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DUCKDB_SOURCE_COMMIT_URL: &str = "https://github.com/duckdb/duckdb/archive
2020

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

23-
const SOURCE_FILES: [&str; 18] = [
23+
const SOURCE_FILES: [&str; 17] = [
2424
"cpp/client_context.cpp",
2525
"cpp/config.cpp",
2626
"cpp/copy_function.cpp",
@@ -30,7 +30,6 @@ const SOURCE_FILES: [&str; 18] = [
3030
"cpp/expr.cpp",
3131
"cpp/file_system.cpp",
3232
"cpp/logical_type.cpp",
33-
"cpp/object_cache.cpp",
3433
"cpp/replacement_scan.cpp",
3534
"cpp/reusable_dict.cpp",
3635
"cpp/scalar_function.cpp",

vortex-duckdb/cpp/client_context.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
#include "duckdb_vx.h"
5-
64
#include "duckdb_vx/duckdb_diagnostics.h"
5+
76
DUCKDB_INCLUDES_BEGIN
87
#include <duckdb/main/client_context.hpp>
98
#include <duckdb/main/connection.hpp>
10-
#include <duckdb/storage/object_cache.hpp>
119
DUCKDB_INCLUDES_END
1210

1311
extern "C" duckdb_client_context duckdb_vx_connection_get_client_context(duckdb_connection conn) {
@@ -19,16 +17,6 @@ extern "C" duckdb_client_context duckdb_vx_connection_get_client_context(duckdb_
1917
}
2018
}
2119

22-
extern "C" duckdb_vx_object_cache duckdb_client_context_get_object_cache(duckdb_client_context ffi_context) {
23-
try {
24-
auto *context = reinterpret_cast<duckdb::ClientContext *>(ffi_context);
25-
// This is okay because this is a ref to the object cache, this lives as long as the database.
26-
return reinterpret_cast<duckdb_vx_object_cache>(&duckdb::ObjectCache::GetObjectCache(*context));
27-
} catch (...) {
28-
return nullptr;
29-
}
30-
}
31-
3220
extern "C" duckdb_value duckdb_client_context_try_get_current_setting(duckdb_client_context context,
3321
const char *key) {
3422
if (!context || !key) {

vortex-duckdb/cpp/include/duckdb_vx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "duckdb_vx/expr.h"
1313
#include "duckdb_vx/file_system.h"
1414
#include "duckdb_vx/logical_type.h"
15-
#include "duckdb_vx/object_cache.h"
1615
#include "duckdb_vx/reusable_dict.h"
1716
#include "duckdb_vx/replacement_scan.h"
1817
#include "duckdb_vx/scalar_function.h"

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

Lines changed: 0 additions & 31 deletions
This file was deleted.

vortex-duckdb/cpp/object_cache.cpp

Lines changed: 0 additions & 60 deletions
This file was deleted.

vortex-duckdb/src/duckdb/client_context.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
use std::ffi::CStr;
55

6-
use vortex::error::vortex_panic;
7-
86
use crate::cpp;
9-
use crate::duckdb::ObjectCache;
10-
use crate::duckdb::ObjectCacheRef;
117
use crate::duckdb::Value;
128
use crate::lifetime_wrapper;
139

@@ -36,17 +32,6 @@ impl ClientContextRef {
3632
unsafe { &*(self as *const Self) }
3733
}
3834

39-
/// Get the object cache for this client context.
40-
pub fn object_cache(&self) -> &ObjectCacheRef {
41-
unsafe {
42-
let cache = cpp::duckdb_client_context_get_object_cache(self.as_ptr());
43-
if cache.is_null() {
44-
vortex_panic!("Failed to get object cache from client context");
45-
}
46-
ObjectCache::borrow(cache)
47-
}
48-
}
49-
5035
/// Try to get the current value of a configuration setting.
5136
/// Returns None if the setting doesn't exist.
5237
pub fn try_get_current_setting(&self, key: &CStr) -> Option<Value> {

vortex-duckdb/src/duckdb/connection.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -273,45 +273,4 @@ mod tests {
273273
let result = conn.query("DELETE FROM test WHERE id > 1").unwrap();
274274
assert_eq!(result.row_count(), 2);
275275
}
276-
277-
#[derive(Debug, PartialEq)]
278-
struct TestCacheEntry {
279-
data: String,
280-
value: i32,
281-
}
282-
283-
#[test]
284-
fn test_object_cache_put_get() {
285-
let conn = test_connection().unwrap();
286-
let client_context = conn.client_context().unwrap();
287-
let cache = client_context.object_cache();
288-
289-
// Test with a simple struct
290-
let test_entry = TestCacheEntry {
291-
data: "hello world".to_string(),
292-
value: 42,
293-
};
294-
295-
// Store the entry in the cache
296-
cache.put("test_key", test_entry);
297-
298-
// Retrieve it back
299-
let retrieved = cache.get::<TestCacheEntry>("test_key");
300-
assert!(retrieved.is_some());
301-
302-
let retrieved_entry = retrieved.unwrap();
303-
assert_eq!(retrieved_entry.data, "hello world");
304-
assert_eq!(retrieved_entry.value, 42);
305-
}
306-
307-
#[test]
308-
fn test_object_cache_get_nonexistent() {
309-
let conn = test_connection().unwrap();
310-
let client_context = conn.client_context().unwrap();
311-
let cache = client_context.object_cache();
312-
313-
// Try to get a non-existent key
314-
let result = cache.get::<TestCacheEntry>("nonexistent_key");
315-
assert!(result.is_none());
316-
}
317276
}

vortex-duckdb/src/duckdb/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ mod expr;
1313
mod file_system;
1414
mod logical_type;
1515
mod macro_;
16-
mod object_cache;
1716
mod query_result;
1817
mod reusable_dict;
1918
mod scalar_function;
@@ -38,7 +37,6 @@ pub use ddb_string::*;
3837
pub use expr::*;
3938
pub use file_system::*;
4039
pub use logical_type::*;
41-
pub use object_cache::*;
4240
pub use query_result::*;
4341
pub use reusable_dict::*;
4442
pub use scalar_function::*;

vortex-duckdb/src/duckdb/object_cache.rs

Lines changed: 0 additions & 82 deletions
This file was deleted.

vortex-duckdb/src/e2e_test/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
#[cfg(test)]
5-
mod object_cache_test;
64
#[cfg(test)]
75
mod vortex_scan_test;

0 commit comments

Comments
 (0)