Skip to content

Commit 0df49c3

Browse files
joseph-isaacs0ax1gatesn
authored
feat: partition scans in DuckDB Vortex extension (#3204)
Co-authored-by: Alexander Droste <[email protected]> Co-authored-by: Nicholas Gates <[email protected]>
1 parent fd440d7 commit 0df49c3

File tree

7 files changed

+439
-186
lines changed

7 files changed

+439
-186
lines changed

duckdb-vortex/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ project(${TARGET_NAME}_project)
66
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
77
set(CMAKE_CXX_STANDARD 17)
88

9+
# Allow C++20 designator syntax in C++17
10+
add_compile_options(-Wno-c++20-designator)
11+
912
include(FetchContent)
1013
FetchContent_Declare(
1114
Corrosion
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#pragma once
22

3-
43
// Include Vortex FFI, with the DuckDB FFI feature
54
#ifndef ENABLE_DUCKDB_FFI
65
#define ENABLE_DUCKDB_FFI
76
#endif
87

9-
#include "vortex.h"
8+
#include "vortex.h"

duckdb-vortex/src/include/vortex_error.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ inline void HandleError(vx_error *error) {
99
throw duckdb::InvalidInputException(msg);
1010
}
1111
}
12+
13+
template <typename Func>
14+
auto Try(Func func) {
15+
vx_error *error = nullptr;
16+
auto result = func(&error);
17+
HandleError(error);
18+
return result;
19+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
3+
#include "vortex_common.hpp"
4+
#include "expr/expr.hpp"
5+
6+
class VortexLayoutReader {
7+
public:
8+
explicit VortexLayoutReader(vx_layout_reader *reader) : reader(reader) {
9+
}
10+
11+
~VortexLayoutReader() {
12+
vx_layout_reader_free(reader);
13+
}
14+
15+
static std::shared_ptr<VortexLayoutReader> CreateFromFile(VortexFileReader *file) {
16+
auto reader = Try([&](auto err) { return vx_layout_reader_create(file->file, err); });
17+
return std::make_shared<VortexLayoutReader>(reader);
18+
}
19+
20+
vx_array_stream *Scan(const vx_file_scan_options *options) {
21+
return Try([&](auto err) { return vx_layout_reader_scan(this->reader, options, err); });
22+
}
23+
24+
vx_layout_reader *reader;
25+
};

0 commit comments

Comments
 (0)