Skip to content

Commit d9f354b

Browse files
authored
release: bump to vortex 0.36.1 (#9)
Signed-off-by: Alexander Droste <[email protected]>
1 parent e105b09 commit d9f354b

File tree

5 files changed

+186
-99
lines changed

5 files changed

+186
-99
lines changed

src/include/vortex_common.hpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct FileReader {
8282
vx_file_reader *file;
8383
};
8484

85+
8586
struct Array {
8687
explicit Array(vx_array *array) : array(array) {
8788
}
@@ -107,12 +108,25 @@ struct Array {
107108
vx_array *array;
108109
};
109110

111+
110112
struct ArrayIterator {
111113
explicit ArrayIterator(vx_array_iterator *array_iter) : array_iter(array_iter) {
112114
}
113115

116+
/// Releases ownership of the native array iterator ptr to the caller. The caller is then responsible for
117+
/// eventually calling vx_array_iter_free.
118+
///
119+
/// This ArrayIterator is useless after this call.
120+
vx_array_iterator* release() {
121+
auto* ptr = array_iter;
122+
array_iter = nullptr; // Give up ownership
123+
return ptr;
124+
}
125+
114126
~ArrayIterator() {
115-
vx_array_iter_free(array_iter);
127+
if (array_iter) {
128+
vx_array_iter_free(array_iter);
129+
}
116130
}
117131

118132
duckdb::unique_ptr<Array> NextArray() const {
@@ -128,6 +142,32 @@ struct ArrayIterator {
128142
vx_array_iterator *array_iter;
129143
};
130144

145+
146+
struct ArrayExporter {
147+
explicit ArrayExporter(vx_duckdb_exporter *exporter) : exporter(exporter) {
148+
}
149+
150+
~ArrayExporter() {
151+
if (exporter != nullptr) {
152+
vx_duckdb_exporter_free(exporter);
153+
}
154+
}
155+
156+
static duckdb::unique_ptr<ArrayExporter> FromArrayIterator(duckdb::unique_ptr<ArrayIterator> array_iter) {
157+
auto exporter = Try([&](auto err) {
158+
return vx_duckdb_exporter_create(array_iter->release(), err);
159+
});
160+
return duckdb::make_uniq<ArrayExporter>(exporter);
161+
}
162+
163+
bool ExportNext(duckdb_data_chunk output) const {
164+
return Try([&](auto err) { return vx_duckdb_exporter_next(exporter, output, err); });
165+
}
166+
167+
vx_duckdb_exporter *exporter;
168+
};
169+
170+
131171
struct ArrayStreamSink {
132172
explicit ArrayStreamSink(vx_array_sink *sink, duckdb::unique_ptr<DType> dtype)
133173
: sink(sink), dtype(std::move(dtype)) {

src/include/vortex_expr.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
#include "expr.pb.h"
77

88
namespace vortex {
9+
// vortex expr proto ids.
10+
const std::string BETWEEN_ID = "between";
11+
const std::string BINARY_ID = "binary";
12+
const std::string GET_ITEM_ID = "get_item";
13+
const std::string IDENTITY_ID = "identity";
14+
const std::string LIKE_ID = "like";
15+
const std::string LITERAL_ID = "literal";
16+
const std::string NOT_ID = "not";
17+
918
vortex::expr::Expr *table_expression_into_expr(google::protobuf::Arena &arena, duckdb::TableFilter &filter,
1019
const std::string &column_name);
1120
vortex::expr::Expr *expression_into_vortex_expr(google::protobuf::Arena &arena, const duckdb::Expression &expr);

src/vortex_expr.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ using std::string;
3333

3434
namespace vortex {
3535

36-
// vortex expr proto ids.
37-
const string BETWEEN_ID = "between";
38-
const string BINARY_ID = "binary";
39-
const string GET_ITEM_ID = "get_item";
40-
const string IDENTITY_ID = "identity";
41-
const string LIKE_ID = "like";
42-
const string LITERAL_ID = "literal";
43-
const string NOT_ID = "not";
44-
4536
// Temporal ids
4637
const string VORTEX_DATE_ID = "vortex.date";
4738
const string VORTEX_TIME_ID = "vortex.time";

0 commit comments

Comments
 (0)