duckdb 0.8.2-dev2809.0 → 0.8.2-dev2850.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/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 +16 -14
- package/src/duckdb/extension/json/json_scan.cpp +2 -2
- package/src/duckdb/extension/json/json_serializer.cpp +11 -11
- 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/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/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/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 +2 -2
- 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/function/function_serialization.hpp +10 -10
- package/src/duckdb/src/include/duckdb/main/relation/aggregate_relation.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/main/relation/aggregate_relation.cpp +20 -10
- package/src/duckdb/src/main/relation.cpp +4 -4
- package/src/duckdb/src/parser/parser.cpp +18 -3
- package/src/duckdb/src/parser/tableref/pivotref.cpp +6 -6
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +55 -38
- 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 +22 -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
@@ -999,14 +999,14 @@ void Vector::FormatSerialize(FormatSerializer &serializer, idx_t count) {
|
|
999
999
|
ToUnifiedFormat(count, vdata);
|
1000
1000
|
|
1001
1001
|
const bool all_valid = (count > 0) && !vdata.validity.AllValid();
|
1002
|
-
serializer.WriteProperty("all_valid", all_valid);
|
1002
|
+
serializer.WriteProperty(100, "all_valid", all_valid);
|
1003
1003
|
if (all_valid) {
|
1004
1004
|
ValidityMask flat_mask(count);
|
1005
1005
|
for (idx_t i = 0; i < count; ++i) {
|
1006
1006
|
auto row_idx = vdata.sel->get_index(i);
|
1007
1007
|
flat_mask.Set(i, vdata.validity.RowIsValid(row_idx));
|
1008
1008
|
}
|
1009
|
-
serializer.WriteProperty("validity", const_data_ptr_cast(flat_mask.GetData()),
|
1009
|
+
serializer.WriteProperty(101, "validity", const_data_ptr_cast(flat_mask.GetData()),
|
1010
1010
|
flat_mask.ValidityMaskSize(count));
|
1011
1011
|
}
|
1012
1012
|
if (TypeIsConstantSize(logical_type.InternalType())) {
|
@@ -1014,14 +1014,14 @@ void Vector::FormatSerialize(FormatSerializer &serializer, idx_t count) {
|
|
1014
1014
|
idx_t write_size = GetTypeIdSize(logical_type.InternalType()) * count;
|
1015
1015
|
auto ptr = make_unsafe_uniq_array<data_t>(write_size);
|
1016
1016
|
VectorOperations::WriteToStorage(*this, count, ptr.get());
|
1017
|
-
serializer.WriteProperty("data", ptr.get(), write_size);
|
1017
|
+
serializer.WriteProperty(102, "data", ptr.get(), write_size);
|
1018
1018
|
} else {
|
1019
1019
|
switch (logical_type.InternalType()) {
|
1020
1020
|
case PhysicalType::VARCHAR: {
|
1021
1021
|
auto strings = UnifiedVectorFormat::GetData<string_t>(vdata);
|
1022
1022
|
|
1023
1023
|
// Serialize data as a list
|
1024
|
-
serializer.SetTag("data");
|
1024
|
+
serializer.SetTag(102, "data");
|
1025
1025
|
serializer.OnListBegin(count);
|
1026
1026
|
for (idx_t i = 0; i < count; i++) {
|
1027
1027
|
auto idx = vdata.sel->get_index(i);
|
@@ -1036,7 +1036,7 @@ void Vector::FormatSerialize(FormatSerializer &serializer, idx_t count) {
|
|
1036
1036
|
auto &entries = StructVector::GetEntries(*this);
|
1037
1037
|
|
1038
1038
|
// Serialize entries as a list
|
1039
|
-
serializer.SetTag("children");
|
1039
|
+
serializer.SetTag(103, "children");
|
1040
1040
|
serializer.OnListBegin(entries.size());
|
1041
1041
|
for (auto &entry : entries) {
|
1042
1042
|
serializer.OnObjectBegin();
|
@@ -1059,17 +1059,17 @@ void Vector::FormatSerialize(FormatSerializer &serializer, idx_t count) {
|
|
1059
1059
|
entries[i].offset = source.offset;
|
1060
1060
|
entries[i].length = source.length;
|
1061
1061
|
}
|
1062
|
-
serializer.WriteProperty("list_size", list_size);
|
1063
|
-
serializer.SetTag("entries");
|
1062
|
+
serializer.WriteProperty(104, "list_size", list_size);
|
1063
|
+
serializer.SetTag(105, "entries");
|
1064
1064
|
serializer.OnListBegin(count);
|
1065
1065
|
for (idx_t i = 0; i < count; i++) {
|
1066
1066
|
serializer.OnObjectBegin();
|
1067
|
-
serializer.WriteProperty("offset", entries[i].offset);
|
1068
|
-
serializer.WriteProperty("length", entries[i].length);
|
1067
|
+
serializer.WriteProperty(100, "offset", entries[i].offset);
|
1068
|
+
serializer.WriteProperty(101, "length", entries[i].length);
|
1069
1069
|
serializer.OnObjectEnd();
|
1070
1070
|
}
|
1071
1071
|
serializer.OnListEnd(count);
|
1072
|
-
serializer.SetTag("child");
|
1072
|
+
serializer.SetTag(106, "child");
|
1073
1073
|
serializer.OnObjectBegin();
|
1074
1074
|
child.FormatSerialize(serializer, list_size);
|
1075
1075
|
serializer.OnObjectEnd();
|
@@ -1086,24 +1086,24 @@ void Vector::FormatDeserialize(FormatDeserializer &deserializer, idx_t count) {
|
|
1086
1086
|
|
1087
1087
|
auto &validity = FlatVector::Validity(*this);
|
1088
1088
|
validity.Reset();
|
1089
|
-
const auto has_validity = deserializer.ReadProperty<bool>("all_valid");
|
1089
|
+
const auto has_validity = deserializer.ReadProperty<bool>(100, "all_valid");
|
1090
1090
|
if (has_validity) {
|
1091
1091
|
validity.Initialize(count);
|
1092
|
-
deserializer.ReadProperty("validity", data_ptr_cast(validity.GetData()), validity.ValidityMaskSize(count));
|
1092
|
+
deserializer.ReadProperty(101, "validity", data_ptr_cast(validity.GetData()), validity.ValidityMaskSize(count));
|
1093
1093
|
}
|
1094
1094
|
|
1095
1095
|
if (TypeIsConstantSize(logical_type.InternalType())) {
|
1096
1096
|
// constant size type: read fixed amount of data
|
1097
1097
|
auto column_size = GetTypeIdSize(logical_type.InternalType()) * count;
|
1098
1098
|
auto ptr = make_unsafe_uniq_array<data_t>(column_size);
|
1099
|
-
deserializer.ReadProperty("data", ptr.get(), column_size);
|
1099
|
+
deserializer.ReadProperty(102, "data", ptr.get(), column_size);
|
1100
1100
|
|
1101
1101
|
VectorOperations::ReadFromStorage(ptr.get(), count, *this);
|
1102
1102
|
} else {
|
1103
1103
|
switch (logical_type.InternalType()) {
|
1104
1104
|
case PhysicalType::VARCHAR: {
|
1105
1105
|
auto strings = FlatVector::GetData<string_t>(*this);
|
1106
|
-
deserializer.SetTag("data");
|
1106
|
+
deserializer.SetTag(102, "data");
|
1107
1107
|
auto read_count = deserializer.OnListBegin();
|
1108
1108
|
D_ASSERT(read_count == count);
|
1109
1109
|
(void)read_count; // otherwise unused variable error in release mode
|
@@ -1122,7 +1122,7 @@ void Vector::FormatDeserialize(FormatDeserializer &deserializer, idx_t count) {
|
|
1122
1122
|
case PhysicalType::STRUCT: {
|
1123
1123
|
auto &entries = StructVector::GetEntries(*this);
|
1124
1124
|
// Deserialize entries as a list
|
1125
|
-
deserializer.SetTag("children");
|
1125
|
+
deserializer.SetTag(103, "children");
|
1126
1126
|
auto read_size = deserializer.OnListBegin();
|
1127
1127
|
D_ASSERT(read_size == entries.size());
|
1128
1128
|
(void)read_size;
|
@@ -1136,26 +1136,26 @@ void Vector::FormatDeserialize(FormatDeserializer &deserializer, idx_t count) {
|
|
1136
1136
|
}
|
1137
1137
|
case PhysicalType::LIST: {
|
1138
1138
|
// Read the list size
|
1139
|
-
auto list_size = deserializer.ReadProperty<uint64_t>("list_size");
|
1139
|
+
auto list_size = deserializer.ReadProperty<uint64_t>(104, "list_size");
|
1140
1140
|
ListVector::Reserve(*this, list_size);
|
1141
1141
|
ListVector::SetListSize(*this, list_size);
|
1142
1142
|
|
1143
1143
|
// Read the entries
|
1144
1144
|
auto list_entries = FlatVector::GetData<list_entry_t>(*this);
|
1145
|
-
deserializer.SetTag("entries");
|
1145
|
+
deserializer.SetTag(105, "entries");
|
1146
1146
|
auto entries_count = deserializer.OnListBegin();
|
1147
1147
|
D_ASSERT(entries_count == count);
|
1148
1148
|
(void)entries_count;
|
1149
1149
|
for (idx_t i = 0; i < count; i++) {
|
1150
1150
|
deserializer.OnObjectBegin();
|
1151
|
-
deserializer.ReadProperty("offset", list_entries[i].offset);
|
1152
|
-
deserializer.ReadProperty("length", list_entries[i].length);
|
1151
|
+
deserializer.ReadProperty(100, "offset", list_entries[i].offset);
|
1152
|
+
deserializer.ReadProperty(101, "length", list_entries[i].length);
|
1153
1153
|
deserializer.OnObjectEnd();
|
1154
1154
|
}
|
1155
1155
|
deserializer.OnListEnd();
|
1156
1156
|
|
1157
1157
|
// Read the child vector
|
1158
|
-
deserializer.SetTag("child");
|
1158
|
+
deserializer.SetTag(106, "child");
|
1159
1159
|
auto &child = ListVector::GetEntry(*this);
|
1160
1160
|
deserializer.OnObjectBegin();
|
1161
1161
|
child.FormatDeserialize(deserializer, list_size);
|
@@ -55,12 +55,12 @@ struct ApproximateQuantileBindData : public FunctionData {
|
|
55
55
|
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
56
56
|
const AggregateFunction &function) {
|
57
57
|
auto &bind_data = bind_data_p->Cast<ApproximateQuantileBindData>();
|
58
|
-
serializer.WriteProperty("quantiles", bind_data.quantiles);
|
58
|
+
serializer.WriteProperty(100, "quantiles", bind_data.quantiles);
|
59
59
|
}
|
60
60
|
|
61
61
|
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, AggregateFunction &function) {
|
62
62
|
auto result = make_uniq<ApproximateQuantileBindData>();
|
63
|
-
deserializer.ReadProperty("quantiles", result->quantiles);
|
63
|
+
deserializer.ReadProperty(100, "quantiles", result->quantiles);
|
64
64
|
return std::move(result);
|
65
65
|
}
|
66
66
|
|
@@ -461,16 +461,16 @@ struct QuantileBindData : public FunctionData {
|
|
461
461
|
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
462
462
|
const AggregateFunction &function) {
|
463
463
|
auto &bind_data = bind_data_p->Cast<QuantileBindData>();
|
464
|
-
serializer.WriteProperty("quantiles", bind_data.quantiles);
|
465
|
-
serializer.WriteProperty("order", bind_data.order);
|
466
|
-
serializer.WriteProperty("desc", bind_data.desc);
|
464
|
+
serializer.WriteProperty(100, "quantiles", bind_data.quantiles);
|
465
|
+
serializer.WriteProperty(101, "order", bind_data.order);
|
466
|
+
serializer.WriteProperty(102, "desc", bind_data.desc);
|
467
467
|
}
|
468
468
|
|
469
469
|
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, AggregateFunction &function) {
|
470
470
|
auto result = make_uniq<QuantileBindData>();
|
471
|
-
deserializer.ReadProperty("quantiles", result->quantiles);
|
472
|
-
deserializer.ReadProperty("order", result->order);
|
473
|
-
deserializer.ReadProperty("desc", result->desc);
|
471
|
+
deserializer.ReadProperty(100, "quantiles", result->quantiles);
|
472
|
+
deserializer.ReadProperty(101, "order", result->order);
|
473
|
+
deserializer.ReadProperty(102, "desc", result->desc);
|
474
474
|
return std::move(result);
|
475
475
|
}
|
476
476
|
|
@@ -87,14 +87,14 @@ struct ReservoirQuantileBindData : public FunctionData {
|
|
87
87
|
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
88
88
|
const AggregateFunction &function) {
|
89
89
|
auto &bind_data = bind_data_p->Cast<ReservoirQuantileBindData>();
|
90
|
-
serializer.WriteProperty("quantiles", bind_data.quantiles);
|
91
|
-
serializer.WriteProperty("sample_size", bind_data.sample_size);
|
90
|
+
serializer.WriteProperty(100, "quantiles", bind_data.quantiles);
|
91
|
+
serializer.WriteProperty(101, "sample_size", bind_data.sample_size);
|
92
92
|
}
|
93
93
|
|
94
94
|
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, AggregateFunction &function) {
|
95
95
|
auto result = make_uniq<ReservoirQuantileBindData>();
|
96
|
-
deserializer.ReadProperty("quantiles", result->quantiles);
|
97
|
-
deserializer.ReadProperty("sample_size", result->sample_size);
|
96
|
+
deserializer.ReadProperty(100, "quantiles", result->quantiles);
|
97
|
+
deserializer.ReadProperty(101, "sample_size", result->sample_size);
|
98
98
|
return std::move(result);
|
99
99
|
}
|
100
100
|
|
@@ -34,13 +34,13 @@ public:
|
|
34
34
|
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
35
35
|
const ScalarFunction &function) {
|
36
36
|
auto &bind_data = bind_data_p->Cast<ListLambdaBindData>();
|
37
|
-
serializer.WriteProperty("stype", bind_data.stype);
|
38
|
-
serializer.WriteOptionalProperty("lambda_expr", bind_data.lambda_expr);
|
37
|
+
serializer.WriteProperty(100, "stype", bind_data.stype);
|
38
|
+
serializer.WriteOptionalProperty(101, "lambda_expr", bind_data.lambda_expr);
|
39
39
|
}
|
40
40
|
|
41
41
|
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, ScalarFunction &function) {
|
42
|
-
auto stype = deserializer.ReadProperty<LogicalType>("stype");
|
43
|
-
auto lambda_expr = deserializer.ReadOptionalProperty<unique_ptr<Expression>>("lambda_expr");
|
42
|
+
auto stype = deserializer.ReadProperty<LogicalType>(100, "stype");
|
43
|
+
auto lambda_expr = deserializer.ReadOptionalProperty<unique_ptr<Expression>>(101, "lambda_expr");
|
44
44
|
return make_uniq<ListLambdaBindData>(stype, std::move(lambda_expr));
|
45
45
|
}
|
46
46
|
};
|
@@ -1240,14 +1240,14 @@ static unique_ptr<FunctionData> CSVReaderDeserialize(PlanDeserializationState &s
|
|
1240
1240
|
static void CSVReaderFormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
1241
1241
|
const TableFunction &function) {
|
1242
1242
|
auto &bind_data = bind_data_p->Cast<ReadCSVData>();
|
1243
|
-
serializer.WriteProperty("extra_info", function.extra_info);
|
1244
|
-
serializer.WriteProperty("csv_data", bind_data);
|
1243
|
+
serializer.WriteProperty(100, "extra_info", function.extra_info);
|
1244
|
+
serializer.WriteProperty(101, "csv_data", bind_data);
|
1245
1245
|
}
|
1246
1246
|
|
1247
1247
|
static unique_ptr<FunctionData> CSVReaderFormatDeserialize(FormatDeserializer &deserializer, TableFunction &function) {
|
1248
1248
|
unique_ptr<ReadCSVData> result;
|
1249
|
-
deserializer.ReadProperty("extra_info", function.extra_info);
|
1250
|
-
deserializer.ReadProperty("csv_data", result);
|
1249
|
+
deserializer.ReadProperty(100, "extra_info", function.extra_info);
|
1250
|
+
deserializer.ReadProperty(101, "csv_data", result);
|
1251
1251
|
return std::move(result);
|
1252
1252
|
}
|
1253
1253
|
|
@@ -452,29 +452,29 @@ static unique_ptr<FunctionData> TableScanDeserialize(PlanDeserializationState &s
|
|
452
452
|
static void TableScanFormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
453
453
|
const TableFunction &function) {
|
454
454
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
455
|
-
serializer.WriteProperty("catalog", bind_data.table.schema.catalog.GetName());
|
456
|
-
serializer.WriteProperty("schema", bind_data.table.schema.name);
|
457
|
-
serializer.WriteProperty("table", bind_data.table.name);
|
458
|
-
serializer.WriteProperty("is_index_scan", bind_data.is_index_scan);
|
459
|
-
serializer.WriteProperty("is_create_index", bind_data.is_create_index);
|
460
|
-
serializer.WriteProperty("result_ids", bind_data.result_ids);
|
461
|
-
serializer.WriteProperty("result_ids", bind_data.result_ids);
|
455
|
+
serializer.WriteProperty(100, "catalog", bind_data.table.schema.catalog.GetName());
|
456
|
+
serializer.WriteProperty(101, "schema", bind_data.table.schema.name);
|
457
|
+
serializer.WriteProperty(102, "table", bind_data.table.name);
|
458
|
+
serializer.WriteProperty(103, "is_index_scan", bind_data.is_index_scan);
|
459
|
+
serializer.WriteProperty(104, "is_create_index", bind_data.is_create_index);
|
460
|
+
serializer.WriteProperty(105, "result_ids", bind_data.result_ids);
|
461
|
+
serializer.WriteProperty(106, "result_ids", bind_data.result_ids);
|
462
462
|
}
|
463
463
|
|
464
464
|
static unique_ptr<FunctionData> TableScanFormatDeserialize(FormatDeserializer &deserializer, TableFunction &function) {
|
465
|
-
auto catalog = deserializer.ReadProperty<string>("catalog");
|
466
|
-
auto schema = deserializer.ReadProperty<string>("schema");
|
467
|
-
auto table = deserializer.ReadProperty<string>("table");
|
465
|
+
auto catalog = deserializer.ReadProperty<string>(100, "catalog");
|
466
|
+
auto schema = deserializer.ReadProperty<string>(101, "schema");
|
467
|
+
auto table = deserializer.ReadProperty<string>(102, "table");
|
468
468
|
auto &catalog_entry =
|
469
469
|
Catalog::GetEntry<TableCatalogEntry>(deserializer.Get<ClientContext &>(), catalog, schema, table);
|
470
470
|
if (catalog_entry.type != CatalogType::TABLE_ENTRY) {
|
471
471
|
throw SerializationException("Cant find table for %s.%s", schema, table);
|
472
472
|
}
|
473
473
|
auto result = make_uniq<TableScanBindData>(catalog_entry.Cast<DuckTableEntry>());
|
474
|
-
deserializer.ReadProperty("is_index_scan", result->is_index_scan);
|
475
|
-
deserializer.ReadProperty("is_create_index", result->is_create_index);
|
476
|
-
deserializer.ReadProperty("result_ids", result->result_ids);
|
477
|
-
deserializer.ReadProperty("result_ids", result->result_ids);
|
474
|
+
deserializer.ReadProperty(103, "is_index_scan", result->is_index_scan);
|
475
|
+
deserializer.ReadProperty(104, "is_create_index", result->is_create_index);
|
476
|
+
deserializer.ReadProperty(105, "result_ids", result->result_ids);
|
477
|
+
deserializer.ReadProperty(106, "result_ids", result->result_ids);
|
478
478
|
return std::move(result);
|
479
479
|
}
|
480
480
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.8.2-
|
2
|
+
#define DUCKDB_VERSION "0.8.2-dev2850"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "e2128946cc"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -62,12 +62,12 @@ public:
|
|
62
62
|
}
|
63
63
|
|
64
64
|
void FormatSerialize(FormatSerializer &serializer) const {
|
65
|
-
serializer.WriteProperty("internal_vector", internal_vector);
|
65
|
+
serializer.WriteProperty(100, "internal_vector", internal_vector);
|
66
66
|
}
|
67
67
|
|
68
68
|
static IndexVector<T, INDEX_TYPE> FormatDeserialize(FormatDeserializer &deserializer) {
|
69
69
|
IndexVector<T, INDEX_TYPE> result;
|
70
|
-
deserializer.ReadProperty("internal_vector", result.internal_vector);
|
70
|
+
deserializer.ReadProperty(100, "internal_vector", result.internal_vector);
|
71
71
|
return result;
|
72
72
|
}
|
73
73
|
|
@@ -45,13 +45,17 @@ private:
|
|
45
45
|
struct State {
|
46
46
|
uint32_t expected_field_count;
|
47
47
|
idx_t expected_size;
|
48
|
+
field_id_t expected_field_id;
|
48
49
|
uint32_t read_field_count;
|
49
|
-
|
50
|
-
|
50
|
+
|
51
|
+
State(uint32_t expected_field_count, idx_t expected_size, field_id_t expected_field_id)
|
52
|
+
: expected_field_count(expected_field_count), expected_size(expected_size),
|
53
|
+
expected_field_id(expected_field_id), read_field_count(0) {
|
51
54
|
}
|
52
55
|
};
|
53
56
|
|
54
57
|
const char *current_tag = nullptr;
|
58
|
+
field_id_t current_field_id = 0;
|
55
59
|
data_ptr_t ptr;
|
56
60
|
data_ptr_t end_ptr;
|
57
61
|
vector<State> stack;
|
@@ -72,7 +76,7 @@ private:
|
|
72
76
|
}
|
73
77
|
|
74
78
|
// Set the 'tag' of the property to read
|
75
|
-
void SetTag(const char *tag) final;
|
79
|
+
void SetTag(const field_id_t field_id, const char *tag) final;
|
76
80
|
|
77
81
|
//===--------------------------------------------------------------------===//
|
78
82
|
// Nested Types Hooks
|
@@ -24,6 +24,7 @@ private:
|
|
24
24
|
};
|
25
25
|
|
26
26
|
const char *current_tag;
|
27
|
+
field_id_t current_field_id = 0;
|
27
28
|
|
28
29
|
vector<data_t> data;
|
29
30
|
vector<State> stack;
|
@@ -55,7 +56,7 @@ public:
|
|
55
56
|
return std::move(serializer.data);
|
56
57
|
}
|
57
58
|
|
58
|
-
void SetTag(const char *tag) final;
|
59
|
+
void SetTag(const field_id_t field_id, const char *tag) final;
|
59
60
|
|
60
61
|
//===--------------------------------------------------------------------===//
|
61
62
|
// Nested Types Hooks
|
@@ -30,22 +30,22 @@ protected:
|
|
30
30
|
public:
|
31
31
|
// Read into an existing value
|
32
32
|
template <typename T>
|
33
|
-
inline void ReadProperty(const char *tag, T &ret) {
|
34
|
-
SetTag(tag);
|
33
|
+
inline void ReadProperty(const field_id_t field_id, const char *tag, T &ret) {
|
34
|
+
SetTag(field_id, tag);
|
35
35
|
ret = Read<T>();
|
36
36
|
}
|
37
37
|
|
38
38
|
// Read and return a value
|
39
39
|
template <typename T>
|
40
|
-
inline T ReadProperty(const char *tag) {
|
41
|
-
SetTag(tag);
|
40
|
+
inline T ReadProperty(const field_id_t field_id, const char *tag) {
|
41
|
+
SetTag(field_id, tag);
|
42
42
|
return Read<T>();
|
43
43
|
}
|
44
44
|
|
45
45
|
// Read optional property and return a value, or forward a default value
|
46
46
|
template <typename T>
|
47
|
-
inline T ReadOptionalPropertyOrDefault(const char *tag, T &&default_value) {
|
48
|
-
SetTag(tag);
|
47
|
+
inline T ReadOptionalPropertyOrDefault(const field_id_t field_id, const char *tag, T &&default_value) {
|
48
|
+
SetTag(field_id, tag);
|
49
49
|
auto present = OnOptionalBegin();
|
50
50
|
if (present) {
|
51
51
|
auto item = Read<T>();
|
@@ -59,8 +59,8 @@ public:
|
|
59
59
|
|
60
60
|
// Read optional property into an existing value, or use a default value
|
61
61
|
template <typename T>
|
62
|
-
inline void ReadOptionalPropertyOrDefault(const char *tag, T &ret, T &&default_value) {
|
63
|
-
SetTag(tag);
|
62
|
+
inline void ReadOptionalPropertyOrDefault(const field_id_t field_id, const char *tag, T &ret, T &&default_value) {
|
63
|
+
SetTag(field_id, tag);
|
64
64
|
auto present = OnOptionalBegin();
|
65
65
|
if (present) {
|
66
66
|
ret = Read<T>();
|
@@ -74,8 +74,8 @@ public:
|
|
74
74
|
// Read optional property and return a value, or default construct it
|
75
75
|
template <typename T>
|
76
76
|
inline typename std::enable_if<std::is_default_constructible<T>::value, T>::type
|
77
|
-
ReadOptionalProperty(const char *tag) {
|
78
|
-
SetTag(tag);
|
77
|
+
ReadOptionalProperty(const field_id_t field_id, const char *tag) {
|
78
|
+
SetTag(field_id, tag);
|
79
79
|
auto present = OnOptionalBegin();
|
80
80
|
if (present) {
|
81
81
|
auto item = Read<T>();
|
@@ -90,8 +90,8 @@ public:
|
|
90
90
|
// Read optional property into an existing value, or default construct it
|
91
91
|
template <typename T>
|
92
92
|
inline typename std::enable_if<std::is_default_constructible<T>::value, void>::type
|
93
|
-
ReadOptionalProperty(const char *tag, T &ret) {
|
94
|
-
SetTag(tag);
|
93
|
+
ReadOptionalProperty(const field_id_t field_id, const char *tag, T &ret) {
|
94
|
+
SetTag(field_id, tag);
|
95
95
|
auto present = OnOptionalBegin();
|
96
96
|
if (present) {
|
97
97
|
ret = Read<T>();
|
@@ -104,8 +104,8 @@ public:
|
|
104
104
|
|
105
105
|
// Special case:
|
106
106
|
// Read into an existing data_ptr_t
|
107
|
-
inline void ReadProperty(const char *tag, data_ptr_t ret, idx_t count) {
|
108
|
-
SetTag(tag);
|
107
|
+
inline void ReadProperty(const field_id_t field_id, const char *tag, data_ptr_t ret, idx_t count) {
|
108
|
+
SetTag(field_id, tag);
|
109
109
|
ReadDataPtr(ret, count);
|
110
110
|
}
|
111
111
|
|
@@ -128,8 +128,8 @@ public:
|
|
128
128
|
}
|
129
129
|
|
130
130
|
// Manually begin an object - should be followed by EndObject
|
131
|
-
void BeginObject(const char *tag) {
|
132
|
-
SetTag(tag);
|
131
|
+
void BeginObject(const field_id_t field_id, const char *tag) {
|
132
|
+
SetTag(field_id, tag);
|
133
133
|
OnObjectBegin();
|
134
134
|
}
|
135
135
|
|
@@ -392,7 +392,8 @@ private:
|
|
392
392
|
}
|
393
393
|
|
394
394
|
protected:
|
395
|
-
virtual void SetTag(const char *tag) {
|
395
|
+
virtual void SetTag(const field_id_t field_id, const char *tag) {
|
396
|
+
(void)field_id;
|
396
397
|
(void)tag;
|
397
398
|
}
|
398
399
|
|
@@ -28,15 +28,15 @@ protected:
|
|
28
28
|
public:
|
29
29
|
// Serialize a value
|
30
30
|
template <class T>
|
31
|
-
void WriteProperty(const char *tag, const T &value) {
|
32
|
-
SetTag(tag);
|
31
|
+
void WriteProperty(const field_id_t field_id, const char *tag, const T &value) {
|
32
|
+
SetTag(field_id, tag);
|
33
33
|
WriteValue(value);
|
34
34
|
}
|
35
35
|
|
36
36
|
// Optional pointer
|
37
37
|
template <class POINTER>
|
38
|
-
void WriteOptionalProperty(const char *tag, POINTER &&ptr) {
|
39
|
-
SetTag(tag);
|
38
|
+
void WriteOptionalProperty(const field_id_t field_id, const char *tag, POINTER &&ptr) {
|
39
|
+
SetTag(field_id, tag);
|
40
40
|
if (ptr == nullptr) {
|
41
41
|
OnOptionalBegin(false);
|
42
42
|
OnOptionalEnd(false);
|
@@ -48,14 +48,14 @@ public:
|
|
48
48
|
}
|
49
49
|
|
50
50
|
// Special case: data_ptr_T
|
51
|
-
void WriteProperty(const char *tag, const_data_ptr_t ptr, idx_t count) {
|
52
|
-
SetTag(tag);
|
51
|
+
void WriteProperty(const field_id_t field_id, const char *tag, const_data_ptr_t ptr, idx_t count) {
|
52
|
+
SetTag(field_id, tag);
|
53
53
|
WriteDataPtr(ptr, count);
|
54
54
|
}
|
55
55
|
|
56
56
|
// Manually begin an object - should be followed by EndObject
|
57
|
-
void BeginObject(const char *tag) {
|
58
|
-
SetTag(tag);
|
57
|
+
void BeginObject(const field_id_t field_id, const char *tag) {
|
58
|
+
SetTag(field_id, tag);
|
59
59
|
OnObjectBegin();
|
60
60
|
}
|
61
61
|
|
@@ -196,7 +196,8 @@ protected:
|
|
196
196
|
}
|
197
197
|
|
198
198
|
// Handle setting a "tag" (optional)
|
199
|
-
virtual void SetTag(const char *tag) {
|
199
|
+
virtual void SetTag(const field_id_t field_id, const char *tag) {
|
200
|
+
(void)field_id;
|
200
201
|
(void)tag;
|
201
202
|
}
|
202
203
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
#pragma once
|
2
2
|
#include <type_traits>
|
3
|
+
#include <cstdint>
|
4
|
+
|
3
5
|
#include "duckdb/common/vector.hpp"
|
4
6
|
#include "duckdb/common/unordered_map.hpp"
|
5
7
|
#include "duckdb/common/unordered_set.hpp"
|
@@ -10,6 +12,8 @@ namespace duckdb {
|
|
10
12
|
class FormatSerializer; // Forward declare
|
11
13
|
class FormatDeserializer; // Forward declare
|
12
14
|
|
15
|
+
typedef uint32_t field_id_t;
|
16
|
+
|
13
17
|
// Backport to c++11
|
14
18
|
template <class...>
|
15
19
|
using void_t = void;
|
@@ -104,13 +104,13 @@ public:
|
|
104
104
|
static void FormatSerialize(FormatSerializer &serializer, const FUNC &function,
|
105
105
|
optional_ptr<FunctionData> bind_info) {
|
106
106
|
D_ASSERT(!function.name.empty());
|
107
|
-
serializer.WriteProperty("name", function.name);
|
108
|
-
serializer.WriteProperty("arguments", function.arguments);
|
109
|
-
serializer.WriteProperty("original_arguments", function.original_arguments);
|
107
|
+
serializer.WriteProperty(500, "name", function.name);
|
108
|
+
serializer.WriteProperty(501, "arguments", function.arguments);
|
109
|
+
serializer.WriteProperty(502, "original_arguments", function.original_arguments);
|
110
110
|
bool has_serialize = function.format_serialize;
|
111
|
-
serializer.WriteProperty("has_serialize", has_serialize);
|
111
|
+
serializer.WriteProperty(503, "has_serialize", has_serialize);
|
112
112
|
if (has_serialize) {
|
113
|
-
serializer.BeginObject("function_data");
|
113
|
+
serializer.BeginObject(504, "function_data");
|
114
114
|
function.format_serialize(serializer, bind_info, function);
|
115
115
|
serializer.EndObject();
|
116
116
|
D_ASSERT(function.format_deserialize);
|
@@ -135,12 +135,12 @@ public:
|
|
135
135
|
template <class FUNC, class CATALOG_ENTRY>
|
136
136
|
static pair<FUNC, bool> FormatDeserializeBase(FormatDeserializer &deserializer, CatalogType catalog_type) {
|
137
137
|
auto &context = deserializer.Get<ClientContext &>();
|
138
|
-
auto name = deserializer.ReadProperty<string>("name");
|
139
|
-
auto arguments = deserializer.ReadProperty<vector<LogicalType>>("arguments");
|
140
|
-
auto original_arguments = deserializer.ReadProperty<vector<LogicalType>>("original_arguments");
|
138
|
+
auto name = deserializer.ReadProperty<string>(500, "name");
|
139
|
+
auto arguments = deserializer.ReadProperty<vector<LogicalType>>(501, "arguments");
|
140
|
+
auto original_arguments = deserializer.ReadProperty<vector<LogicalType>>(502, "original_arguments");
|
141
141
|
auto function = DeserializeFunction<FUNC, CATALOG_ENTRY>(context, catalog_type, name, std::move(arguments),
|
142
142
|
std::move(original_arguments));
|
143
|
-
auto has_serialize = deserializer.ReadProperty<bool>("has_serialize");
|
143
|
+
auto has_serialize = deserializer.ReadProperty<bool>(503, "has_serialize");
|
144
144
|
return make_pair(std::move(function), has_serialize);
|
145
145
|
}
|
146
146
|
|
@@ -150,7 +150,7 @@ public:
|
|
150
150
|
throw SerializationException("Function requires deserialization but no deserialization function for %s",
|
151
151
|
function.name);
|
152
152
|
}
|
153
|
-
deserializer.BeginObject("function_data");
|
153
|
+
deserializer.BeginObject(504, "function_data");
|
154
154
|
auto result = function.format_deserialize(deserializer, function);
|
155
155
|
deserializer.EndObject();
|
156
156
|
return result;
|
@@ -10,17 +10,20 @@
|
|
10
10
|
|
11
11
|
#include "duckdb/main/relation.hpp"
|
12
12
|
#include "duckdb/parser/parsed_expression.hpp"
|
13
|
+
#include "duckdb/parser/group_by_node.hpp"
|
13
14
|
|
14
15
|
namespace duckdb {
|
15
16
|
|
16
17
|
class AggregateRelation : public Relation {
|
17
18
|
public:
|
18
19
|
DUCKDB_API AggregateRelation(shared_ptr<Relation> child, vector<unique_ptr<ParsedExpression>> expressions);
|
20
|
+
DUCKDB_API AggregateRelation(shared_ptr<Relation> child, vector<unique_ptr<ParsedExpression>> expressions,
|
21
|
+
GroupByNode groups);
|
19
22
|
DUCKDB_API AggregateRelation(shared_ptr<Relation> child, vector<unique_ptr<ParsedExpression>> expressions,
|
20
23
|
vector<unique_ptr<ParsedExpression>> groups);
|
21
24
|
|
22
25
|
vector<unique_ptr<ParsedExpression>> expressions;
|
23
|
-
|
26
|
+
GroupByNode groups;
|
24
27
|
vector<ColumnDefinition> columns;
|
25
28
|
shared_ptr<Relation> child;
|
26
29
|
|
@@ -22,6 +22,17 @@ public:
|
|
22
22
|
vector<unique_ptr<ParsedExpression>> group_expressions;
|
23
23
|
//! The different grouping sets as they map to the group expressions
|
24
24
|
vector<GroupingSet> grouping_sets;
|
25
|
+
|
26
|
+
public:
|
27
|
+
GroupByNode Copy() {
|
28
|
+
GroupByNode node;
|
29
|
+
node.group_expressions.reserve(group_expressions.size());
|
30
|
+
for (auto &expr : group_expressions) {
|
31
|
+
node.group_expressions.push_back(expr->Copy());
|
32
|
+
}
|
33
|
+
node.grouping_sets = grouping_sets;
|
34
|
+
return node;
|
35
|
+
}
|
25
36
|
};
|
26
37
|
|
27
38
|
} // namespace duckdb
|
@@ -22,6 +22,8 @@ struct PGList;
|
|
22
22
|
|
23
23
|
namespace duckdb {
|
24
24
|
|
25
|
+
class GroupByNode;
|
26
|
+
|
25
27
|
//! The parser is responsible for parsing the query and converting it into a set
|
26
28
|
//! of parsed statements. The parsed statements can then be converted into a
|
27
29
|
//! plan and executed.
|
@@ -50,6 +52,8 @@ public:
|
|
50
52
|
//! Parses a list of expressions (i.e. the list found in a SELECT clause)
|
51
53
|
DUCKDB_API static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list,
|
52
54
|
ParserOptions options = ParserOptions());
|
55
|
+
//! Parses a list of GROUP BY expressions
|
56
|
+
static GroupByNode ParseGroupByList(const string &group_by, ParserOptions options = ParserOptions());
|
53
57
|
//! Parses a list as found in an ORDER BY expression (i.e. including optional ASCENDING/DESCENDING modifiers)
|
54
58
|
static vector<OrderByNode> ParseOrderList(const string &select_list, ParserOptions options = ParserOptions());
|
55
59
|
//! Parses an update list (i.e. the list found in the SET clause of an UPDATE statement)
|