duckdb 0.8.2-dev2700.0 → 0.8.2-dev2842.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/package.json +1 -1
- package/src/duckdb/extension/icu/icu-makedate.cpp +12 -6
- package/src/duckdb/extension/json/include/json_deserializer.hpp +1 -1
- package/src/duckdb/extension/json/include/json_serializer.hpp +1 -1
- package/src/duckdb/extension/json/json_deserializer.cpp +10 -10
- package/src/duckdb/extension/json/json_scan.cpp +2 -2
- package/src/duckdb/extension/json/json_serializer.cpp +11 -10
- package/src/duckdb/extension/json/serialize_json.cpp +44 -44
- package/src/duckdb/extension/parquet/parquet_extension.cpp +11 -10
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +6 -6
- package/src/duckdb/src/common/adbc/adbc.cpp +52 -21
- package/src/duckdb/src/common/adbc/driver_manager.cpp +12 -2
- package/src/duckdb/src/common/enum_util.cpp +5 -0
- package/src/duckdb/src/common/extra_type_info.cpp +2 -2
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +5 -3
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +10 -5
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +4 -4
- package/src/duckdb/src/common/types/row/row_data_collection_scanner.cpp +35 -5
- package/src/duckdb/src/common/types/value.cpp +33 -33
- package/src/duckdb/src/common/types/vector.cpp +20 -20
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +6 -6
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +4 -4
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +4 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +283 -91
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +1 -2
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan_generator.cpp +1 -6
- package/src/duckdb/src/execution/window_executor.cpp +10 -1
- package/src/duckdb/src/function/table/read_csv.cpp +4 -4
- package/src/duckdb/src/function/table/table_scan.cpp +14 -14
- package/src/duckdb/src/function/table/version/pragma_version.cpp +5 -2
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/pending_execution_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +18 -17
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +10 -9
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/types/row/row_data_collection_scanner.hpp +5 -1
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +0 -2
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +10 -10
- package/src/duckdb/src/include/duckdb/main/pending_query_result.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/relation/aggregate_relation.hpp +4 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +37 -63
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cost_model.hpp +37 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +14 -29
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +7 -21
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +0 -11
- package/src/duckdb/src/include/duckdb/optimizer/join_order/plan_enumerator.hpp +89 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +17 -31
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp +113 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_manager.hpp +73 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp +73 -0
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/group_by_node.hpp +11 -0
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +0 -2
- package/src/duckdb/src/include/duckdb.h +11 -1
- package/src/duckdb/src/main/capi/pending-c.cpp +17 -0
- package/src/duckdb/src/main/pending_query_result.cpp +9 -1
- package/src/duckdb/src/main/relation/aggregate_relation.cpp +20 -10
- package/src/duckdb/src/main/relation.cpp +4 -4
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +79 -325
- package/src/duckdb/src/optimizer/join_order/cost_model.cpp +19 -0
- package/src/duckdb/src/optimizer/join_order/join_node.cpp +5 -37
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +48 -1078
- package/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +552 -0
- package/src/duckdb/src/optimizer/join_order/query_graph.cpp +32 -29
- package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +409 -0
- package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +356 -0
- package/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp +351 -0
- package/src/duckdb/src/parallel/executor.cpp +6 -0
- package/src/duckdb/src/parallel/task_scheduler.cpp +7 -0
- package/src/duckdb/src/parser/parser.cpp +18 -3
- package/src/duckdb/src/parser/tableref/pivotref.cpp +6 -6
- package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +10 -10
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +6 -6
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +24 -24
- package/src/duckdb/src/planner/operator/logical_extension_operator.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +26 -22
- package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +26 -26
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +66 -66
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +78 -78
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +250 -250
- package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +10 -10
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +206 -206
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +116 -116
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +110 -110
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +48 -48
- package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +16 -16
- package/src/duckdb/src/storage/serialization/serialize_statement.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +10 -10
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +54 -54
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +22 -22
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
- package/src/duckdb/ub_src_optimizer_join_order.cpp +10 -0
package/package.json
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
#include "duckdb/common/operator/add.hpp"
|
1
2
|
#include "duckdb/common/operator/cast_operators.hpp"
|
3
|
+
#include "duckdb/common/operator/subtract.hpp"
|
2
4
|
#include "duckdb/common/types/date.hpp"
|
3
5
|
#include "duckdb/common/types/time.hpp"
|
4
6
|
#include "duckdb/common/types/timestamp.hpp"
|
@@ -66,7 +68,11 @@ struct ICUMakeDate : public ICUDateFunc {
|
|
66
68
|
struct ICUMakeTimestampTZFunc : public ICUDateFunc {
|
67
69
|
template <typename T>
|
68
70
|
static inline timestamp_t Operation(icu::Calendar *calendar, T yyyy, T mm, T dd, T hr, T mn, double ss) {
|
69
|
-
const auto year =
|
71
|
+
const auto year = Cast::Operation<T, int32_t>(AddOperator::Operation<T, T, T>(yyyy, (yyyy < 0)));
|
72
|
+
const auto month = Cast::Operation<T, int32_t>(SubtractOperatorOverflowCheck::Operation<T, T, T>(mm, 1));
|
73
|
+
const auto day = Cast::Operation<T, int32_t>(dd);
|
74
|
+
const auto hour = Cast::Operation<T, int32_t>(hr);
|
75
|
+
const auto min = Cast::Operation<T, int32_t>(mn);
|
70
76
|
|
71
77
|
const auto secs = Cast::Operation<double, int32_t>(ss);
|
72
78
|
ss -= secs;
|
@@ -74,11 +80,11 @@ struct ICUMakeTimestampTZFunc : public ICUDateFunc {
|
|
74
80
|
const auto millis = int32_t(ss);
|
75
81
|
int64_t micros = std::round((ss - millis) * Interval::MICROS_PER_MSEC);
|
76
82
|
|
77
|
-
calendar->set(UCAL_YEAR,
|
78
|
-
calendar->set(UCAL_MONTH,
|
79
|
-
calendar->set(UCAL_DATE,
|
80
|
-
calendar->set(UCAL_HOUR_OF_DAY,
|
81
|
-
calendar->set(UCAL_MINUTE,
|
83
|
+
calendar->set(UCAL_YEAR, year);
|
84
|
+
calendar->set(UCAL_MONTH, month);
|
85
|
+
calendar->set(UCAL_DATE, day);
|
86
|
+
calendar->set(UCAL_HOUR_OF_DAY, hour);
|
87
|
+
calendar->set(UCAL_MINUTE, min);
|
82
88
|
calendar->set(UCAL_SECOND, secs);
|
83
89
|
calendar->set(UCAL_MILLISECOND, millis);
|
84
90
|
|
@@ -48,7 +48,7 @@ private:
|
|
48
48
|
void ThrowTypeError(yyjson_val *val, const char *expected);
|
49
49
|
|
50
50
|
// Set the 'tag' of the property to read
|
51
|
-
void SetTag(const char *tag) final;
|
51
|
+
void SetTag(const field_id_t field_id, const char *tag) final;
|
52
52
|
|
53
53
|
//===--------------------------------------------------------------------===//
|
54
54
|
// Nested Types Hooks
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
namespace duckdb {
|
5
5
|
|
6
|
-
void JsonDeserializer::SetTag(const char *tag) {
|
6
|
+
void JsonDeserializer::SetTag(const field_id_t field_id, const char *tag) {
|
7
7
|
current_tag = tag;
|
8
8
|
}
|
9
9
|
|
@@ -122,11 +122,11 @@ void JsonDeserializer::OnMapEntryBegin() {
|
|
122
122
|
}
|
123
123
|
|
124
124
|
void JsonDeserializer::OnMapKeyBegin() {
|
125
|
-
SetTag("key");
|
125
|
+
SetTag(100, "key");
|
126
126
|
}
|
127
127
|
|
128
128
|
void JsonDeserializer::OnMapValueBegin() {
|
129
|
-
SetTag("value");
|
129
|
+
SetTag(101, "value");
|
130
130
|
}
|
131
131
|
|
132
132
|
void JsonDeserializer::OnMapEntryEnd() {
|
@@ -146,11 +146,11 @@ void JsonDeserializer::OnPairBegin() {
|
|
146
146
|
}
|
147
147
|
|
148
148
|
void JsonDeserializer::OnPairKeyBegin() {
|
149
|
-
SetTag("key");
|
149
|
+
SetTag(100, "key");
|
150
150
|
}
|
151
151
|
|
152
152
|
void JsonDeserializer::OnPairValueBegin() {
|
153
|
-
SetTag("value");
|
153
|
+
SetTag(101, "value");
|
154
154
|
}
|
155
155
|
|
156
156
|
void JsonDeserializer::OnPairEnd() {
|
@@ -271,9 +271,9 @@ interval_t JsonDeserializer::ReadInterval() {
|
|
271
271
|
}
|
272
272
|
Push(val);
|
273
273
|
interval_t result;
|
274
|
-
ReadProperty("months", result.months);
|
275
|
-
ReadProperty("days", result.days);
|
276
|
-
ReadProperty("micros", result.micros);
|
274
|
+
ReadProperty(100, "months", result.months);
|
275
|
+
ReadProperty(101, "days", result.days);
|
276
|
+
ReadProperty(102, "micros", result.micros);
|
277
277
|
Pop();
|
278
278
|
return result;
|
279
279
|
}
|
@@ -285,8 +285,8 @@ hugeint_t JsonDeserializer::ReadHugeInt() {
|
|
285
285
|
}
|
286
286
|
Push(val);
|
287
287
|
hugeint_t result;
|
288
|
-
ReadProperty("upper", result.upper);
|
289
|
-
ReadProperty("lower", result.lower);
|
288
|
+
ReadProperty(100, "upper", result.upper);
|
289
|
+
ReadProperty(101, "lower", result.lower);
|
290
290
|
Pop();
|
291
291
|
return result;
|
292
292
|
}
|
@@ -999,12 +999,12 @@ unique_ptr<FunctionData> JSONScan::Deserialize(PlanDeserializationState &state,
|
|
999
999
|
void JSONScan::FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
1000
1000
|
const TableFunction &function) {
|
1001
1001
|
auto &bind_data = bind_data_p->Cast<JSONScanData>();
|
1002
|
-
serializer.WriteProperty("scan_data", bind_data);
|
1002
|
+
serializer.WriteProperty(100, "scan_data", bind_data);
|
1003
1003
|
}
|
1004
1004
|
|
1005
1005
|
unique_ptr<FunctionData> JSONScan::FormatDeserialize(FormatDeserializer &deserializer, TableFunction &function) {
|
1006
1006
|
unique_ptr<JSONScanData> result;
|
1007
|
-
deserializer.ReadProperty("scan_data", result);
|
1007
|
+
deserializer.ReadProperty(100, "scan_data", result);
|
1008
1008
|
return std::move(result);
|
1009
1009
|
}
|
1010
1010
|
|
@@ -19,7 +19,8 @@ void JsonSerializer::PushValue(yyjson_mut_val *val) {
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
22
|
-
void JsonSerializer::SetTag(const char *tag) {
|
22
|
+
void JsonSerializer::SetTag(const field_id_t field_id, const char *tag) {
|
23
|
+
(void)field_id;
|
23
24
|
current_tag = yyjson_mut_strcpy(doc, tag);
|
24
25
|
}
|
25
26
|
|
@@ -63,11 +64,11 @@ void JsonSerializer::OnMapEntryBegin() {
|
|
63
64
|
}
|
64
65
|
|
65
66
|
void JsonSerializer::OnMapKeyBegin() {
|
66
|
-
SetTag("key");
|
67
|
+
SetTag(100, "key");
|
67
68
|
}
|
68
69
|
|
69
70
|
void JsonSerializer::OnMapValueBegin() {
|
70
|
-
SetTag("value");
|
71
|
+
SetTag(101, "value");
|
71
72
|
}
|
72
73
|
|
73
74
|
void JsonSerializer::OnMapEntryEnd() {
|
@@ -127,11 +128,11 @@ void JsonSerializer::OnPairBegin() {
|
|
127
128
|
}
|
128
129
|
|
129
130
|
void JsonSerializer::OnPairKeyBegin() {
|
130
|
-
SetTag("key");
|
131
|
+
SetTag(100, "key");
|
131
132
|
}
|
132
133
|
|
133
134
|
void JsonSerializer::OnPairValueBegin() {
|
134
|
-
SetTag("value");
|
135
|
+
SetTag(101, "value");
|
135
136
|
}
|
136
137
|
|
137
138
|
void JsonSerializer::OnPairEnd() {
|
@@ -190,8 +191,8 @@ void JsonSerializer::WriteValue(hugeint_t value) {
|
|
190
191
|
auto val = yyjson_mut_obj(doc);
|
191
192
|
PushValue(val);
|
192
193
|
stack.push_back(val);
|
193
|
-
WriteProperty("upper", value.upper);
|
194
|
-
WriteProperty("lower", value.lower);
|
194
|
+
WriteProperty(100, "upper", value.upper);
|
195
|
+
WriteProperty(101, "lower", value.lower);
|
195
196
|
stack.pop_back();
|
196
197
|
}
|
197
198
|
|
@@ -209,9 +210,9 @@ void JsonSerializer::WriteValue(interval_t value) {
|
|
209
210
|
auto val = yyjson_mut_obj(doc);
|
210
211
|
PushValue(val);
|
211
212
|
stack.push_back(val);
|
212
|
-
WriteProperty("months", value.months);
|
213
|
-
WriteProperty("days", value.days);
|
214
|
-
WriteProperty("micros", value.micros);
|
213
|
+
WriteProperty(100, "months", value.months);
|
214
|
+
WriteProperty(101, "days", value.days);
|
215
|
+
WriteProperty(102, "micros", value.micros);
|
215
216
|
stack.pop_back();
|
216
217
|
}
|
217
218
|
|
@@ -12,51 +12,51 @@
|
|
12
12
|
namespace duckdb {
|
13
13
|
|
14
14
|
void BufferedJSONReaderOptions::FormatSerialize(FormatSerializer &serializer) const {
|
15
|
-
serializer.WriteProperty("format", format);
|
16
|
-
serializer.WriteProperty("record_type", record_type);
|
17
|
-
serializer.WriteProperty("compression", compression);
|
18
|
-
serializer.WriteProperty("file_options", file_options);
|
15
|
+
serializer.WriteProperty(100, "format", format);
|
16
|
+
serializer.WriteProperty(101, "record_type", record_type);
|
17
|
+
serializer.WriteProperty(102, "compression", compression);
|
18
|
+
serializer.WriteProperty(103, "file_options", file_options);
|
19
19
|
}
|
20
20
|
|
21
21
|
BufferedJSONReaderOptions BufferedJSONReaderOptions::FormatDeserialize(FormatDeserializer &deserializer) {
|
22
22
|
BufferedJSONReaderOptions result;
|
23
|
-
deserializer.ReadProperty("format", result.format);
|
24
|
-
deserializer.ReadProperty("record_type", result.record_type);
|
25
|
-
deserializer.ReadProperty("compression", result.compression);
|
26
|
-
deserializer.ReadProperty("file_options", result.file_options);
|
23
|
+
deserializer.ReadProperty(100, "format", result.format);
|
24
|
+
deserializer.ReadProperty(101, "record_type", result.record_type);
|
25
|
+
deserializer.ReadProperty(102, "compression", result.compression);
|
26
|
+
deserializer.ReadProperty(103, "file_options", result.file_options);
|
27
27
|
return result;
|
28
28
|
}
|
29
29
|
|
30
30
|
void JSONScanData::FormatSerialize(FormatSerializer &serializer) const {
|
31
|
-
serializer.WriteProperty("json_type", type);
|
32
|
-
serializer.WriteProperty("options", options);
|
33
|
-
serializer.WriteProperty("reader_bind", reader_bind);
|
34
|
-
serializer.WriteProperty("files", files);
|
35
|
-
serializer.WriteProperty("ignore_errors", ignore_errors);
|
36
|
-
serializer.WriteProperty("maximum_object_size", maximum_object_size);
|
37
|
-
serializer.WriteProperty("auto_detect", auto_detect);
|
38
|
-
serializer.WriteProperty("sample_size", sample_size);
|
39
|
-
serializer.WriteProperty("max_depth", max_depth);
|
40
|
-
serializer.WriteProperty("transform_options", transform_options);
|
41
|
-
serializer.WriteProperty("names", names);
|
42
|
-
serializer.WriteProperty("date_format", GetDateFormat());
|
43
|
-
serializer.WriteProperty("timestamp_format", GetTimestampFormat());
|
31
|
+
serializer.WriteProperty(100, "json_type", type);
|
32
|
+
serializer.WriteProperty(101, "options", options);
|
33
|
+
serializer.WriteProperty(102, "reader_bind", reader_bind);
|
34
|
+
serializer.WriteProperty(103, "files", files);
|
35
|
+
serializer.WriteProperty(104, "ignore_errors", ignore_errors);
|
36
|
+
serializer.WriteProperty(105, "maximum_object_size", maximum_object_size);
|
37
|
+
serializer.WriteProperty(106, "auto_detect", auto_detect);
|
38
|
+
serializer.WriteProperty(107, "sample_size", sample_size);
|
39
|
+
serializer.WriteProperty(108, "max_depth", max_depth);
|
40
|
+
serializer.WriteProperty(109, "transform_options", transform_options);
|
41
|
+
serializer.WriteProperty(110, "names", names);
|
42
|
+
serializer.WriteProperty(111, "date_format", GetDateFormat());
|
43
|
+
serializer.WriteProperty(112, "timestamp_format", GetTimestampFormat());
|
44
44
|
}
|
45
45
|
|
46
46
|
unique_ptr<JSONScanData> JSONScanData::FormatDeserialize(FormatDeserializer &deserializer) {
|
47
|
-
auto type = deserializer.ReadProperty<JSONScanType>("json_type");
|
48
|
-
auto options = deserializer.ReadProperty<BufferedJSONReaderOptions>("options");
|
49
|
-
auto reader_bind = deserializer.ReadProperty<MultiFileReaderBindData>("reader_bind");
|
50
|
-
auto files = deserializer.ReadProperty<vector<string>>("files");
|
51
|
-
auto ignore_errors = deserializer.ReadProperty<bool>("ignore_errors");
|
52
|
-
auto maximum_object_size = deserializer.ReadProperty<idx_t>("maximum_object_size");
|
53
|
-
auto auto_detect = deserializer.ReadProperty<bool>("auto_detect");
|
54
|
-
auto sample_size = deserializer.ReadProperty<idx_t>("sample_size");
|
55
|
-
auto max_depth = deserializer.ReadProperty<idx_t>("max_depth");
|
56
|
-
auto transform_options = deserializer.ReadProperty<JSONTransformOptions>("transform_options");
|
57
|
-
auto names = deserializer.ReadProperty<vector<string>>("names");
|
58
|
-
auto date_format = deserializer.ReadProperty<string>("date_format");
|
59
|
-
auto timestamp_format = deserializer.ReadProperty<string>("timestamp_format");
|
47
|
+
auto type = deserializer.ReadProperty<JSONScanType>(100, "json_type");
|
48
|
+
auto options = deserializer.ReadProperty<BufferedJSONReaderOptions>(101, "options");
|
49
|
+
auto reader_bind = deserializer.ReadProperty<MultiFileReaderBindData>(102, "reader_bind");
|
50
|
+
auto files = deserializer.ReadProperty<vector<string>>(103, "files");
|
51
|
+
auto ignore_errors = deserializer.ReadProperty<bool>(104, "ignore_errors");
|
52
|
+
auto maximum_object_size = deserializer.ReadProperty<idx_t>(105, "maximum_object_size");
|
53
|
+
auto auto_detect = deserializer.ReadProperty<bool>(106, "auto_detect");
|
54
|
+
auto sample_size = deserializer.ReadProperty<idx_t>(107, "sample_size");
|
55
|
+
auto max_depth = deserializer.ReadProperty<idx_t>(108, "max_depth");
|
56
|
+
auto transform_options = deserializer.ReadProperty<JSONTransformOptions>(109, "transform_options");
|
57
|
+
auto names = deserializer.ReadProperty<vector<string>>(110, "names");
|
58
|
+
auto date_format = deserializer.ReadProperty<string>(111, "date_format");
|
59
|
+
auto timestamp_format = deserializer.ReadProperty<string>(112, "timestamp_format");
|
60
60
|
auto result = duckdb::unique_ptr<JSONScanData>(new JSONScanData(deserializer.Get<ClientContext &>(), std::move(files), std::move(date_format), std::move(timestamp_format)));
|
61
61
|
result->type = type;
|
62
62
|
result->options = options;
|
@@ -72,20 +72,20 @@ unique_ptr<JSONScanData> JSONScanData::FormatDeserialize(FormatDeserializer &des
|
|
72
72
|
}
|
73
73
|
|
74
74
|
void JSONTransformOptions::FormatSerialize(FormatSerializer &serializer) const {
|
75
|
-
serializer.WriteProperty("strict_cast", strict_cast);
|
76
|
-
serializer.WriteProperty("error_duplicate_key", error_duplicate_key);
|
77
|
-
serializer.WriteProperty("error_missing_key", error_missing_key);
|
78
|
-
serializer.WriteProperty("error_unknown_key", error_unknown_key);
|
79
|
-
serializer.WriteProperty("delay_error", delay_error);
|
75
|
+
serializer.WriteProperty(100, "strict_cast", strict_cast);
|
76
|
+
serializer.WriteProperty(101, "error_duplicate_key", error_duplicate_key);
|
77
|
+
serializer.WriteProperty(102, "error_missing_key", error_missing_key);
|
78
|
+
serializer.WriteProperty(103, "error_unknown_key", error_unknown_key);
|
79
|
+
serializer.WriteProperty(104, "delay_error", delay_error);
|
80
80
|
}
|
81
81
|
|
82
82
|
JSONTransformOptions JSONTransformOptions::FormatDeserialize(FormatDeserializer &deserializer) {
|
83
83
|
JSONTransformOptions result;
|
84
|
-
deserializer.ReadProperty("strict_cast", result.strict_cast);
|
85
|
-
deserializer.ReadProperty("error_duplicate_key", result.error_duplicate_key);
|
86
|
-
deserializer.ReadProperty("error_missing_key", result.error_missing_key);
|
87
|
-
deserializer.ReadProperty("error_unknown_key", result.error_unknown_key);
|
88
|
-
deserializer.ReadProperty("delay_error", result.delay_error);
|
84
|
+
deserializer.ReadProperty(100, "strict_cast", result.strict_cast);
|
85
|
+
deserializer.ReadProperty(101, "error_duplicate_key", result.error_duplicate_key);
|
86
|
+
deserializer.ReadProperty(102, "error_missing_key", result.error_missing_key);
|
87
|
+
deserializer.ReadProperty(103, "error_unknown_key", result.error_unknown_key);
|
88
|
+
deserializer.ReadProperty(104, "delay_error", result.delay_error);
|
89
89
|
return result;
|
90
90
|
}
|
91
91
|
|
@@ -201,8 +201,9 @@ public:
|
|
201
201
|
|
202
202
|
for (auto &option : info.options) {
|
203
203
|
auto loption = StringUtil::Lower(option.first);
|
204
|
-
if (loption == "compression" || loption == "codec") {
|
205
|
-
// CODEC
|
204
|
+
if (loption == "compression" || loption == "codec" || loption == "row_group_size") {
|
205
|
+
// CODEC/COMPRESSION and ROW_GROUP_SIZE options have no effect on parquet read.
|
206
|
+
// These options are determined from the file.
|
206
207
|
continue;
|
207
208
|
} else if (loption == "binary_as_string") {
|
208
209
|
parquet_options.binary_as_string = true;
|
@@ -437,19 +438,19 @@ public:
|
|
437
438
|
static void ParquetScanFormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
438
439
|
const TableFunction &function) {
|
439
440
|
auto &bind_data = bind_data_p->Cast<ParquetReadBindData>();
|
440
|
-
serializer.WriteProperty("files", bind_data.files);
|
441
|
-
serializer.WriteProperty("types", bind_data.types);
|
442
|
-
serializer.WriteProperty("names", bind_data.names);
|
443
|
-
serializer.WriteProperty("parquet_options", bind_data.parquet_options);
|
441
|
+
serializer.WriteProperty(100, "files", bind_data.files);
|
442
|
+
serializer.WriteProperty(101, "types", bind_data.types);
|
443
|
+
serializer.WriteProperty(102, "names", bind_data.names);
|
444
|
+
serializer.WriteProperty(103, "parquet_options", bind_data.parquet_options);
|
444
445
|
}
|
445
446
|
|
446
447
|
static unique_ptr<FunctionData> ParquetScanFormatDeserialize(FormatDeserializer &deserializer,
|
447
448
|
TableFunction &function) {
|
448
449
|
auto &context = deserializer.Get<ClientContext &>();
|
449
|
-
auto files = deserializer.ReadProperty<vector<string>>("files");
|
450
|
-
auto types = deserializer.ReadProperty<vector<LogicalType>>("types");
|
451
|
-
auto names = deserializer.ReadProperty<vector<string>>("names");
|
452
|
-
auto parquet_options = deserializer.ReadProperty<ParquetOptions>("parquet_options");
|
450
|
+
auto files = deserializer.ReadProperty<vector<string>>(100, "files");
|
451
|
+
auto types = deserializer.ReadProperty<vector<LogicalType>>(101, "types");
|
452
|
+
auto names = deserializer.ReadProperty<vector<string>>(102, "names");
|
453
|
+
auto parquet_options = deserializer.ReadProperty<ParquetOptions>(103, "parquet_options");
|
453
454
|
return ParquetScanBindInternal(context, files, types, names, parquet_options);
|
454
455
|
}
|
455
456
|
|
@@ -10,16 +10,16 @@
|
|
10
10
|
namespace duckdb {
|
11
11
|
|
12
12
|
void ParquetOptions::FormatSerialize(FormatSerializer &serializer) const {
|
13
|
-
serializer.WriteProperty("binary_as_string", binary_as_string);
|
14
|
-
serializer.WriteProperty("file_row_number", file_row_number);
|
15
|
-
serializer.WriteProperty("file_options", file_options);
|
13
|
+
serializer.WriteProperty(100, "binary_as_string", binary_as_string);
|
14
|
+
serializer.WriteProperty(101, "file_row_number", file_row_number);
|
15
|
+
serializer.WriteProperty(102, "file_options", file_options);
|
16
16
|
}
|
17
17
|
|
18
18
|
ParquetOptions ParquetOptions::FormatDeserialize(FormatDeserializer &deserializer) {
|
19
19
|
ParquetOptions result;
|
20
|
-
deserializer.ReadProperty("binary_as_string", result.binary_as_string);
|
21
|
-
deserializer.ReadProperty("file_row_number", result.file_row_number);
|
22
|
-
deserializer.ReadProperty("file_options", result.file_options);
|
20
|
+
deserializer.ReadProperty(100, "binary_as_string", result.binary_as_string);
|
21
|
+
deserializer.ReadProperty(101, "file_row_number", result.file_row_number);
|
22
|
+
deserializer.ReadProperty(102, "file_options", result.file_options);
|
23
23
|
return result;
|
24
24
|
}
|
25
25
|
|
@@ -586,16 +586,14 @@ AdbcStatusCode StatementExecuteQuery(struct AdbcStatement *statement, struct Arr
|
|
586
586
|
|
587
587
|
// this is a nop for us
|
588
588
|
AdbcStatusCode StatementPrepare(struct AdbcStatement *statement, struct AdbcError *error) {
|
589
|
-
|
590
|
-
|
591
|
-
return
|
589
|
+
if (!statement) {
|
590
|
+
SetError(error, "Missing statement object");
|
591
|
+
return ADBC_STATUS_INVALID_ARGUMENT;
|
592
592
|
}
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
return status;
|
593
|
+
if (!error) {
|
594
|
+
SetError(error, "Missing error object");
|
595
|
+
return ADBC_STATUS_INVALID_ARGUMENT;
|
597
596
|
}
|
598
|
-
|
599
597
|
return ADBC_STATUS_OK;
|
600
598
|
}
|
601
599
|
|
@@ -687,10 +685,6 @@ AdbcStatusCode QueryInternal(struct AdbcConnection *connection, struct ArrowArra
|
|
687
685
|
AdbcStatusCode ConnectionGetObjects(struct AdbcConnection *connection, int depth, const char *catalog,
|
688
686
|
const char *db_schema, const char *table_name, const char **table_type,
|
689
687
|
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
|
-
}
|
694
688
|
if (catalog != nullptr) {
|
695
689
|
if (strcmp(catalog, "duckdb") == 0) {
|
696
690
|
SetError(error, "catalog must be NULL or 'duckdb'");
|
@@ -702,16 +696,53 @@ AdbcStatusCode ConnectionGetObjects(struct AdbcConnection *connection, int depth
|
|
702
696
|
SetError(error, "Table types parameter not yet supported");
|
703
697
|
return ADBC_STATUS_NOT_IMPLEMENTED;
|
704
698
|
}
|
699
|
+
std::string query;
|
700
|
+
switch (depth) {
|
701
|
+
case ADBC_OBJECT_DEPTH_CATALOGS:
|
702
|
+
SetError(error, "ADBC_OBJECT_DEPTH_CATALOGS not yet supported");
|
703
|
+
return ADBC_STATUS_NOT_IMPLEMENTED;
|
704
|
+
case ADBC_OBJECT_DEPTH_DB_SCHEMAS:
|
705
|
+
// Return metadata on catalogs and schemas.
|
706
|
+
query = duckdb::StringUtil::Format(R"(
|
707
|
+
SELECT table_schema db_schema_name
|
708
|
+
FROM information_schema.columns
|
709
|
+
WHERE table_schema LIKE '%s' AND table_name LIKE '%s' AND column_name LIKE '%s' ;
|
710
|
+
)",
|
711
|
+
db_schema ? db_schema : "%", table_name ? table_name : "%",
|
712
|
+
column_name ? column_name : "%");
|
713
|
+
break;
|
714
|
+
case ADBC_OBJECT_DEPTH_TABLES:
|
715
|
+
// Return metadata on catalogs, schemas, and tables.
|
716
|
+
query = duckdb::StringUtil::Format(R"(
|
717
|
+
SELECT table_schema db_schema_name, LIST(table_schema_list) db_schema_tables
|
718
|
+
FROM (
|
719
|
+
SELECT table_schema, { table_name : table_name} table_schema_list
|
720
|
+
FROM information_schema.columns
|
721
|
+
WHERE table_schema LIKE '%s' AND table_name LIKE '%s' AND column_name LIKE '%s' GROUP BY table_schema, table_name
|
722
|
+
) GROUP BY table_schema;
|
723
|
+
)",
|
724
|
+
db_schema ? db_schema : "%", table_name ? table_name : "%",
|
725
|
+
column_name ? column_name : "%");
|
726
|
+
break;
|
727
|
+
case ADBC_OBJECT_DEPTH_COLUMNS:
|
728
|
+
// Return metadata on catalogs, schemas, tables, and columns.
|
729
|
+
query = duckdb::StringUtil::Format(R"(
|
730
|
+
SELECT table_schema db_schema_name, LIST(table_schema_list) db_schema_tables
|
731
|
+
FROM (
|
732
|
+
SELECT table_schema, { table_name : table_name, table_columns : LIST({column_name : column_name, ordinal_position : ordinal_position + 1, remarks : ''})} table_schema_list
|
733
|
+
FROM information_schema.columns
|
734
|
+
WHERE table_schema LIKE '%s' AND table_name LIKE '%s' AND column_name LIKE '%s' GROUP BY table_schema, table_name
|
735
|
+
) GROUP BY table_schema;
|
736
|
+
)",
|
737
|
+
db_schema ? db_schema : "%", table_name ? table_name : "%",
|
738
|
+
column_name ? column_name : "%");
|
739
|
+
break;
|
740
|
+
default:
|
741
|
+
SetError(error, "Invalid value of Depth");
|
742
|
+
return ADBC_STATUS_INVALID_ARGUMENT;
|
743
|
+
}
|
705
744
|
|
706
|
-
|
707
|
-
SELECT table_schema db_schema_name, LIST(table_schema_list) db_schema_tables FROM (
|
708
|
-
SELECT table_schema, { table_name : table_name, table_columns : LIST({column_name : column_name, ordinal_position : ordinal_position + 1, remarks : ''})} table_schema_list FROM information_schema.columns WHERE table_schema LIKE '%s' AND table_name LIKE '%s' AND column_name LIKE '%s' GROUP BY table_schema, table_name
|
709
|
-
) GROUP BY table_schema;
|
710
|
-
)",
|
711
|
-
db_schema ? db_schema : "%", table_name ? table_name : "%",
|
712
|
-
column_name ? column_name : "%");
|
713
|
-
|
714
|
-
return QueryInternal(connection, out, q.c_str(), error);
|
745
|
+
return QueryInternal(connection, out, query.c_str(), error);
|
715
746
|
}
|
716
747
|
|
717
748
|
AdbcStatusCode ConnectionGetTableTypes(struct AdbcConnection *connection, struct ArrowArrayStream *out,
|
@@ -304,7 +304,12 @@ AdbcStatusCode AdbcConnectionGetObjects(struct AdbcConnection *connection, int d
|
|
304
304
|
const char *db_schema, const char *table_name, const char **table_types,
|
305
305
|
const char *column_name, struct ArrowArrayStream *stream,
|
306
306
|
struct AdbcError *error) {
|
307
|
-
if (!connection
|
307
|
+
if (!connection) {
|
308
|
+
SetError(error, "connection can't be null");
|
309
|
+
return ADBC_STATUS_INVALID_STATE;
|
310
|
+
}
|
311
|
+
if (!connection->private_data) {
|
312
|
+
SetError(error, "connection must be initialized");
|
308
313
|
return ADBC_STATUS_INVALID_STATE;
|
309
314
|
}
|
310
315
|
return connection->private_driver->ConnectionGetObjects(connection, depth, catalog, db_schema, table_name,
|
@@ -474,7 +479,12 @@ AdbcStatusCode AdbcStatementNew(struct AdbcConnection *connection, struct AdbcSt
|
|
474
479
|
}
|
475
480
|
|
476
481
|
AdbcStatusCode AdbcStatementPrepare(struct AdbcStatement *statement, struct AdbcError *error) {
|
477
|
-
|
482
|
+
auto status = SetErrorMaybe(statement, error, "Missing statement object");
|
483
|
+
if (status != ADBC_STATUS_OK) {
|
484
|
+
return status;
|
485
|
+
}
|
486
|
+
status = SetErrorMaybe(statement->private_data, error, "Invalid statement object");
|
487
|
+
if (status != ADBC_STATUS_OK) {
|
478
488
|
return ADBC_STATUS_INVALID_STATE;
|
479
489
|
}
|
480
490
|
return statement->private_driver->StatementPrepare(statement, error);
|
@@ -3872,6 +3872,8 @@ const char* EnumUtil::ToChars<PendingExecutionResult>(PendingExecutionResult val
|
|
3872
3872
|
return "RESULT_NOT_READY";
|
3873
3873
|
case PendingExecutionResult::EXECUTION_ERROR:
|
3874
3874
|
return "EXECUTION_ERROR";
|
3875
|
+
case PendingExecutionResult::NO_TASKS_AVAILABLE:
|
3876
|
+
return "NO_TASKS_AVAILABLE";
|
3875
3877
|
default:
|
3876
3878
|
throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented", value));
|
3877
3879
|
}
|
@@ -3888,6 +3890,9 @@ PendingExecutionResult EnumUtil::FromString<PendingExecutionResult>(const char *
|
|
3888
3890
|
if (StringUtil::Equals(value, "EXECUTION_ERROR")) {
|
3889
3891
|
return PendingExecutionResult::EXECUTION_ERROR;
|
3890
3892
|
}
|
3893
|
+
if (StringUtil::Equals(value, "NO_TASKS_AVAILABLE")) {
|
3894
|
+
return PendingExecutionResult::NO_TASKS_AVAILABLE;
|
3895
|
+
}
|
3891
3896
|
throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented", value));
|
3892
3897
|
}
|
3893
3898
|
|
@@ -426,7 +426,7 @@ shared_ptr<ExtraTypeInfo> EnumTypeInfo::Deserialize(FieldReader &reader) {
|
|
426
426
|
}
|
427
427
|
|
428
428
|
shared_ptr<ExtraTypeInfo> EnumTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
|
429
|
-
auto enum_size = deserializer.ReadProperty<idx_t>("enum_size");
|
429
|
+
auto enum_size = deserializer.ReadProperty<idx_t>(200, "enum_size");
|
430
430
|
auto enum_internal_type = EnumTypeInfo::DictType(enum_size);
|
431
431
|
switch (enum_internal_type) {
|
432
432
|
case PhysicalType::UINT8:
|
@@ -476,7 +476,7 @@ void EnumTypeInfo::Serialize(FieldWriter &writer) const {
|
|
476
476
|
|
477
477
|
void EnumTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
|
478
478
|
ExtraTypeInfo::FormatSerialize(serializer);
|
479
|
-
serializer.WriteProperty("dict_size", dict_size);
|
479
|
+
serializer.WriteProperty(200, "dict_size", dict_size);
|
480
480
|
((Vector &)values_insert_order).FormatSerialize(serializer, dict_size); // NOLINT - FIXME
|
481
481
|
}
|
482
482
|
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
5
|
-
void BinaryDeserializer::SetTag(const char *tag) {
|
5
|
+
void BinaryDeserializer::SetTag(const field_id_t field_id, const char *tag) {
|
6
|
+
current_field_id = field_id;
|
6
7
|
current_tag = tag;
|
7
8
|
stack.back().read_field_count++;
|
8
9
|
if (stack.back().read_field_count > stack.back().expected_field_count) {
|
@@ -14,12 +15,13 @@ void BinaryDeserializer::SetTag(const char *tag) {
|
|
14
15
|
// Nested Types Hooks
|
15
16
|
//===--------------------------------------------------------------------===//
|
16
17
|
void BinaryDeserializer::OnObjectBegin() {
|
18
|
+
auto expected_field_id = ReadPrimitive<field_id_t>();
|
17
19
|
auto expected_field_count = ReadPrimitive<uint32_t>();
|
18
20
|
auto expected_size = ReadPrimitive<uint64_t>();
|
19
21
|
D_ASSERT(expected_field_count > 0);
|
20
22
|
D_ASSERT(expected_size > 0);
|
21
|
-
|
22
|
-
stack.emplace_back(expected_field_count, expected_size);
|
23
|
+
D_ASSERT(expected_field_id == current_field_id);
|
24
|
+
stack.emplace_back(expected_field_count, expected_size, expected_field_id);
|
23
25
|
}
|
24
26
|
|
25
27
|
void BinaryDeserializer::OnObjectEnd() {
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
5
|
-
void BinarySerializer::SetTag(const char *tag) {
|
5
|
+
void BinarySerializer::SetTag(const field_id_t field_id, const char *tag) {
|
6
|
+
current_field_id = field_id;
|
6
7
|
current_tag = tag;
|
7
|
-
|
8
8
|
// Increment the number of fields
|
9
9
|
stack.back().field_count++;
|
10
10
|
}
|
@@ -45,6 +45,9 @@ void BinarySerializer::OnMapEnd(idx_t count) {
|
|
45
45
|
|
46
46
|
void BinarySerializer::OnObjectBegin() {
|
47
47
|
stack.push_back(State({0, 0, data.size()}));
|
48
|
+
// Store the field id
|
49
|
+
Write<field_id_t>(current_field_id);
|
50
|
+
// Store the offset so we can patch the field count and size later
|
48
51
|
Write<uint32_t>(0); // Placeholder for the field count
|
49
52
|
Write<uint64_t>(0); // Placeholder for the size
|
50
53
|
}
|
@@ -52,9 +55,11 @@ void BinarySerializer::OnObjectBegin() {
|
|
52
55
|
void BinarySerializer::OnObjectEnd() {
|
53
56
|
auto &frame = stack.back();
|
54
57
|
// Patch the field count and size
|
55
|
-
auto
|
56
|
-
|
57
|
-
Store<
|
58
|
+
auto ptr = &data[frame.offset];
|
59
|
+
ptr += sizeof(field_id_t); // Skip the field id
|
60
|
+
Store<uint32_t>(frame.field_count, ptr);
|
61
|
+
ptr += sizeof(uint32_t); // Skip the field count
|
62
|
+
Store<uint64_t>(frame.size, ptr);
|
58
63
|
stack.pop_back();
|
59
64
|
}
|
60
65
|
|
@@ -1069,13 +1069,13 @@ void ColumnDataCollection::FormatSerialize(FormatSerializer &serializer) const {
|
|
1069
1069
|
}
|
1070
1070
|
}
|
1071
1071
|
}
|
1072
|
-
serializer.WriteProperty("types", types);
|
1073
|
-
serializer.WriteProperty("values", values);
|
1072
|
+
serializer.WriteProperty(100, "types", types);
|
1073
|
+
serializer.WriteProperty(101, "values", values);
|
1074
1074
|
}
|
1075
1075
|
|
1076
1076
|
unique_ptr<ColumnDataCollection> ColumnDataCollection::FormatDeserialize(FormatDeserializer &deserializer) {
|
1077
|
-
auto types = deserializer.ReadProperty<vector<LogicalType>>("types");
|
1078
|
-
auto values = deserializer.ReadProperty<vector<vector<Value>>>("values");
|
1077
|
+
auto types = deserializer.ReadProperty<vector<LogicalType>>(100, "types");
|
1078
|
+
auto values = deserializer.ReadProperty<vector<vector<Value>>>(101, "values");
|
1079
1079
|
|
1080
1080
|
auto collection = make_uniq<ColumnDataCollection>(Allocator::DefaultAllocator(), types);
|
1081
1081
|
if (values.empty()) {
|