duckdb 0.8.2-dev2320.0 → 0.8.2-dev2399.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +7 -7
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datefunc.cpp +9 -0
- package/src/duckdb/extension/icu/icu-datepart.cpp +7 -5
- package/src/duckdb/extension/icu/icu-strptime.cpp +1 -20
- package/src/duckdb/extension/parquet/parquet_writer.cpp +1 -0
- package/src/duckdb/src/common/adbc/adbc.cpp +8 -3
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +4 -4
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +27 -26
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +5 -5
- package/src/duckdb/src/common/types/list_segment.cpp +42 -134
- package/src/duckdb/src/common/types/vector.cpp +21 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +5 -7
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +17 -19
- package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +80 -61
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +6 -0
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +11 -5
- package/src/duckdb/src/execution/window_executor.cpp +18 -20
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +2 -2
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +4 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +9 -11
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +7 -2
- package/src/duckdb/src/include/duckdb/execution/perfect_aggregate_hashtable.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +0 -2
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +0 -1
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +1 -2
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +0 -2
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/client_properties.hpp +25 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +1 -13
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +1 -1
- package/src/duckdb/src/main/capi/arrow-c.cpp +1 -7
- package/src/duckdb/src/main/client_context.cpp +15 -2
- package/src/duckdb/src/main/database.cpp +0 -9
- package/src/duckdb/src/main/query_result.cpp +0 -8
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +3 -0
- package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +2 -4
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_options.hpp +0 -25
package/binding.gyp
CHANGED
@@ -244,18 +244,18 @@
|
|
244
244
|
"src/duckdb/third_party/zstd/compress/zstd_lazy.cpp",
|
245
245
|
"src/duckdb/third_party/zstd/compress/zstd_ldm.cpp",
|
246
246
|
"src/duckdb/third_party/zstd/compress/zstd_opt.cpp",
|
247
|
-
"src/duckdb/extension/icu/./icu_extension.cpp",
|
248
|
-
"src/duckdb/extension/icu/./icu-datetrunc.cpp",
|
249
|
-
"src/duckdb/extension/icu/./icu-datepart.cpp",
|
250
247
|
"src/duckdb/extension/icu/./icu-strptime.cpp",
|
248
|
+
"src/duckdb/extension/icu/./icu-datepart.cpp",
|
249
|
+
"src/duckdb/extension/icu/./icu-datesub.cpp",
|
251
250
|
"src/duckdb/extension/icu/./icu-table-range.cpp",
|
252
|
-
"src/duckdb/extension/icu/./icu-
|
253
|
-
"src/duckdb/extension/icu/./icu-datefunc.cpp",
|
254
|
-
"src/duckdb/extension/icu/./icu-list-range.cpp",
|
251
|
+
"src/duckdb/extension/icu/./icu-datetrunc.cpp",
|
255
252
|
"src/duckdb/extension/icu/./icu-timebucket.cpp",
|
256
253
|
"src/duckdb/extension/icu/./icu-dateadd.cpp",
|
254
|
+
"src/duckdb/extension/icu/./icu-list-range.cpp",
|
257
255
|
"src/duckdb/extension/icu/./icu-timezone.cpp",
|
258
|
-
"src/duckdb/extension/icu/./icu-
|
256
|
+
"src/duckdb/extension/icu/./icu-datefunc.cpp",
|
257
|
+
"src/duckdb/extension/icu/./icu_extension.cpp",
|
258
|
+
"src/duckdb/extension/icu/./icu-makedate.cpp",
|
259
259
|
"src/duckdb/ub_extension_icu_third_party_icu_common.cpp",
|
260
260
|
"src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp",
|
261
261
|
"src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp",
|
package/package.json
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
#include "duckdb/common/operator/multiply.hpp"
|
6
6
|
#include "duckdb/common/types/timestamp.hpp"
|
7
7
|
|
8
|
+
#include "unicode/ucal.h"
|
9
|
+
|
8
10
|
namespace duckdb {
|
9
11
|
|
10
12
|
ICUDateFunc::BindData::BindData(const BindData &other)
|
@@ -34,6 +36,13 @@ ICUDateFunc::BindData::BindData(ClientContext &context) {
|
|
34
36
|
if (U_FAILURE(success)) {
|
35
37
|
throw Exception("Unable to create ICU calendar.");
|
36
38
|
}
|
39
|
+
|
40
|
+
// Postgres always assumes times are given in the proleptic Gregorian calendar.
|
41
|
+
// ICU defaults to the Gregorian change in 1582, so we reset the change to the minimum date
|
42
|
+
// so that all dates are proleptic Gregorian.
|
43
|
+
// The only error here is if we have a non-Gregorian calendar,
|
44
|
+
// and we just ignore that and hope for the best...
|
45
|
+
ucal_setGregorianChange((UCalendar *)calendar.get(), U_DATE_MIN, &success); // NOLINT
|
37
46
|
}
|
38
47
|
|
39
48
|
bool ICUDateFunc::BindData::Equals(const FunctionData &other_p) const {
|
@@ -109,11 +109,8 @@ struct ICUDatePart : public ICUDateFunc {
|
|
109
109
|
|
110
110
|
static int64_t ExtractEpoch(icu::Calendar *calendar, const uint64_t micros) {
|
111
111
|
UErrorCode status = U_ZERO_ERROR;
|
112
|
-
auto millis = calendar->getTime(status);
|
113
|
-
millis += ExtractField(calendar, UCAL_ZONE_OFFSET);
|
114
|
-
millis += ExtractField(calendar, UCAL_DST_OFFSET);
|
115
112
|
// Truncate
|
116
|
-
return
|
113
|
+
return calendar->getTime(status) / Interval::MSECS_PER_SEC;
|
117
114
|
}
|
118
115
|
|
119
116
|
static int64_t ExtractTimezone(icu::Calendar *calendar, const uint64_t micros) {
|
@@ -200,7 +197,12 @@ struct ICUDatePart : public ICUDateFunc {
|
|
200
197
|
|
201
198
|
calendar->set(UCAL_DATE, dd);
|
202
199
|
|
203
|
-
|
200
|
+
// Offset to UTC
|
201
|
+
auto millis = calendar->getTime(status);
|
202
|
+
millis += ExtractField(calendar, UCAL_ZONE_OFFSET);
|
203
|
+
millis += ExtractField(calendar, UCAL_DST_OFFSET);
|
204
|
+
|
205
|
+
return Date::EpochToDate(millis / Interval::MSECS_PER_SEC);
|
204
206
|
}
|
205
207
|
|
206
208
|
static string_t MonthName(icu::Calendar *calendar, const uint64_t micros) {
|
@@ -273,26 +273,7 @@ struct ICUStrptime : public ICUDateFunc {
|
|
273
273
|
}
|
274
274
|
|
275
275
|
// Now get the parts in the given time zone
|
276
|
-
|
277
|
-
dtime_t t;
|
278
|
-
Timestamp::Convert(result, d, t);
|
279
|
-
|
280
|
-
int32_t data[7];
|
281
|
-
Date::Convert(d, data[0], data[1], data[2]);
|
282
|
-
calendar->set(UCAL_EXTENDED_YEAR, data[0]); // strptime doesn't understand eras
|
283
|
-
calendar->set(UCAL_MONTH, data[1] - 1);
|
284
|
-
calendar->set(UCAL_DATE, data[2]);
|
285
|
-
|
286
|
-
Time::Convert(t, data[3], data[4], data[5], data[6]);
|
287
|
-
calendar->set(UCAL_HOUR_OF_DAY, data[3]);
|
288
|
-
calendar->set(UCAL_MINUTE, data[4]);
|
289
|
-
calendar->set(UCAL_SECOND, data[5]);
|
290
|
-
|
291
|
-
int32_t millis = data[6] / Interval::MICROS_PER_MSEC;
|
292
|
-
uint64_t micros = data[6] % Interval::MICROS_PER_MSEC;
|
293
|
-
calendar->set(UCAL_MILLISECOND, millis);
|
294
|
-
|
295
|
-
result = GetTime(calendar, micros);
|
276
|
+
result = FromNaive(calendar, result);
|
296
277
|
}
|
297
278
|
|
298
279
|
return result;
|
@@ -297,6 +297,7 @@ void ParquetWriter::PrepareRowGroup(ColumnDataCollection &buffer, PreparedRowGro
|
|
297
297
|
// set up a new row group for this chunk collection
|
298
298
|
auto &row_group = result.row_group;
|
299
299
|
row_group.num_rows = buffer.Count();
|
300
|
+
row_group.total_byte_size = buffer.SizeInBytes();
|
300
301
|
row_group.__isset.file_offset = true;
|
301
302
|
|
302
303
|
auto &states = result.states;
|
@@ -202,14 +202,15 @@ AdbcStatusCode ConnectionGetTableSchema(struct AdbcConnection *connection, const
|
|
202
202
|
SetError(error, "Connection is not set");
|
203
203
|
return ADBC_STATUS_INVALID_ARGUMENT;
|
204
204
|
}
|
205
|
+
if (db_schema == nullptr) {
|
206
|
+
// if schema is not set, we use the default schema
|
207
|
+
db_schema = "main";
|
208
|
+
}
|
205
209
|
if (catalog != nullptr && strlen(catalog) > 0) {
|
206
210
|
// In DuckDB this is the name of the database, not sure what's the expected functionality here, so for now,
|
207
211
|
// scream.
|
208
212
|
SetError(error, "Catalog Name is not used in DuckDB. It must be set to nullptr or an empty string");
|
209
213
|
return ADBC_STATUS_NOT_IMPLEMENTED;
|
210
|
-
} else if (db_schema == nullptr) {
|
211
|
-
SetError(error, "AdbcConnectionGetTableSchema: must provide db_schema");
|
212
|
-
return ADBC_STATUS_INVALID_ARGUMENT;
|
213
214
|
} else if (table_name == nullptr) {
|
214
215
|
SetError(error, "AdbcConnectionGetTableSchema: must provide table_name");
|
215
216
|
return ADBC_STATUS_INVALID_ARGUMENT;
|
@@ -686,6 +687,10 @@ AdbcStatusCode QueryInternal(struct AdbcConnection *connection, struct ArrowArra
|
|
686
687
|
AdbcStatusCode ConnectionGetObjects(struct AdbcConnection *connection, int depth, const char *catalog,
|
687
688
|
const char *db_schema, const char *table_name, const char **table_type,
|
688
689
|
const char *column_name, struct ArrowArrayStream *out, struct AdbcError *error) {
|
690
|
+
if (depth != 0) {
|
691
|
+
SetError(error, "Depth parameter not yet supported");
|
692
|
+
return ADBC_STATUS_NOT_IMPLEMENTED;
|
693
|
+
}
|
689
694
|
if (catalog != nullptr) {
|
690
695
|
if (strcmp(catalog, "duckdb") == 0) {
|
691
696
|
SetError(error, "catalog must be NULL or 'duckdb'");
|
@@ -14,7 +14,7 @@ namespace duckdb {
|
|
14
14
|
// ArrowAppender
|
15
15
|
//===--------------------------------------------------------------------===//
|
16
16
|
|
17
|
-
ArrowAppender::ArrowAppender(vector<LogicalType> types_p, idx_t initial_capacity,
|
17
|
+
ArrowAppender::ArrowAppender(vector<LogicalType> types_p, idx_t initial_capacity, ClientProperties options)
|
18
18
|
: types(std::move(types_p)) {
|
19
19
|
for (auto &type : types) {
|
20
20
|
auto entry = ArrowAppender::InitializeChild(type, initial_capacity, options);
|
@@ -179,14 +179,14 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic
|
|
179
179
|
case LogicalTypeId::VARCHAR:
|
180
180
|
case LogicalTypeId::BLOB:
|
181
181
|
case LogicalTypeId::BIT:
|
182
|
-
if (append_data.options.
|
182
|
+
if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
|
183
183
|
InitializeAppenderForType<ArrowVarcharData<string_t>>(append_data);
|
184
184
|
} else {
|
185
185
|
InitializeAppenderForType<ArrowVarcharData<string_t, ArrowVarcharConverter, uint32_t>>(append_data);
|
186
186
|
}
|
187
187
|
break;
|
188
188
|
case LogicalTypeId::UUID:
|
189
|
-
if (append_data.options.
|
189
|
+
if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
|
190
190
|
InitializeAppenderForType<ArrowVarcharData<hugeint_t, ArrowUUIDConverter>>(append_data);
|
191
191
|
} else {
|
192
192
|
InitializeAppenderForType<ArrowVarcharData<hugeint_t, ArrowUUIDConverter, uint32_t>>(append_data);
|
@@ -228,7 +228,7 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic
|
|
228
228
|
}
|
229
229
|
|
230
230
|
unique_ptr<ArrowAppendData> ArrowAppender::InitializeChild(const LogicalType &type, idx_t capacity,
|
231
|
-
|
231
|
+
ClientProperties &options) {
|
232
232
|
auto result = make_uniq<ArrowAppendData>(options);
|
233
233
|
InitializeFunctionPointers(*result, type);
|
234
234
|
|
@@ -15,12 +15,21 @@
|
|
15
15
|
|
16
16
|
namespace duckdb {
|
17
17
|
|
18
|
-
void ArrowConverter::ToArrowArray(DataChunk &input, ArrowArray *out_array,
|
18
|
+
void ArrowConverter::ToArrowArray(DataChunk &input, ArrowArray *out_array, ClientProperties options) {
|
19
19
|
ArrowAppender appender(input.GetTypes(), input.size(), std::move(options));
|
20
20
|
appender.Append(input, 0, input.size(), input.size());
|
21
21
|
*out_array = appender.Finalize();
|
22
22
|
}
|
23
23
|
|
24
|
+
unsafe_unique_array<char> AddName(const string &name) {
|
25
|
+
auto name_ptr = make_unsafe_uniq_array<char>(name.size() + 1);
|
26
|
+
for (size_t i = 0; i < name.size(); i++) {
|
27
|
+
name_ptr[i] = name[i];
|
28
|
+
}
|
29
|
+
name_ptr[name.size()] = '\0';
|
30
|
+
return name_ptr;
|
31
|
+
}
|
32
|
+
|
24
33
|
//===--------------------------------------------------------------------===//
|
25
34
|
// Arrow Schema
|
26
35
|
//===--------------------------------------------------------------------===//
|
@@ -45,24 +54,26 @@ static void ReleaseDuckDBArrowSchema(ArrowSchema *schema) {
|
|
45
54
|
delete holder;
|
46
55
|
}
|
47
56
|
|
48
|
-
void InitializeChild(ArrowSchema &child, const string &name = "") {
|
57
|
+
void InitializeChild(ArrowSchema &child, DuckDBArrowSchemaHolder &root_holder, const string &name = "") {
|
49
58
|
//! Child is cleaned up by parent
|
50
59
|
child.private_data = nullptr;
|
51
60
|
child.release = ReleaseDuckDBArrowSchema;
|
52
61
|
|
53
62
|
//! Store the child schema
|
54
63
|
child.flags = ARROW_FLAG_NULLABLE;
|
55
|
-
|
64
|
+
root_holder.owned_type_names.push_back(AddName(name));
|
65
|
+
|
66
|
+
child.name = root_holder.owned_type_names.back().get();
|
56
67
|
child.n_children = 0;
|
57
68
|
child.children = nullptr;
|
58
69
|
child.metadata = nullptr;
|
59
70
|
child.dictionary = nullptr;
|
60
71
|
}
|
61
72
|
void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, const LogicalType &type,
|
62
|
-
const
|
73
|
+
const ClientProperties &options);
|
63
74
|
|
64
75
|
void SetArrowMapFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, const LogicalType &type,
|
65
|
-
const
|
76
|
+
const ClientProperties &options) {
|
66
77
|
child.format = "+m";
|
67
78
|
//! Map has one child which is a struct
|
68
79
|
child.n_children = 1;
|
@@ -70,23 +81,14 @@ void SetArrowMapFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child,
|
|
70
81
|
root_holder.nested_children.back().resize(1);
|
71
82
|
root_holder.nested_children_ptr.emplace_back();
|
72
83
|
root_holder.nested_children_ptr.back().push_back(&root_holder.nested_children.back()[0]);
|
73
|
-
InitializeChild(root_holder.nested_children.back()[0]);
|
84
|
+
InitializeChild(root_holder.nested_children.back()[0], root_holder);
|
74
85
|
child.children = &root_holder.nested_children_ptr.back()[0];
|
75
86
|
child.children[0]->name = "entries";
|
76
87
|
SetArrowFormat(root_holder, **child.children, ListType::GetChildType(type), options);
|
77
88
|
}
|
78
89
|
|
79
|
-
unsafe_unique_array<char> AddName(const string &name) {
|
80
|
-
auto name_ptr = make_unsafe_uniq_array<char>(name.size() + 1);
|
81
|
-
for (size_t i = 0; i < name.size(); i++) {
|
82
|
-
name_ptr[i] = name[i];
|
83
|
-
}
|
84
|
-
name_ptr[name.size()] = '\0';
|
85
|
-
return name_ptr;
|
86
|
-
}
|
87
|
-
|
88
90
|
void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, const LogicalType &type,
|
89
|
-
const
|
91
|
+
const ClientProperties &options) {
|
90
92
|
switch (type.id()) {
|
91
93
|
case LogicalTypeId::BOOLEAN:
|
92
94
|
child.format = "b";
|
@@ -126,7 +128,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
126
128
|
break;
|
127
129
|
case LogicalTypeId::UUID:
|
128
130
|
case LogicalTypeId::VARCHAR:
|
129
|
-
if (options.
|
131
|
+
if (options.arrow_offset_size == ArrowOffsetSize::LARGE) {
|
130
132
|
child.format = "U";
|
131
133
|
} else {
|
132
134
|
child.format = "u";
|
@@ -136,7 +138,6 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
136
138
|
child.format = "tdD";
|
137
139
|
break;
|
138
140
|
case LogicalTypeId::TIME:
|
139
|
-
case LogicalTypeId::TIME_TZ:
|
140
141
|
child.format = "ttu";
|
141
142
|
break;
|
142
143
|
case LogicalTypeId::TIMESTAMP:
|
@@ -174,7 +175,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
174
175
|
}
|
175
176
|
case LogicalTypeId::BLOB:
|
176
177
|
case LogicalTypeId::BIT: {
|
177
|
-
if (options.
|
178
|
+
if (options.arrow_offset_size == ArrowOffsetSize::LARGE) {
|
178
179
|
child.format = "Z";
|
179
180
|
} else {
|
180
181
|
child.format = "z";
|
@@ -188,7 +189,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
188
189
|
root_holder.nested_children.back().resize(1);
|
189
190
|
root_holder.nested_children_ptr.emplace_back();
|
190
191
|
root_holder.nested_children_ptr.back().push_back(&root_holder.nested_children.back()[0]);
|
191
|
-
InitializeChild(root_holder.nested_children.back()[0]);
|
192
|
+
InitializeChild(root_holder.nested_children.back()[0], root_holder);
|
192
193
|
child.children = &root_holder.nested_children_ptr.back()[0];
|
193
194
|
child.children[0]->name = "l";
|
194
195
|
SetArrowFormat(root_holder, **child.children, ListType::GetChildType(type), options);
|
@@ -208,7 +209,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
208
209
|
child.children = &root_holder.nested_children_ptr.back()[0];
|
209
210
|
for (size_t type_idx = 0; type_idx < child_types.size(); type_idx++) {
|
210
211
|
|
211
|
-
InitializeChild(*child.children[type_idx]);
|
212
|
+
InitializeChild(*child.children[type_idx], root_holder);
|
212
213
|
|
213
214
|
root_holder.owned_type_names.push_back(AddName(child_types[type_idx].first));
|
214
215
|
|
@@ -236,7 +237,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
236
237
|
child.children = &root_holder.nested_children_ptr.back()[0];
|
237
238
|
for (size_t type_idx = 0; type_idx < child_types.size(); type_idx++) {
|
238
239
|
|
239
|
-
InitializeChild(*child.children[type_idx]);
|
240
|
+
InitializeChild(*child.children[type_idx], root_holder);
|
240
241
|
|
241
242
|
root_holder.owned_type_names.push_back(AddName(child_types[type_idx].first));
|
242
243
|
|
@@ -272,18 +273,18 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
272
273
|
root_holder.nested_children.back().resize(1);
|
273
274
|
root_holder.nested_children_ptr.emplace_back();
|
274
275
|
root_holder.nested_children_ptr.back().push_back(&root_holder.nested_children.back()[0]);
|
275
|
-
InitializeChild(root_holder.nested_children.back()[0]);
|
276
|
+
InitializeChild(root_holder.nested_children.back()[0], root_holder);
|
276
277
|
child.dictionary = root_holder.nested_children_ptr.back()[0];
|
277
278
|
child.dictionary->format = "u";
|
278
279
|
break;
|
279
280
|
}
|
280
281
|
default:
|
281
|
-
throw
|
282
|
+
throw NotImplementedException("Unsupported Arrow type " + type.ToString());
|
282
283
|
}
|
283
284
|
}
|
284
285
|
|
285
286
|
void ArrowConverter::ToArrowSchema(ArrowSchema *out_schema, const vector<LogicalType> &types,
|
286
|
-
const vector<string> &names, const
|
287
|
+
const vector<string> &names, const ClientProperties &options) {
|
287
288
|
D_ASSERT(out_schema);
|
288
289
|
D_ASSERT(types.size() == names.size());
|
289
290
|
idx_t column_count = types.size();
|
@@ -310,7 +311,7 @@ void ArrowConverter::ToArrowSchema(ArrowSchema *out_schema, const vector<Logical
|
|
310
311
|
for (idx_t col_idx = 0; col_idx < column_count; col_idx++) {
|
311
312
|
|
312
313
|
auto &child = root_holder->children[col_idx];
|
313
|
-
InitializeChild(child, names[col_idx]);
|
314
|
+
InitializeChild(child, *root_holder, names[col_idx]);
|
314
315
|
SetArrowFormat(*root_holder, child, types[col_idx], options);
|
315
316
|
}
|
316
317
|
|
@@ -69,7 +69,7 @@ int ResultArrowArrayStreamWrapper::MyStreamGetSchema(struct ArrowArrayStream *st
|
|
69
69
|
auto my_stream = reinterpret_cast<ResultArrowArrayStreamWrapper *>(stream->private_data);
|
70
70
|
if (!my_stream->column_types.empty()) {
|
71
71
|
ArrowConverter::ToArrowSchema(out, my_stream->column_types, my_stream->column_names,
|
72
|
-
|
72
|
+
my_stream->result->client_properties);
|
73
73
|
return 0;
|
74
74
|
}
|
75
75
|
|
@@ -90,7 +90,7 @@ int ResultArrowArrayStreamWrapper::MyStreamGetSchema(struct ArrowArrayStream *st
|
|
90
90
|
my_stream->column_names = result.names;
|
91
91
|
}
|
92
92
|
ArrowConverter::ToArrowSchema(out, my_stream->column_types, my_stream->column_names,
|
93
|
-
|
93
|
+
my_stream->result->client_properties);
|
94
94
|
return 0;
|
95
95
|
}
|
96
96
|
|
@@ -119,7 +119,7 @@ int ResultArrowArrayStreamWrapper::MyStreamGetNext(struct ArrowArrayStream *stre
|
|
119
119
|
}
|
120
120
|
idx_t result_count;
|
121
121
|
PreservedError error;
|
122
|
-
if (!ArrowUtil::TryFetchChunk(scan_state, result.
|
122
|
+
if (!ArrowUtil::TryFetchChunk(scan_state, result.client_properties, my_stream->batch_size, out, result_count,
|
123
123
|
error)) {
|
124
124
|
D_ASSERT(error);
|
125
125
|
my_stream->last_error = error;
|
@@ -165,7 +165,7 @@ ResultArrowArrayStreamWrapper::ResultArrowArrayStreamWrapper(unique_ptr<QueryRes
|
|
165
165
|
stream.get_last_error = ResultArrowArrayStreamWrapper::MyStreamGetLastError;
|
166
166
|
}
|
167
167
|
|
168
|
-
bool ArrowUtil::TryFetchChunk(ChunkScanState &scan_state,
|
168
|
+
bool ArrowUtil::TryFetchChunk(ChunkScanState &scan_state, ClientProperties options, idx_t batch_size, ArrowArray *out,
|
169
169
|
idx_t &count, PreservedError &error) {
|
170
170
|
count = 0;
|
171
171
|
ArrowAppender appender(scan_state.Types(), batch_size, std::move(options));
|
@@ -209,7 +209,7 @@ bool ArrowUtil::TryFetchChunk(ChunkScanState &scan_state, ArrowOptions options,
|
|
209
209
|
return true;
|
210
210
|
}
|
211
211
|
|
212
|
-
idx_t ArrowUtil::FetchChunk(ChunkScanState &scan_state,
|
212
|
+
idx_t ArrowUtil::FetchChunk(ChunkScanState &scan_state, ClientProperties options, idx_t chunk_size, ArrowArray *out) {
|
213
213
|
PreservedError error;
|
214
214
|
idx_t result_count;
|
215
215
|
if (!TryFetchChunk(scan_state, std::move(options), chunk_size, out, result_count, error)) {
|