duckdb 0.8.2-dev2090.0 → 0.8.2-dev2208.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 +3 -0
- package/package.json +1 -1
- package/src/duckdb/extension/json/buffered_json_reader.cpp +2 -0
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +5 -19
- package/src/duckdb/extension/json/include/json_enums.hpp +60 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +14 -10
- package/src/duckdb/extension/json/include/json_transform.hpp +3 -0
- package/src/duckdb/extension/json/json_enums.cpp +105 -0
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +2 -0
- package/src/duckdb/extension/json/json_functions.cpp +2 -1
- package/src/duckdb/extension/json/json_scan.cpp +44 -0
- package/src/duckdb/extension/json/serialize_json.cpp +92 -0
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +3 -0
- package/src/duckdb/extension/parquet/parquet_extension.cpp +25 -1
- package/src/duckdb/extension/parquet/parquet_reader.cpp +3 -0
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +26 -0
- package/src/duckdb/src/catalog/catalog.cpp +2 -6
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +1 -4
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +0 -4
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +7 -26
- package/src/duckdb/src/catalog/catalog_set.cpp +0 -63
- package/src/duckdb/src/catalog/dependency_manager.cpp +0 -36
- package/src/duckdb/src/common/extra_type_info.cpp +24 -46
- package/src/duckdb/src/common/field_writer.cpp +0 -1
- package/src/duckdb/src/common/file_system.cpp +6 -6
- package/src/duckdb/src/common/filename_pattern.cpp +1 -1
- package/src/duckdb/src/common/gzip_file_system.cpp +7 -12
- package/src/duckdb/src/common/local_file_system.cpp +17 -14
- package/src/duckdb/src/common/multi_file_reader.cpp +8 -5
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +0 -9
- package/src/duckdb/src/common/serializer/format_serializer.cpp +15 -0
- package/src/duckdb/src/common/types.cpp +12 -56
- package/src/duckdb/src/common/virtual_file_system.cpp +4 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +26 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +47 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +28 -0
- package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +10 -0
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +22 -3
- package/src/duckdb/src/core_functions/scalar/union/union_tag.cpp +1 -1
- package/src/duckdb/src/execution/column_binding_resolver.cpp +3 -7
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +0 -10
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +2 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -6
- package/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +1 -2
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +14 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +3 -17
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +2 -5
- package/src/duckdb/src/execution/physical_plan_generator.cpp +1 -5
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +0 -11
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +1 -9
- package/src/duckdb/src/function/cast/string_cast.cpp +0 -1
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +27 -0
- package/src/duckdb/src/function/scalar_function.cpp +5 -20
- package/src/duckdb/src/function/table/read_csv.cpp +20 -1
- package/src/duckdb/src/function/table/system/test_all_types.cpp +4 -4
- package/src/duckdb/src/function/table/table_scan.cpp +35 -0
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_function.cpp +4 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +0 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +0 -6
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +2 -6
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +8 -8
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +45 -15
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +0 -7
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +14 -10
- package/src/duckdb/src/include/duckdb/common/types.hpp +5 -10
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +0 -4
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +11 -2
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +81 -0
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +8 -0
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +8 -3
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +7 -0
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +8 -0
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/deliminator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/filter/constant_filter.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/filter/null_filter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +10 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +5 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +7 -1
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +7 -1
- package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +0 -3
- package/src/duckdb/src/main/attached_database.cpp +2 -2
- package/src/duckdb/src/main/database.cpp +1 -1
- package/src/duckdb/src/main/db_instance_cache.cpp +14 -6
- package/src/duckdb/src/main/extension/extension_helper.cpp +13 -0
- package/src/duckdb/src/main/extension/extension_install.cpp +1 -1
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +1 -2
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +0 -1
- package/src/duckdb/src/optimizer/deliminator.cpp +7 -7
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +3 -5
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +16 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +7 -23
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +0 -24
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +3 -5
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +23 -0
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +22 -0
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +47 -0
- package/src/duckdb/src/planner/logical_operator.cpp +1 -6
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +3 -6
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +2 -14
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +8 -0
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +21 -12
- package/src/duckdb/src/planner/operator/logical_extension_operator.cpp +24 -0
- package/src/duckdb/src/planner/operator/logical_get.cpp +69 -0
- package/src/duckdb/src/planner/planner.cpp +0 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -5
- package/src/duckdb/src/storage/meta_block_reader.cpp +0 -9
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +9 -0
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +33 -0
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +190 -0
- package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +97 -0
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +1 -3
- package/src/duckdb/ub_src_common_serializer.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +0 -4
- package/src/duckdb/ub_src_storage_serialization.cpp +2 -0
- package/src/statement.cpp +0 -2
- package/test/columns.test.ts +1 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_asof_join.hpp +0 -27
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_join.hpp +0 -32
- package/src/duckdb/src/planner/operator/logical_asof_join.cpp +0 -14
- package/src/duckdb/src/planner/operator/logical_delim_join.cpp +0 -25
@@ -4,6 +4,8 @@
|
|
4
4
|
#include "duckdb/planner/expression.hpp"
|
5
5
|
#include "duckdb/common/operator/cast_operators.hpp"
|
6
6
|
#include "duckdb/common/field_writer.hpp"
|
7
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
8
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
7
9
|
|
8
10
|
#include <algorithm>
|
9
11
|
#include <cmath>
|
@@ -17,6 +19,8 @@ struct ApproxQuantileState {
|
|
17
19
|
};
|
18
20
|
|
19
21
|
struct ApproximateQuantileBindData : public FunctionData {
|
22
|
+
ApproximateQuantileBindData() {
|
23
|
+
}
|
20
24
|
explicit ApproximateQuantileBindData(float quantile_p) : quantiles(1, quantile_p) {
|
21
25
|
}
|
22
26
|
|
@@ -48,6 +52,18 @@ struct ApproximateQuantileBindData : public FunctionData {
|
|
48
52
|
return make_uniq<ApproximateQuantileBindData>(std::move(quantiles));
|
49
53
|
}
|
50
54
|
|
55
|
+
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
56
|
+
const AggregateFunction &function) {
|
57
|
+
auto &bind_data = bind_data_p->Cast<ApproximateQuantileBindData>();
|
58
|
+
serializer.WriteProperty("quantiles", bind_data.quantiles);
|
59
|
+
}
|
60
|
+
|
61
|
+
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, AggregateFunction &function) {
|
62
|
+
auto result = make_uniq<ApproximateQuantileBindData>();
|
63
|
+
deserializer.ReadProperty("quantiles", result->quantiles);
|
64
|
+
return std::move(result);
|
65
|
+
}
|
66
|
+
|
51
67
|
vector<float> quantiles;
|
52
68
|
};
|
53
69
|
|
@@ -192,6 +208,8 @@ unique_ptr<FunctionData> BindApproxQuantileDecimal(ClientContext &context, Aggre
|
|
192
208
|
function.name = "approx_quantile";
|
193
209
|
function.serialize = ApproximateQuantileBindData::Serialize;
|
194
210
|
function.deserialize = ApproximateQuantileBindData::Deserialize;
|
211
|
+
function.format_serialize = ApproximateQuantileBindData::FormatSerialize;
|
212
|
+
function.format_deserialize = ApproximateQuantileBindData::FormatDeserialize;
|
195
213
|
return bind_data;
|
196
214
|
}
|
197
215
|
|
@@ -200,6 +218,8 @@ AggregateFunction GetApproximateQuantileAggregate(PhysicalType type) {
|
|
200
218
|
fun.bind = BindApproxQuantile;
|
201
219
|
fun.serialize = ApproximateQuantileBindData::Serialize;
|
202
220
|
fun.deserialize = ApproximateQuantileBindData::Deserialize;
|
221
|
+
fun.format_serialize = ApproximateQuantileBindData::FormatSerialize;
|
222
|
+
fun.format_deserialize = ApproximateQuantileBindData::FormatDeserialize;
|
203
223
|
// temporarily push an argument so we can bind the actual quantile
|
204
224
|
fun.arguments.emplace_back(LogicalType::FLOAT);
|
205
225
|
return fun;
|
@@ -255,6 +275,8 @@ AggregateFunction GetTypedApproxQuantileListAggregateFunction(const LogicalType
|
|
255
275
|
auto fun = ApproxQuantileListAggregate<STATE, INPUT_TYPE, list_entry_t, OP>(type, type);
|
256
276
|
fun.serialize = ApproximateQuantileBindData::Serialize;
|
257
277
|
fun.deserialize = ApproximateQuantileBindData::Deserialize;
|
278
|
+
fun.format_serialize = ApproximateQuantileBindData::FormatSerialize;
|
279
|
+
fun.format_deserialize = ApproximateQuantileBindData::FormatDeserialize;
|
258
280
|
return fun;
|
259
281
|
}
|
260
282
|
|
@@ -300,6 +322,8 @@ unique_ptr<FunctionData> BindApproxQuantileDecimalList(ClientContext &context, A
|
|
300
322
|
function.name = "approx_quantile";
|
301
323
|
function.serialize = ApproximateQuantileBindData::Serialize;
|
302
324
|
function.deserialize = ApproximateQuantileBindData::Deserialize;
|
325
|
+
function.format_serialize = ApproximateQuantileBindData::FormatSerialize;
|
326
|
+
function.format_deserialize = ApproximateQuantileBindData::FormatDeserialize;
|
303
327
|
return bind_data;
|
304
328
|
}
|
305
329
|
|
@@ -308,6 +332,8 @@ AggregateFunction GetApproxQuantileListAggregate(const LogicalType &type) {
|
|
308
332
|
fun.bind = BindApproxQuantile;
|
309
333
|
fun.serialize = ApproximateQuantileBindData::Serialize;
|
310
334
|
fun.deserialize = ApproximateQuantileBindData::Deserialize;
|
335
|
+
fun.format_serialize = ApproximateQuantileBindData::FormatSerialize;
|
336
|
+
fun.format_deserialize = ApproximateQuantileBindData::FormatDeserialize;
|
311
337
|
// temporarily push an argument so we can bind the actual quantile
|
312
338
|
auto list_of_float = LogicalType::LIST(LogicalType::FLOAT);
|
313
339
|
fun.arguments.push_back(list_of_float);
|
@@ -8,6 +8,8 @@
|
|
8
8
|
#include "duckdb/common/types/timestamp.hpp"
|
9
9
|
#include "duckdb/common/queue.hpp"
|
10
10
|
#include "duckdb/common/field_writer.hpp"
|
11
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
12
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
11
13
|
|
12
14
|
#include <algorithm>
|
13
15
|
#include <stdlib.h>
|
@@ -417,6 +419,8 @@ inline Value QuantileAbs(const Value &v) {
|
|
417
419
|
}
|
418
420
|
|
419
421
|
struct QuantileBindData : public FunctionData {
|
422
|
+
QuantileBindData() {
|
423
|
+
}
|
420
424
|
|
421
425
|
explicit QuantileBindData(const Value &quantile_p)
|
422
426
|
: quantiles(1, QuantileAbs(quantile_p)), order(1, 0), desc(quantile_p < 0) {
|
@@ -456,6 +460,27 @@ struct QuantileBindData : public FunctionData {
|
|
456
460
|
return desc == other.desc && quantiles == other.quantiles && order == other.order;
|
457
461
|
}
|
458
462
|
|
463
|
+
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
464
|
+
const AggregateFunction &function) {
|
465
|
+
auto &bind_data = bind_data_p->Cast<QuantileBindData>();
|
466
|
+
serializer.WriteProperty("quantiles", bind_data.quantiles);
|
467
|
+
serializer.WriteProperty("order", bind_data.order);
|
468
|
+
serializer.WriteProperty("desc", bind_data.desc);
|
469
|
+
}
|
470
|
+
|
471
|
+
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, AggregateFunction &function) {
|
472
|
+
auto result = make_uniq<QuantileBindData>();
|
473
|
+
deserializer.ReadProperty("quantiles", result->quantiles);
|
474
|
+
deserializer.ReadProperty("order", result->order);
|
475
|
+
deserializer.ReadProperty("desc", result->desc);
|
476
|
+
return std::move(result);
|
477
|
+
}
|
478
|
+
|
479
|
+
static void FormatSerializeDecimal(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
480
|
+
const AggregateFunction &function) {
|
481
|
+
throw SerializationException("FIXME: quantile serialize for decimal");
|
482
|
+
}
|
483
|
+
|
459
484
|
vector<Value> quantiles;
|
460
485
|
vector<idx_t> order;
|
461
486
|
bool desc;
|
@@ -1189,6 +1214,8 @@ unique_ptr<FunctionData> BindMedianDecimal(ClientContext &context, AggregateFunc
|
|
1189
1214
|
function.name = "median";
|
1190
1215
|
function.serialize = QuantileDecimalSerialize;
|
1191
1216
|
function.deserialize = QuantileDeserialize;
|
1217
|
+
function.format_serialize = QuantileBindData::FormatSerializeDecimal;
|
1218
|
+
function.format_deserialize = QuantileBindData::FormatDeserialize;
|
1192
1219
|
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1193
1220
|
return bind_data;
|
1194
1221
|
}
|
@@ -1245,6 +1272,8 @@ unique_ptr<FunctionData> BindDiscreteQuantileDecimal(ClientContext &context, Agg
|
|
1245
1272
|
function.name = "quantile_disc";
|
1246
1273
|
function.serialize = QuantileDecimalSerialize;
|
1247
1274
|
function.deserialize = QuantileDeserialize;
|
1275
|
+
function.format_serialize = QuantileBindData::FormatSerializeDecimal;
|
1276
|
+
function.format_deserialize = QuantileBindData::FormatDeserialize;
|
1248
1277
|
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1249
1278
|
return bind_data;
|
1250
1279
|
}
|
@@ -1256,6 +1285,8 @@ unique_ptr<FunctionData> BindDiscreteQuantileDecimalList(ClientContext &context,
|
|
1256
1285
|
function.name = "quantile_disc";
|
1257
1286
|
function.serialize = QuantileDecimalSerialize;
|
1258
1287
|
function.deserialize = QuantileDeserialize;
|
1288
|
+
function.format_serialize = QuantileBindData::FormatSerializeDecimal;
|
1289
|
+
function.format_deserialize = QuantileBindData::FormatDeserialize;
|
1259
1290
|
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1260
1291
|
return bind_data;
|
1261
1292
|
}
|
@@ -1267,6 +1298,8 @@ unique_ptr<FunctionData> BindContinuousQuantileDecimal(ClientContext &context, A
|
|
1267
1298
|
function.name = "quantile_cont";
|
1268
1299
|
function.serialize = QuantileDecimalSerialize;
|
1269
1300
|
function.deserialize = QuantileDeserialize;
|
1301
|
+
function.format_serialize = QuantileBindData::FormatSerializeDecimal;
|
1302
|
+
function.format_deserialize = QuantileBindData::FormatDeserialize;
|
1270
1303
|
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1271
1304
|
return bind_data;
|
1272
1305
|
}
|
@@ -1278,6 +1311,8 @@ unique_ptr<FunctionData> BindContinuousQuantileDecimalList(ClientContext &contex
|
|
1278
1311
|
function.name = "quantile_cont";
|
1279
1312
|
function.serialize = QuantileDecimalSerialize;
|
1280
1313
|
function.deserialize = QuantileDeserialize;
|
1314
|
+
function.format_serialize = QuantileBindData::FormatSerializeDecimal;
|
1315
|
+
function.format_deserialize = QuantileBindData::FormatDeserialize;
|
1281
1316
|
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1282
1317
|
return bind_data;
|
1283
1318
|
}
|
@@ -1298,6 +1333,8 @@ AggregateFunction GetMedianAggregate(const LogicalType &type) {
|
|
1298
1333
|
fun.bind = BindMedian;
|
1299
1334
|
fun.serialize = QuantileSerialize;
|
1300
1335
|
fun.deserialize = QuantileDeserialize;
|
1336
|
+
fun.format_serialize = QuantileBindData::FormatSerialize;
|
1337
|
+
fun.format_deserialize = QuantileBindData::FormatDeserialize;
|
1301
1338
|
return fun;
|
1302
1339
|
}
|
1303
1340
|
|
@@ -1306,6 +1343,8 @@ AggregateFunction GetDiscreteQuantileAggregate(const LogicalType &type) {
|
|
1306
1343
|
fun.bind = BindQuantile;
|
1307
1344
|
fun.serialize = QuantileSerialize;
|
1308
1345
|
fun.deserialize = QuantileDeserialize;
|
1346
|
+
fun.format_serialize = QuantileBindData::FormatSerialize;
|
1347
|
+
fun.format_deserialize = QuantileBindData::FormatDeserialize;
|
1309
1348
|
// temporarily push an argument so we can bind the actual quantile
|
1310
1349
|
fun.arguments.emplace_back(LogicalType::DOUBLE);
|
1311
1350
|
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
@@ -1317,6 +1356,8 @@ AggregateFunction GetDiscreteQuantileListAggregate(const LogicalType &type) {
|
|
1317
1356
|
fun.bind = BindQuantile;
|
1318
1357
|
fun.serialize = QuantileSerialize;
|
1319
1358
|
fun.deserialize = QuantileDeserialize;
|
1359
|
+
fun.format_serialize = QuantileBindData::FormatSerialize;
|
1360
|
+
fun.format_deserialize = QuantileBindData::FormatDeserialize;
|
1320
1361
|
// temporarily push an argument so we can bind the actual quantile
|
1321
1362
|
auto list_of_double = LogicalType::LIST(LogicalType::DOUBLE);
|
1322
1363
|
fun.arguments.push_back(list_of_double);
|
@@ -1329,6 +1370,8 @@ AggregateFunction GetContinuousQuantileAggregate(const LogicalType &type) {
|
|
1329
1370
|
fun.bind = BindQuantile;
|
1330
1371
|
fun.serialize = QuantileSerialize;
|
1331
1372
|
fun.deserialize = QuantileDeserialize;
|
1373
|
+
fun.format_serialize = QuantileBindData::FormatSerialize;
|
1374
|
+
fun.format_deserialize = QuantileBindData::FormatDeserialize;
|
1332
1375
|
// temporarily push an argument so we can bind the actual quantile
|
1333
1376
|
fun.arguments.emplace_back(LogicalType::DOUBLE);
|
1334
1377
|
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
@@ -1340,6 +1383,8 @@ AggregateFunction GetContinuousQuantileListAggregate(const LogicalType &type) {
|
|
1340
1383
|
fun.bind = BindQuantile;
|
1341
1384
|
fun.serialize = QuantileSerialize;
|
1342
1385
|
fun.deserialize = QuantileDeserialize;
|
1386
|
+
fun.format_serialize = QuantileBindData::FormatSerialize;
|
1387
|
+
fun.format_deserialize = QuantileBindData::FormatDeserialize;
|
1343
1388
|
// temporarily push an argument so we can bind the actual quantile
|
1344
1389
|
auto list_of_double = LogicalType::LIST(LogicalType::DOUBLE);
|
1345
1390
|
fun.arguments.push_back(list_of_double);
|
@@ -1353,6 +1398,8 @@ AggregateFunction GetQuantileDecimalAggregate(const vector<LogicalType> &argumen
|
|
1353
1398
|
fun.bind = bind;
|
1354
1399
|
fun.serialize = QuantileSerialize;
|
1355
1400
|
fun.deserialize = QuantileDeserialize;
|
1401
|
+
fun.format_serialize = QuantileBindData::FormatSerialize;
|
1402
|
+
fun.format_deserialize = QuantileBindData::FormatDeserialize;
|
1356
1403
|
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1357
1404
|
return fun;
|
1358
1405
|
}
|
@@ -4,6 +4,8 @@
|
|
4
4
|
#include "duckdb/planner/expression.hpp"
|
5
5
|
#include "duckdb/common/queue.hpp"
|
6
6
|
#include "duckdb/common/field_writer.hpp"
|
7
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
8
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
7
9
|
|
8
10
|
#include <algorithm>
|
9
11
|
#include <stdlib.h>
|
@@ -49,6 +51,8 @@ struct ReservoirQuantileState {
|
|
49
51
|
};
|
50
52
|
|
51
53
|
struct ReservoirQuantileBindData : public FunctionData {
|
54
|
+
ReservoirQuantileBindData() {
|
55
|
+
}
|
52
56
|
ReservoirQuantileBindData(double quantile_p, int32_t sample_size_p)
|
53
57
|
: quantiles(1, quantile_p), sample_size(sample_size_p) {
|
54
58
|
}
|
@@ -80,6 +84,20 @@ struct ReservoirQuantileBindData : public FunctionData {
|
|
80
84
|
return make_uniq<ReservoirQuantileBindData>(std::move(quantiles), sample_size);
|
81
85
|
}
|
82
86
|
|
87
|
+
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
88
|
+
const AggregateFunction &function) {
|
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);
|
92
|
+
}
|
93
|
+
|
94
|
+
static unique_ptr<FunctionData> FormatDeserialize(FormatDeserializer &deserializer, AggregateFunction &function) {
|
95
|
+
auto result = make_uniq<ReservoirQuantileBindData>();
|
96
|
+
deserializer.ReadProperty("quantiles", result->quantiles);
|
97
|
+
deserializer.ReadProperty("sample_size", result->sample_size);
|
98
|
+
return std::move(result);
|
99
|
+
}
|
100
|
+
|
83
101
|
vector<double> quantiles;
|
84
102
|
int32_t sample_size;
|
85
103
|
};
|
@@ -355,6 +373,8 @@ unique_ptr<FunctionData> BindReservoirQuantileDecimal(ClientContext &context, Ag
|
|
355
373
|
function.name = "reservoir_quantile";
|
356
374
|
function.serialize = ReservoirQuantileBindData::Serialize;
|
357
375
|
function.deserialize = ReservoirQuantileBindData::Deserialize;
|
376
|
+
function.format_serialize = ReservoirQuantileBindData::FormatSerialize;
|
377
|
+
function.format_deserialize = ReservoirQuantileBindData::FormatDeserialize;
|
358
378
|
return bind_data;
|
359
379
|
}
|
360
380
|
|
@@ -363,6 +383,8 @@ AggregateFunction GetReservoirQuantileAggregate(PhysicalType type) {
|
|
363
383
|
fun.bind = BindReservoirQuantile;
|
364
384
|
fun.serialize = ReservoirQuantileBindData::Serialize;
|
365
385
|
fun.deserialize = ReservoirQuantileBindData::Deserialize;
|
386
|
+
fun.format_serialize = ReservoirQuantileBindData::FormatSerialize;
|
387
|
+
fun.format_deserialize = ReservoirQuantileBindData::FormatDeserialize;
|
366
388
|
// temporarily push an argument so we can bind the actual quantile
|
367
389
|
fun.arguments.emplace_back(LogicalType::DOUBLE);
|
368
390
|
return fun;
|
@@ -374,6 +396,8 @@ unique_ptr<FunctionData> BindReservoirQuantileDecimalList(ClientContext &context
|
|
374
396
|
auto bind_data = BindReservoirQuantile(context, function, arguments);
|
375
397
|
function.serialize = ReservoirQuantileBindData::Serialize;
|
376
398
|
function.deserialize = ReservoirQuantileBindData::Deserialize;
|
399
|
+
function.format_serialize = ReservoirQuantileBindData::FormatSerialize;
|
400
|
+
function.format_deserialize = ReservoirQuantileBindData::FormatDeserialize;
|
377
401
|
function.name = "reservoir_quantile";
|
378
402
|
return bind_data;
|
379
403
|
}
|
@@ -383,6 +407,8 @@ AggregateFunction GetReservoirQuantileListAggregate(const LogicalType &type) {
|
|
383
407
|
fun.bind = BindReservoirQuantile;
|
384
408
|
fun.serialize = ReservoirQuantileBindData::Serialize;
|
385
409
|
fun.deserialize = ReservoirQuantileBindData::Deserialize;
|
410
|
+
fun.format_serialize = ReservoirQuantileBindData::FormatSerialize;
|
411
|
+
fun.format_deserialize = ReservoirQuantileBindData::FormatDeserialize;
|
386
412
|
// temporarily push an argument so we can bind the actual quantile
|
387
413
|
auto list_of_double = LogicalType::LIST(LogicalType::DOUBLE);
|
388
414
|
fun.arguments.push_back(list_of_double);
|
@@ -411,6 +437,8 @@ static void GetReservoirQuantileDecimalFunction(AggregateFunctionSet &set, const
|
|
411
437
|
BindReservoirQuantileDecimal);
|
412
438
|
fun.serialize = ReservoirQuantileBindData::Serialize;
|
413
439
|
fun.deserialize = ReservoirQuantileBindData::Deserialize;
|
440
|
+
fun.format_serialize = ReservoirQuantileBindData::FormatSerialize;
|
441
|
+
fun.format_deserialize = ReservoirQuantileBindData::FormatDeserialize;
|
414
442
|
set.AddFunction(fun);
|
415
443
|
|
416
444
|
fun.arguments.emplace_back(LogicalType::INTEGER);
|
@@ -94,6 +94,16 @@ ScalarFunctionSet StrfTimeFun::GetFunctions() {
|
|
94
94
|
return strftime;
|
95
95
|
}
|
96
96
|
|
97
|
+
StrpTimeFormat::StrpTimeFormat() {
|
98
|
+
}
|
99
|
+
|
100
|
+
StrpTimeFormat::StrpTimeFormat(const string &format_string) {
|
101
|
+
if (format_string.empty()) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
StrTimeFormat::ParseFormatSpecifier(format_string, *this);
|
105
|
+
}
|
106
|
+
|
97
107
|
struct StrpTimeBindData : public FunctionData {
|
98
108
|
StrpTimeBindData(const StrpTimeFormat &format, const string &format_string)
|
99
109
|
: formats(1, format), format_strings(1, format_string) {
|
@@ -8,6 +8,8 @@
|
|
8
8
|
#include "duckdb/planner/expression/bound_lambda_expression.hpp"
|
9
9
|
#include "duckdb/planner/expression/bound_cast_expression.hpp"
|
10
10
|
#include "duckdb/function/cast/cast_function_set.hpp"
|
11
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
12
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
11
13
|
|
12
14
|
namespace duckdb {
|
13
15
|
|
@@ -28,6 +30,19 @@ public:
|
|
28
30
|
ScalarFunction &bound_function) {
|
29
31
|
throw NotImplementedException("FIXME: list lambda deserialize");
|
30
32
|
}
|
33
|
+
|
34
|
+
static void FormatSerialize(FormatSerializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
35
|
+
const ScalarFunction &function) {
|
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);
|
39
|
+
}
|
40
|
+
|
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");
|
44
|
+
return make_uniq<ListLambdaBindData>(stype, std::move(lambda_expr));
|
45
|
+
}
|
31
46
|
};
|
32
47
|
|
33
48
|
ListLambdaBindData::ListLambdaBindData(const LogicalType &stype_p, unique_ptr<Expression> lambda_expr_p)
|
@@ -35,12 +50,12 @@ ListLambdaBindData::ListLambdaBindData(const LogicalType &stype_p, unique_ptr<Ex
|
|
35
50
|
}
|
36
51
|
|
37
52
|
unique_ptr<FunctionData> ListLambdaBindData::Copy() const {
|
38
|
-
return make_uniq<ListLambdaBindData>(stype, lambda_expr->Copy());
|
53
|
+
return make_uniq<ListLambdaBindData>(stype, lambda_expr ? lambda_expr->Copy() : nullptr);
|
39
54
|
}
|
40
55
|
|
41
56
|
bool ListLambdaBindData::Equals(const FunctionData &other_p) const {
|
42
57
|
auto &other = other_p.Cast<ListLambdaBindData>();
|
43
|
-
return
|
58
|
+
return Expression::Equals(lambda_expr, other.lambda_expr) && stype == other.stype;
|
44
59
|
}
|
45
60
|
|
46
61
|
ListLambdaBindData::~ListLambdaBindData() {
|
@@ -330,7 +345,7 @@ static unique_ptr<FunctionData> ListLambdaBind(ClientContext &context, ScalarFun
|
|
330
345
|
if (arguments[0]->return_type.id() == LogicalTypeId::SQLNULL) {
|
331
346
|
bound_function.arguments[0] = LogicalType::SQLNULL;
|
332
347
|
bound_function.return_type = LogicalType::SQLNULL;
|
333
|
-
return make_uniq<
|
348
|
+
return make_uniq<ListLambdaBindData>(bound_function.return_type, nullptr);
|
334
349
|
}
|
335
350
|
|
336
351
|
if (arguments[0]->return_type.id() == LogicalTypeId::UNKNOWN) {
|
@@ -385,6 +400,8 @@ ScalarFunction ListTransformFun::GetFunction() {
|
|
385
400
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
386
401
|
fun.serialize = ListLambdaBindData::Serialize;
|
387
402
|
fun.deserialize = ListLambdaBindData::Deserialize;
|
403
|
+
fun.format_serialize = ListLambdaBindData::FormatSerialize;
|
404
|
+
fun.format_deserialize = ListLambdaBindData::FormatDeserialize;
|
388
405
|
return fun;
|
389
406
|
}
|
390
407
|
|
@@ -394,6 +411,8 @@ ScalarFunction ListFilterFun::GetFunction() {
|
|
394
411
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
395
412
|
fun.serialize = ListLambdaBindData::Serialize;
|
396
413
|
fun.deserialize = ListLambdaBindData::Deserialize;
|
414
|
+
fun.format_serialize = ListLambdaBindData::FormatSerialize;
|
415
|
+
fun.format_deserialize = ListLambdaBindData::FormatDeserialize;
|
397
416
|
return fun;
|
398
417
|
}
|
399
418
|
|
@@ -39,7 +39,7 @@ static unique_ptr<FunctionData> UnionTagBind(ClientContext &context, ScalarFunct
|
|
39
39
|
FlatVector::GetData<string_t>(varchar_vector)[i] =
|
40
40
|
str.IsInlined() ? str : StringVector::AddString(varchar_vector, str);
|
41
41
|
}
|
42
|
-
auto enum_type = LogicalType::ENUM(
|
42
|
+
auto enum_type = LogicalType::ENUM(varchar_vector, member_count);
|
43
43
|
bound_function.return_type = enum_type;
|
44
44
|
|
45
45
|
return nullptr;
|
@@ -3,7 +3,6 @@
|
|
3
3
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
4
4
|
#include "duckdb/planner/operator/logical_any_join.hpp"
|
5
5
|
#include "duckdb/planner/operator/logical_create_index.hpp"
|
6
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
7
6
|
#include "duckdb/planner/operator/logical_insert.hpp"
|
8
7
|
|
9
8
|
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
|
@@ -29,12 +28,9 @@ void ColumnBindingResolver::VisitOperator(LogicalOperator &op) {
|
|
29
28
|
for (auto &cond : comp_join.conditions) {
|
30
29
|
VisitExpression(&cond.left);
|
31
30
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
for (auto &expr : delim_join.duplicate_eliminated_columns) {
|
36
|
-
VisitExpression(&expr);
|
37
|
-
}
|
31
|
+
// visit the duplicate eliminated columns on the LHS, if any
|
32
|
+
for (auto &expr : comp_join.duplicate_eliminated_columns) {
|
33
|
+
VisitExpression(&expr);
|
38
34
|
}
|
39
35
|
// then get the bindings of the RHS and resolve the RHS expressions
|
40
36
|
VisitOperator(*comp_join.children[1]);
|
@@ -108,7 +108,7 @@ SinkCombineResultType PhysicalCopyToFile::Combine(ExecutionContext &context, Ope
|
|
108
108
|
auto partition_key_map = l.part_buffer->GetReverseMap();
|
109
109
|
|
110
110
|
string trimmed_path = file_path;
|
111
|
-
StringUtil::RTrim(trimmed_path, fs.PathSeparator());
|
111
|
+
StringUtil::RTrim(trimmed_path, fs.PathSeparator(trimmed_path));
|
112
112
|
|
113
113
|
for (idx_t i = 0; i < partitions.size(); i++) {
|
114
114
|
string hive_path =
|
@@ -9,16 +9,6 @@
|
|
9
9
|
|
10
10
|
namespace duckdb {
|
11
11
|
|
12
|
-
PhysicalTableScan::PhysicalTableScan(vector<LogicalType> types, TableFunction function_p,
|
13
|
-
unique_ptr<FunctionData> bind_data_p, vector<column_t> column_ids_p,
|
14
|
-
vector<string> names_p, unique_ptr<TableFilterSet> table_filters_p,
|
15
|
-
idx_t estimated_cardinality)
|
16
|
-
: PhysicalOperator(PhysicalOperatorType::TABLE_SCAN, std::move(types), estimated_cardinality),
|
17
|
-
function(std::move(function_p)), bind_data(std::move(bind_data_p)), column_ids(std::move(column_ids_p)),
|
18
|
-
names(std::move(names_p)), table_filters(std::move(table_filters_p)) {
|
19
|
-
extra_info.file_filters = "";
|
20
|
-
}
|
21
|
-
|
22
12
|
PhysicalTableScan::PhysicalTableScan(vector<LogicalType> types, TableFunction function_p,
|
23
13
|
unique_ptr<FunctionData> bind_data_p, vector<LogicalType> returned_types_p,
|
24
14
|
vector<column_t> column_ids_p, vector<idx_t> projection_ids_p,
|
@@ -66,7 +66,8 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c
|
|
66
66
|
const auto &path = info->path;
|
67
67
|
|
68
68
|
if (name.empty()) {
|
69
|
-
|
69
|
+
auto &fs = FileSystem::GetFileSystem(context.client);
|
70
|
+
name = AttachedDatabase::ExtractDatabaseName(path, fs);
|
70
71
|
}
|
71
72
|
auto &db_manager = DatabaseManager::Get(context.client);
|
72
73
|
auto existing_db = db_manager.GetDatabaseFromPath(context.client, path);
|
@@ -74,15 +74,11 @@ SourceResultType PhysicalCreateType::GetData(ExecutionContext &context, DataChun
|
|
74
74
|
if (IsSink()) {
|
75
75
|
D_ASSERT(info->type == LogicalType::INVALID);
|
76
76
|
auto &g_sink_state = sink_state->Cast<CreateTypeGlobalState>();
|
77
|
-
info->type = LogicalType::ENUM(
|
77
|
+
info->type = LogicalType::ENUM(g_sink_state.result, g_sink_state.size);
|
78
78
|
}
|
79
79
|
|
80
80
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
81
|
-
|
82
|
-
D_ASSERT(catalog_entry->type == CatalogType::TYPE_ENTRY);
|
83
|
-
auto &catalog_type = catalog_entry->Cast<TypeCatalogEntry>();
|
84
|
-
EnumType::SetCatalog(info->type, &catalog_type);
|
85
|
-
|
81
|
+
catalog.CreateType(context.client, *info);
|
86
82
|
return SourceResultType::FINISHED;
|
87
83
|
}
|
88
84
|
|
@@ -7,11 +7,10 @@
|
|
7
7
|
#include "duckdb/planner/expression/bound_constant_expression.hpp"
|
8
8
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
9
9
|
#include "duckdb/planner/expression/bound_window_expression.hpp"
|
10
|
-
#include "duckdb/planner/operator/logical_asof_join.hpp"
|
11
10
|
|
12
11
|
namespace duckdb {
|
13
12
|
|
14
|
-
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::
|
13
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) {
|
15
14
|
// now visit the children
|
16
15
|
D_ASSERT(op.children.size() == 2);
|
17
16
|
idx_t lhs_cardinality = op.children[0]->EstimateCardinality(context);
|
@@ -237,7 +237,7 @@ static void RewriteJoinCondition(Expression &expr, idx_t offset) {
|
|
237
237
|
ExpressionIterator::EnumerateChildren(expr, [&](Expression &child) { RewriteJoinCondition(child, offset); });
|
238
238
|
}
|
239
239
|
|
240
|
-
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::
|
240
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoin &op) {
|
241
241
|
// now visit the children
|
242
242
|
D_ASSERT(op.children.size() == 2);
|
243
243
|
idx_t lhs_cardinality = op.children[0]->EstimateCardinality(context);
|
@@ -338,4 +338,17 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalComparison
|
|
338
338
|
return plan;
|
339
339
|
}
|
340
340
|
|
341
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalComparisonJoin &op) {
|
342
|
+
switch (op.type) {
|
343
|
+
case LogicalOperatorType::LOGICAL_ASOF_JOIN:
|
344
|
+
return PlanAsOfJoin(op);
|
345
|
+
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
|
346
|
+
return PlanComparisonJoin(op);
|
347
|
+
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
348
|
+
return PlanDelimJoin(op);
|
349
|
+
default:
|
350
|
+
throw InternalException("Unrecognized operator type for LogicalComparisonJoin");
|
351
|
+
}
|
352
|
+
}
|
353
|
+
|
341
354
|
} // namespace duckdb
|
@@ -1,12 +1,11 @@
|
|
1
1
|
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
2
2
|
#include "duckdb/execution/operator/projection/physical_projection.hpp"
|
3
3
|
#include "duckdb/execution/operator/filter/physical_filter.hpp"
|
4
|
-
#include "duckdb/execution/operator/scan/physical_table_scan.hpp"
|
5
4
|
#include "duckdb/execution/operator/schema/physical_create_index.hpp"
|
6
5
|
#include "duckdb/execution/operator/order/physical_order.hpp"
|
7
6
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
8
|
-
#include "duckdb/function/table/table_scan.hpp"
|
9
7
|
#include "duckdb/planner/operator/logical_create_index.hpp"
|
8
|
+
#include "duckdb/planner/operator/logical_get.hpp"
|
10
9
|
#include "duckdb/planner/expression/bound_operator_expression.hpp"
|
11
10
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
12
11
|
#include "duckdb/planner/table_filter.hpp"
|
@@ -14,11 +13,10 @@
|
|
14
13
|
namespace duckdb {
|
15
14
|
|
16
15
|
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCreateIndex &op) {
|
17
|
-
|
18
16
|
// generate a physical plan for the parallel index creation which consists of the following operators
|
19
17
|
// table scan - projection (for expression execution) - filter (NOT NULL) - order - create index
|
20
|
-
|
21
|
-
|
18
|
+
D_ASSERT(op.children.size() == 1);
|
19
|
+
auto table_scan = CreatePlan(*op.children[0]);
|
22
20
|
|
23
21
|
// validate that all expressions contain valid scalar functions
|
24
22
|
// e.g. get_current_timestamp(), random(), and sequence values are not allowed as ART keys
|
@@ -32,19 +30,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCreateInde
|
|
32
30
|
}
|
33
31
|
|
34
32
|
// table scan operator for index key columns and row IDs
|
35
|
-
|
36
|
-
unique_ptr<TableFilterSet> table_filters;
|
37
|
-
op.info->column_ids.emplace_back(COLUMN_IDENTIFIER_ROW_ID);
|
38
|
-
|
39
|
-
auto &bind_data = op.bind_data->Cast<TableScanBindData>();
|
40
|
-
bind_data.is_create_index = true;
|
41
|
-
|
42
|
-
auto table_scan =
|
43
|
-
make_uniq<PhysicalTableScan>(op.info->scan_types, op.function, std::move(op.bind_data), op.info->column_ids,
|
44
|
-
op.info->names, std::move(table_filters), op.estimated_cardinality);
|
45
|
-
|
46
33
|
dependencies.AddDependency(op.table);
|
47
|
-
op.info->column_ids.pop_back();
|
48
34
|
|
49
35
|
D_ASSERT(op.info->scan_types.size() - 1 <= op.info->names.size());
|
50
36
|
D_ASSERT(op.info->scan_types.size() - 1 <= op.info->column_ids.size());
|
@@ -1,10 +1,7 @@
|
|
1
|
-
#include "duckdb/execution/aggregate_hashtable.hpp"
|
2
1
|
#include "duckdb/execution/operator/join/physical_delim_join.hpp"
|
3
2
|
#include "duckdb/execution/operator/join/physical_hash_join.hpp"
|
4
3
|
#include "duckdb/execution/operator/projection/physical_projection.hpp"
|
5
4
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
6
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
7
|
-
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
8
5
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
9
6
|
#include "duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp"
|
10
7
|
|
@@ -19,9 +16,9 @@ static void GatherDelimScans(const PhysicalOperator &op, vector<const_reference<
|
|
19
16
|
}
|
20
17
|
}
|
21
18
|
|
22
|
-
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::
|
19
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::PlanDelimJoin(LogicalComparisonJoin &op) {
|
23
20
|
// first create the underlying join
|
24
|
-
auto plan =
|
21
|
+
auto plan = PlanComparisonJoin(op);
|
25
22
|
// this should create a join, not a cross product
|
26
23
|
D_ASSERT(plan && plan->type != PhysicalOperatorType::CROSS_PRODUCT);
|
27
24
|
// duplicate eliminated join
|
@@ -113,12 +113,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalOperator &
|
|
113
113
|
case LogicalOperatorType::LOGICAL_ANY_JOIN:
|
114
114
|
plan = CreatePlan(op.Cast<LogicalAnyJoin>());
|
115
115
|
break;
|
116
|
-
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
117
|
-
plan = CreatePlan(op.Cast<LogicalDelimJoin>());
|
118
|
-
break;
|
119
116
|
case LogicalOperatorType::LOGICAL_ASOF_JOIN:
|
120
|
-
|
121
|
-
break;
|
117
|
+
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
122
118
|
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
|
123
119
|
plan = CreatePlan(op.Cast<LogicalComparisonJoin>());
|
124
120
|
break;
|
@@ -218,22 +218,11 @@ AggregateFunction CountFun::GetFunction() {
|
|
218
218
|
return fun;
|
219
219
|
}
|
220
220
|
|
221
|
-
static void CountStarSerialize(FieldWriter &writer, const FunctionData *bind_data, const AggregateFunction &function) {
|
222
|
-
}
|
223
|
-
|
224
|
-
static unique_ptr<FunctionData> CountStarDeserialize(PlanDeserializationState &state, FieldReader &reader,
|
225
|
-
AggregateFunction &function) {
|
226
|
-
return nullptr;
|
227
|
-
}
|
228
|
-
|
229
221
|
AggregateFunction CountStarFun::GetFunction() {
|
230
222
|
auto fun = AggregateFunction::NullaryAggregate<int64_t, int64_t, CountStarFunction>(LogicalType::BIGINT);
|
231
223
|
fun.name = "count_star";
|
232
224
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
233
225
|
fun.window = CountStarFunction::Window<int64_t>;
|
234
|
-
// TODO is there a better way to set those?
|
235
|
-
fun.serialize = CountStarSerialize;
|
236
|
-
fun.deserialize = CountStarDeserialize;
|
237
226
|
return fun;
|
238
227
|
}
|
239
228
|
|
@@ -516,14 +516,6 @@ struct SortedAggregateFunction {
|
|
516
516
|
|
517
517
|
result.Verify(count);
|
518
518
|
}
|
519
|
-
|
520
|
-
static void Serialize(FieldWriter &writer, const FunctionData *bind_data, const AggregateFunction &function) {
|
521
|
-
throw NotImplementedException("FIXME: serialize sorted aggregate not supported");
|
522
|
-
}
|
523
|
-
static unique_ptr<FunctionData> Deserialize(PlanDeserializationState &state, FieldReader &reader,
|
524
|
-
AggregateFunction &function) {
|
525
|
-
throw NotImplementedException("FIXME: deserialize sorted aggregate not supported");
|
526
|
-
}
|
527
519
|
};
|
528
520
|
|
529
521
|
void FunctionBinder::BindSortedAggregate(ClientContext &context, BoundAggregateExpression &expr,
|
@@ -582,7 +574,7 @@ void FunctionBinder::BindSortedAggregate(ClientContext &context, BoundAggregateE
|
|
582
574
|
AggregateFunction::StateCombine<SortedAggregateState, SortedAggregateFunction>,
|
583
575
|
SortedAggregateFunction::Finalize, bound_function.null_handling, SortedAggregateFunction::SimpleUpdate, nullptr,
|
584
576
|
AggregateFunction::StateDestroy<SortedAggregateState, SortedAggregateFunction>, nullptr,
|
585
|
-
SortedAggregateFunction::Window
|
577
|
+
SortedAggregateFunction::Window);
|
586
578
|
|
587
579
|
expr.function = std::move(ordered_aggregate);
|
588
580
|
expr.bind_info = std::move(sorted_bind);
|