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
@@ -69,9 +69,15 @@ public:
|
|
69
69
|
//! Skips the serialization check in VerifyPlan
|
70
70
|
bool SupportSerialization() const override {
|
71
71
|
return function.verify_serialization;
|
72
|
-
}
|
72
|
+
}
|
73
|
+
|
74
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
75
|
+
static unique_ptr<LogicalOperator> FormatDeserialize(FormatDeserializer &deserializer);
|
73
76
|
|
74
77
|
protected:
|
75
78
|
void ResolveTypes() override;
|
79
|
+
|
80
|
+
private:
|
81
|
+
LogicalGet();
|
76
82
|
};
|
77
83
|
} // namespace duckdb
|
@@ -36,6 +36,7 @@ public:
|
|
36
36
|
virtual std::string GetName() = 0;
|
37
37
|
virtual unique_ptr<LogicalExtensionOperator> Deserialize(LogicalDeserializationState &state,
|
38
38
|
FieldReader &reader) = 0;
|
39
|
+
virtual unique_ptr<LogicalExtensionOperator> FormatDeserialize(FormatDeserializer &deserializer) = 0;
|
39
40
|
|
40
41
|
virtual ~OperatorExtension() {
|
41
42
|
}
|
@@ -29,7 +29,7 @@ enum class TableFilterType : uint8_t {
|
|
29
29
|
//! TableFilter represents a filter pushed down into the table scan.
|
30
30
|
class TableFilter {
|
31
31
|
public:
|
32
|
-
TableFilter(TableFilterType filter_type_p) : filter_type(filter_type_p) {
|
32
|
+
explicit TableFilter(TableFilterType filter_type_p) : filter_type(filter_type_p) {
|
33
33
|
}
|
34
34
|
virtual ~TableFilter() {
|
35
35
|
}
|
@@ -48,6 +48,9 @@ public:
|
|
48
48
|
virtual void Serialize(FieldWriter &writer) const = 0;
|
49
49
|
static unique_ptr<TableFilter> Deserialize(Deserializer &source);
|
50
50
|
|
51
|
+
virtual void FormatSerialize(FormatSerializer &serializer) const;
|
52
|
+
static unique_ptr<TableFilter> FormatDeserialize(FormatDeserializer &deserializer);
|
53
|
+
|
51
54
|
public:
|
52
55
|
template <class TARGET>
|
53
56
|
TARGET &Cast() {
|
@@ -100,6 +103,9 @@ public:
|
|
100
103
|
|
101
104
|
void Serialize(Serializer &serializer) const;
|
102
105
|
static unique_ptr<TableFilterSet> Deserialize(Deserializer &source);
|
106
|
+
|
107
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
108
|
+
static TableFilterSet FormatDeserialize(FormatDeserializer &deserializer);
|
103
109
|
};
|
104
110
|
|
105
111
|
} // namespace duckdb
|
@@ -37,13 +37,10 @@ public:
|
|
37
37
|
void ReadData(data_ptr_t buffer, idx_t read_size) override;
|
38
38
|
|
39
39
|
ClientContext &GetContext() override;
|
40
|
-
optional_ptr<Catalog> GetCatalog() override;
|
41
|
-
void SetCatalog(Catalog &catalog_p);
|
42
40
|
void SetContext(ClientContext &context_p);
|
43
41
|
|
44
42
|
private:
|
45
43
|
void ReadNewBlock(block_id_t id);
|
46
44
|
optional_ptr<ClientContext> context;
|
47
|
-
optional_ptr<Catalog> catalog;
|
48
45
|
};
|
49
46
|
} // namespace duckdb
|
@@ -87,11 +87,11 @@ bool AttachedDatabase::IsReadOnly() const {
|
|
87
87
|
return type == AttachedDatabaseType::READ_ONLY_DATABASE;
|
88
88
|
}
|
89
89
|
|
90
|
-
string AttachedDatabase::ExtractDatabaseName(const string &dbpath) {
|
90
|
+
string AttachedDatabase::ExtractDatabaseName(const string &dbpath, FileSystem &fs) {
|
91
91
|
if (dbpath.empty() || dbpath == ":memory:") {
|
92
92
|
return "memory";
|
93
93
|
}
|
94
|
-
return
|
94
|
+
return fs.ExtractBaseName(dbpath);
|
95
95
|
}
|
96
96
|
|
97
97
|
void AttachedDatabase::Initialize() {
|
@@ -158,7 +158,7 @@ duckdb::unique_ptr<AttachedDatabase> DatabaseInstance::CreateAttachedDatabase(At
|
|
158
158
|
|
159
159
|
void DatabaseInstance::CreateMainDatabase() {
|
160
160
|
AttachInfo info;
|
161
|
-
info.name = AttachedDatabase::ExtractDatabaseName(config.options.database_path);
|
161
|
+
info.name = AttachedDatabase::ExtractDatabaseName(config.options.database_path, GetFileSystem());
|
162
162
|
info.path = config.options.database_path;
|
163
163
|
|
164
164
|
auto attached_database = CreateAttachedDatabase(info, config.options.database_type, config.options.access_mode);
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
namespace duckdb {
|
5
5
|
|
6
|
-
string GetDBAbsolutePath(const string &database_p) {
|
6
|
+
string GetDBAbsolutePath(const string &database_p, FileSystem &fs) {
|
7
7
|
auto database = FileSystem::ExpandPath(database_p, nullptr);
|
8
8
|
if (database.empty()) {
|
9
9
|
return ":memory:";
|
@@ -16,15 +16,17 @@ string GetDBAbsolutePath(const string &database_p) {
|
|
16
16
|
// this database path is handled by a replacement open and is not a file path
|
17
17
|
return database;
|
18
18
|
}
|
19
|
-
if (
|
20
|
-
return
|
19
|
+
if (fs.IsPathAbsolute(database)) {
|
20
|
+
return fs.NormalizeAbsolutePath(database);
|
21
21
|
}
|
22
|
-
return
|
22
|
+
return fs.NormalizeAbsolutePath(fs.JoinPath(FileSystem::GetWorkingDirectory(), database));
|
23
23
|
}
|
24
24
|
|
25
25
|
shared_ptr<DuckDB> DBInstanceCache::GetInstanceInternal(const string &database, const DBConfig &config) {
|
26
26
|
shared_ptr<DuckDB> db_instance;
|
27
|
-
|
27
|
+
|
28
|
+
auto local_fs = FileSystem::CreateLocal();
|
29
|
+
auto abs_database_path = GetDBAbsolutePath(database, *local_fs);
|
28
30
|
if (db_instances.find(abs_database_path) != db_instances.end()) {
|
29
31
|
db_instance = db_instances[abs_database_path].lock();
|
30
32
|
if (db_instance) {
|
@@ -48,7 +50,13 @@ shared_ptr<DuckDB> DBInstanceCache::GetInstance(const string &database, const DB
|
|
48
50
|
|
49
51
|
shared_ptr<DuckDB> DBInstanceCache::CreateInstanceInternal(const string &database, DBConfig &config,
|
50
52
|
bool cache_instance) {
|
51
|
-
|
53
|
+
string abs_database_path;
|
54
|
+
if (config.file_system) {
|
55
|
+
abs_database_path = GetDBAbsolutePath(database, *config.file_system);
|
56
|
+
} else {
|
57
|
+
auto tmp_fs = FileSystem::CreateLocal();
|
58
|
+
abs_database_path = GetDBAbsolutePath(database, *tmp_fs);
|
59
|
+
}
|
52
60
|
if (db_instances.find(abs_database_path) != db_instances.end()) {
|
53
61
|
throw duckdb::Exception(ExceptionType::CONNECTION,
|
54
62
|
"Instance with path: " + abs_database_path + " already exists.");
|
@@ -179,6 +179,19 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std
|
|
179
179
|
}
|
180
180
|
#endif
|
181
181
|
|
182
|
+
#ifdef DUCKDB_EXTENSIONS_TEST_WITH_LOADABLE
|
183
|
+
if (!initial_load && StringUtil::Contains(DUCKDB_EXTENSIONS_TEST_WITH_LOADABLE, extension)) {
|
184
|
+
Connection con(db);
|
185
|
+
auto result = con.Query((string) "LOAD '" + DUCKDB_EXTENSIONS_BUILD_PATH + "/" + extension + "/" + extension +
|
186
|
+
".duckdb_extension'");
|
187
|
+
if (result->HasError()) {
|
188
|
+
result->Print();
|
189
|
+
return ExtensionLoadResult::EXTENSION_UNKNOWN;
|
190
|
+
}
|
191
|
+
return ExtensionLoadResult::LOADED_EXTENSION;
|
192
|
+
}
|
193
|
+
#endif
|
194
|
+
|
182
195
|
// This is the main extension loading mechanism that loads the extension that are statically linked.
|
183
196
|
#if defined(GENERATED_EXTENSION_HEADERS) && GENERATED_EXTENSION_HEADERS
|
184
197
|
if (TryLoadLinkedExtension(db, extension)) {
|
@@ -56,7 +56,7 @@ string ExtensionHelper::ExtensionDirectory(DBConfig &config, FileSystem &fs) {
|
|
56
56
|
// expand ~ in extension directory
|
57
57
|
extension_directory = fs.ExpandPath(extension_directory);
|
58
58
|
if (!fs.DirectoryExists(extension_directory)) {
|
59
|
-
auto sep = fs.PathSeparator();
|
59
|
+
auto sep = fs.PathSeparator(extension_directory);
|
60
60
|
auto splits = StringUtil::Split(extension_directory, sep);
|
61
61
|
D_ASSERT(!splits.empty());
|
62
62
|
string extension_directory_prefix;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
#include "duckdb/optimizer/column_lifetime_optimizer.hpp"
|
2
2
|
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
|
3
3
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
4
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
5
4
|
#include "duckdb/planner/operator/logical_filter.hpp"
|
6
5
|
|
7
6
|
namespace duckdb {
|
@@ -38,7 +37,7 @@ void ColumnLifetimeAnalyzer::StandardVisitOperator(LogicalOperator &op) {
|
|
38
37
|
LogicalOperatorVisitor::VisitOperatorExpressions(op);
|
39
38
|
if (op.type == LogicalOperatorType::LOGICAL_DELIM_JOIN) {
|
40
39
|
// visit the duplicate eliminated columns on the LHS, if any
|
41
|
-
auto &delim_join = op.Cast<
|
40
|
+
auto &delim_join = op.Cast<LogicalComparisonJoin>();
|
42
41
|
for (auto &expr : delim_join.duplicate_eliminated_columns) {
|
43
42
|
VisitExpression(&expr);
|
44
43
|
}
|
@@ -9,7 +9,6 @@
|
|
9
9
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
10
10
|
#include "duckdb/planner/expression_iterator.hpp"
|
11
11
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
12
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
13
12
|
#include "duckdb/planner/operator/logical_projection.hpp"
|
14
13
|
|
15
14
|
namespace duckdb {
|
@@ -7,21 +7,21 @@
|
|
7
7
|
#include "duckdb/planner/expression/bound_conjunction_expression.hpp"
|
8
8
|
#include "duckdb/planner/expression/bound_operator_expression.hpp"
|
9
9
|
#include "duckdb/planner/operator/logical_aggregate.hpp"
|
10
|
+
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
10
11
|
#include "duckdb/planner/operator/logical_delim_get.hpp"
|
11
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
12
12
|
#include "duckdb/planner/operator/logical_filter.hpp"
|
13
13
|
|
14
14
|
namespace duckdb {
|
15
15
|
|
16
16
|
struct DelimCandidate {
|
17
17
|
public:
|
18
|
-
explicit DelimCandidate(unique_ptr<LogicalOperator> &op,
|
18
|
+
explicit DelimCandidate(unique_ptr<LogicalOperator> &op, LogicalComparisonJoin &delim_join)
|
19
19
|
: op(op), delim_join(delim_join), delim_get_count(0) {
|
20
20
|
}
|
21
21
|
|
22
22
|
public:
|
23
23
|
unique_ptr<LogicalOperator> &op;
|
24
|
-
|
24
|
+
LogicalComparisonJoin &delim_join;
|
25
25
|
vector<reference<unique_ptr<LogicalOperator>>> joins;
|
26
26
|
idx_t delim_get_count;
|
27
27
|
};
|
@@ -55,6 +55,7 @@ unique_ptr<LogicalOperator> Deliminator::Optimize(unique_ptr<LogicalOperator> op
|
|
55
55
|
|
56
56
|
// Change type if there are no more duplicate-eliminated columns
|
57
57
|
if (candidate.joins.size() == candidate.delim_get_count && all_removed) {
|
58
|
+
delim_join.type = LogicalOperatorType::LOGICAL_COMPARISON_JOIN;
|
58
59
|
delim_join.duplicate_eliminated_columns.clear();
|
59
60
|
if (all_equality_conditions) {
|
60
61
|
for (auto &cond : delim_join.conditions) {
|
@@ -63,7 +64,6 @@ unique_ptr<LogicalOperator> Deliminator::Optimize(unique_ptr<LogicalOperator> op
|
|
63
64
|
}
|
64
65
|
}
|
65
66
|
}
|
66
|
-
candidate.op = LogicalComparisonJoin::FromDelimJoin(delim_join);
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
@@ -80,7 +80,7 @@ void Deliminator::FindCandidates(unique_ptr<LogicalOperator> &op, vector<DelimCa
|
|
80
80
|
return;
|
81
81
|
}
|
82
82
|
|
83
|
-
candidates.emplace_back(op, op->Cast<
|
83
|
+
candidates.emplace_back(op, op->Cast<LogicalComparisonJoin>());
|
84
84
|
auto &candidate = candidates.back();
|
85
85
|
|
86
86
|
// DelimGets are in the RHS
|
@@ -125,7 +125,7 @@ static bool ChildJoinTypeCanBeDeliminated(JoinType &join_type) {
|
|
125
125
|
}
|
126
126
|
}
|
127
127
|
|
128
|
-
bool Deliminator::RemoveJoinWithDelimGet(
|
128
|
+
bool Deliminator::RemoveJoinWithDelimGet(LogicalComparisonJoin &delim_join, const idx_t delim_get_count,
|
129
129
|
unique_ptr<LogicalOperator> &join, bool &all_equality_conditions) {
|
130
130
|
auto &comparison_join = join->Cast<LogicalComparisonJoin>();
|
131
131
|
if (!ChildJoinTypeCanBeDeliminated(comparison_join.join_type)) {
|
@@ -218,7 +218,7 @@ bool FindAndReplaceBindings(vector<ColumnBinding> &traced_bindings, const vector
|
|
218
218
|
return true;
|
219
219
|
}
|
220
220
|
|
221
|
-
bool Deliminator::RemoveInequalityJoinWithDelimGet(
|
221
|
+
bool Deliminator::RemoveInequalityJoinWithDelimGet(LogicalComparisonJoin &delim_join, const idx_t delim_get_count,
|
222
222
|
unique_ptr<LogicalOperator> &join,
|
223
223
|
const vector<ReplacementBinding> &replacement_bindings) {
|
224
224
|
auto &comparison_join = join->Cast<LogicalComparisonJoin>();
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
#include "duckdb/common/pair.hpp"
|
4
4
|
#include "duckdb/planner/operator/logical_delim_get.hpp"
|
5
|
-
#include "duckdb/planner/operator/
|
5
|
+
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
6
6
|
#include "duckdb/planner/operator/logical_unnest.hpp"
|
7
7
|
#include "duckdb/planner/operator/logical_projection.hpp"
|
8
8
|
#include "duckdb/planner/operator/logical_window.hpp"
|
@@ -17,11 +17,9 @@ void UnnestRewriterPlanUpdater::VisitOperator(LogicalOperator &op) {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
void UnnestRewriterPlanUpdater::VisitExpression(unique_ptr<Expression> *expression) {
|
20
|
-
|
21
20
|
auto &expr = *expression;
|
22
21
|
|
23
22
|
if (expr->expression_class == ExpressionClass::BOUND_COLUMN_REF) {
|
24
|
-
|
25
23
|
auto &bound_column_ref = expr->Cast<BoundColumnRefExpression>();
|
26
24
|
for (idx_t i = 0; i < replace_bindings.size(); i++) {
|
27
25
|
if (bound_column_ref.binding == replace_bindings[i].old_binding) {
|
@@ -76,7 +74,7 @@ void UnnestRewriter::FindCandidates(unique_ptr<LogicalOperator> *op_ptr,
|
|
76
74
|
}
|
77
75
|
|
78
76
|
// found a delim join
|
79
|
-
auto &delim_join = op->children[0]->Cast<
|
77
|
+
auto &delim_join = op->children[0]->Cast<LogicalComparisonJoin>();
|
80
78
|
// only support INNER delim joins
|
81
79
|
if (delim_join.join_type != JoinType::INNER) {
|
82
80
|
return;
|
@@ -295,7 +293,7 @@ void UnnestRewriter::UpdateBoundUnnestBindings(UnnestRewriterPlanUpdater &update
|
|
295
293
|
void UnnestRewriter::GetDelimColumns(LogicalOperator &op) {
|
296
294
|
|
297
295
|
D_ASSERT(op.type == LogicalOperatorType::LOGICAL_DELIM_JOIN);
|
298
|
-
auto &delim_join = op.Cast<
|
296
|
+
auto &delim_join = op.Cast<LogicalComparisonJoin>();
|
299
297
|
for (idx_t i = 0; i < delim_join.duplicate_eliminated_columns.size(); i++) {
|
300
298
|
auto &expr = *delim_join.duplicate_eliminated_columns[i];
|
301
299
|
D_ASSERT(expr.type == ExpressionType::BOUND_COLUMN_REF);
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
#include "duckdb/parser/transformer.hpp"
|
6
6
|
#include "duckdb/common/types/decimal.hpp"
|
7
|
+
#include "duckdb/common/types/vector.hpp"
|
7
8
|
|
8
9
|
namespace duckdb {
|
9
10
|
|
@@ -21,7 +22,21 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_n
|
|
21
22
|
if (base_type == LogicalTypeId::LIST) {
|
22
23
|
throw ParserException("LIST is not valid as a stand-alone type");
|
23
24
|
} else if (base_type == LogicalTypeId::ENUM) {
|
24
|
-
|
25
|
+
if (!type_name.typmods || type_name.typmods->length == 0) {
|
26
|
+
throw ParserException("Enum needs a set of entries");
|
27
|
+
}
|
28
|
+
Vector enum_vector(LogicalType::VARCHAR, type_name.typmods->length);
|
29
|
+
auto string_data = FlatVector::GetData<string_t>(enum_vector);
|
30
|
+
idx_t pos = 0;
|
31
|
+
for (auto node = type_name.typmods->head; node; node = node->next) {
|
32
|
+
auto constant_value = PGPointerCast<duckdb_libpgquery::PGAConst>(node->data.ptr_value);
|
33
|
+
if (constant_value->type != duckdb_libpgquery::T_PGAConst ||
|
34
|
+
constant_value->val.type != duckdb_libpgquery::T_PGString) {
|
35
|
+
throw ParserException("Enum type requires a set of strings as type modifiers");
|
36
|
+
}
|
37
|
+
string_data[pos++] = StringVector::AddString(enum_vector, constant_value->val.val.str);
|
38
|
+
}
|
39
|
+
return LogicalType::ENUM(enum_vector, type_name.typmods->length);
|
25
40
|
} else if (base_type == LogicalTypeId::STRUCT) {
|
26
41
|
if (!type_name.typmods || type_name.typmods->length == 0) {
|
27
42
|
throw ParserException("Struct needs a name and entries");
|
@@ -56,7 +56,7 @@ unique_ptr<CreateStatement> Transformer::TransformCreateType(duckdb_libpgquery::
|
|
56
56
|
D_ASSERT(stmt.query == nullptr);
|
57
57
|
idx_t size = 0;
|
58
58
|
auto ordered_array = PGListToVector(stmt.vals, size);
|
59
|
-
info->type = LogicalType::ENUM(
|
59
|
+
info->type = LogicalType::ENUM(ordered_array, size);
|
60
60
|
}
|
61
61
|
} break;
|
62
62
|
|
@@ -138,10 +138,10 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
|
|
138
138
|
}
|
139
139
|
}
|
140
140
|
|
141
|
-
static unique_ptr<
|
141
|
+
static unique_ptr<LogicalComparisonJoin>
|
142
142
|
CreateDuplicateEliminatedJoin(const vector<CorrelatedColumnInfo> &correlated_columns, JoinType join_type,
|
143
143
|
unique_ptr<LogicalOperator> original_plan, bool perform_delim) {
|
144
|
-
auto delim_join = make_uniq<
|
144
|
+
auto delim_join = make_uniq<LogicalComparisonJoin>(join_type, LogicalOperatorType::LOGICAL_DELIM_JOIN);
|
145
145
|
if (!perform_delim) {
|
146
146
|
// if we are not performing a delim join, we push a row_number() OVER() window operator on the LHS
|
147
147
|
// and perform all duplicate elimination on that row number instead
|
@@ -165,7 +165,7 @@ CreateDuplicateEliminatedJoin(const vector<CorrelatedColumnInfo> &correlated_col
|
|
165
165
|
return delim_join;
|
166
166
|
}
|
167
167
|
|
168
|
-
static void CreateDelimJoinConditions(
|
168
|
+
static void CreateDelimJoinConditions(LogicalComparisonJoin &delim_join,
|
169
169
|
const vector<CorrelatedColumnInfo> &correlated_columns,
|
170
170
|
vector<ColumnBinding> bindings, idx_t base_offset, bool perform_delim) {
|
171
171
|
auto col_count = perform_delim ? correlated_columns.size() : 1;
|
@@ -24,7 +24,6 @@
|
|
24
24
|
#include "duckdb/planner/operator/logical_create_index.hpp"
|
25
25
|
#include "duckdb/planner/operator/logical_create_table.hpp"
|
26
26
|
#include "duckdb/planner/operator/logical_get.hpp"
|
27
|
-
#include "duckdb/planner/operator/logical_distinct.hpp"
|
28
27
|
#include "duckdb/planner/operator/logical_projection.hpp"
|
29
28
|
#include "duckdb/planner/parsed_data/bound_create_table_info.hpp"
|
30
29
|
#include "duckdb/planner/query_node/bound_select_node.hpp"
|
@@ -39,6 +38,7 @@
|
|
39
38
|
#include "duckdb/main/database_manager.hpp"
|
40
39
|
#include "duckdb/main/attached_database.hpp"
|
41
40
|
#include "duckdb/catalog/duck_catalog.hpp"
|
41
|
+
#include "duckdb/function/table/table_scan.hpp"
|
42
42
|
|
43
43
|
namespace duckdb {
|
44
44
|
|
@@ -260,23 +260,6 @@ void Binder::BindLogicalType(ClientContext &context, LogicalType &type, optional
|
|
260
260
|
} else {
|
261
261
|
type = Catalog::GetType(context, INVALID_CATALOG, schema, user_type_name);
|
262
262
|
}
|
263
|
-
} else if (type.id() == LogicalTypeId::ENUM) {
|
264
|
-
auto enum_type_name = EnumType::GetTypeName(type);
|
265
|
-
optional_ptr<TypeCatalogEntry> enum_type_catalog;
|
266
|
-
if (catalog) {
|
267
|
-
enum_type_catalog =
|
268
|
-
catalog->GetEntry<TypeCatalogEntry>(context, schema, enum_type_name, OnEntryNotFound::RETURN_NULL);
|
269
|
-
if (!enum_type_catalog) {
|
270
|
-
// look in the system catalog if the type was not found
|
271
|
-
enum_type_catalog = Catalog::GetEntry<TypeCatalogEntry>(context, SYSTEM_CATALOG, schema, enum_type_name,
|
272
|
-
OnEntryNotFound::RETURN_NULL);
|
273
|
-
}
|
274
|
-
} else {
|
275
|
-
enum_type_catalog = Catalog::GetEntry<TypeCatalogEntry>(context, INVALID_CATALOG, schema, enum_type_name,
|
276
|
-
OnEntryNotFound::RETURN_NULL);
|
277
|
-
}
|
278
|
-
|
279
|
-
EnumType::SetCatalog(type, enum_type_catalog.get());
|
280
263
|
}
|
281
264
|
}
|
282
265
|
|
@@ -483,10 +466,14 @@ unique_ptr<LogicalOperator> DuckCatalog::BindCreateIndex(Binder &binder, CreateS
|
|
483
466
|
create_index_info->scan_types.emplace_back(LogicalType::ROW_TYPE);
|
484
467
|
create_index_info->names = get.names;
|
485
468
|
create_index_info->column_ids = get.column_ids;
|
469
|
+
auto &bind_data = get.bind_data->Cast<TableScanBindData>();
|
470
|
+
bind_data.is_create_index = true;
|
471
|
+
get.column_ids.push_back(COLUMN_IDENTIFIER_ROW_ID);
|
486
472
|
|
487
473
|
// the logical CREATE INDEX also needs all fields to scan the referenced table
|
488
|
-
|
489
|
-
|
474
|
+
auto result = make_uniq<LogicalCreateIndex>(std::move(create_index_info), std::move(expressions), table);
|
475
|
+
result->children.push_back(std::move(plan));
|
476
|
+
return std::move(result);
|
490
477
|
}
|
491
478
|
|
492
479
|
BoundStatement Binder::Bind(CreateStatement &stmt) {
|
@@ -548,7 +535,6 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
|
|
548
535
|
if (plan->type != LogicalOperatorType::LOGICAL_GET) {
|
549
536
|
throw BinderException("Cannot create index on a view!");
|
550
537
|
}
|
551
|
-
|
552
538
|
result.plan = table.catalog.BindCreateIndex(*this, stmt, table, std::move(plan));
|
553
539
|
break;
|
554
540
|
}
|
@@ -653,8 +639,6 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
|
|
653
639
|
// We set b to be an alias for the underlying type of a
|
654
640
|
auto inner_type = Catalog::GetType(context, schema.catalog.GetName(), schema.name,
|
655
641
|
UserType::GetTypeName(create_type_info.type));
|
656
|
-
// clear to nullptr, we don't need this
|
657
|
-
EnumType::SetCatalog(inner_type, nullptr);
|
658
642
|
inner_type.SetAlias(create_type_info.name);
|
659
643
|
create_type_info.type = inner_type;
|
660
644
|
}
|
@@ -292,30 +292,6 @@ unique_ptr<BoundCreateTableInfo> Binder::BindCreateTableInfo(unique_ptr<CreateIn
|
|
292
292
|
ExpressionBinder::TestCollation(context, StringType::GetCollation(column.Type()));
|
293
293
|
}
|
294
294
|
BindLogicalType(context, column.TypeMutable(), &result->schema.catalog);
|
295
|
-
// We add a catalog dependency
|
296
|
-
auto type_dependency = EnumType::GetCatalog(column.Type());
|
297
|
-
|
298
|
-
if (type_dependency) {
|
299
|
-
// Only if the USER comes from a create type
|
300
|
-
if (schema.catalog.IsTemporaryCatalog() && column.Type().id() == LogicalTypeId::ENUM) {
|
301
|
-
// for enum types that are used in tables in the temp catalog, we need to
|
302
|
-
// make a copy of the enum type definition that is accessible there
|
303
|
-
auto enum_type = type_dependency->user_type;
|
304
|
-
auto &enum_entries = EnumType::GetValuesInsertOrder(enum_type);
|
305
|
-
auto enum_size = EnumType::GetSize(enum_type);
|
306
|
-
Vector copy_enum_entries_vec(LogicalType::VARCHAR, enum_size);
|
307
|
-
auto copy_enum_entries_ptr = FlatVector::GetData<string_t>(copy_enum_entries_vec);
|
308
|
-
auto enum_entries_ptr = FlatVector::GetData<string_t>(enum_entries);
|
309
|
-
for (idx_t enum_idx = 0; enum_idx < enum_size; enum_idx++) {
|
310
|
-
copy_enum_entries_ptr[enum_idx] =
|
311
|
-
StringVector::AddStringOrBlob(copy_enum_entries_vec, enum_entries_ptr[enum_idx]);
|
312
|
-
}
|
313
|
-
auto copy_type = LogicalType::ENUM(EnumType::GetTypeName(enum_type), copy_enum_entries_vec, enum_size);
|
314
|
-
column.SetType(copy_type);
|
315
|
-
} else {
|
316
|
-
result->dependencies.AddDependency(*type_dependency);
|
317
|
-
}
|
318
|
-
}
|
319
295
|
}
|
320
296
|
result->dependencies.VerifyDependencies(schema.catalog, result->Base().table);
|
321
297
|
properties.allow_stream_result = false;
|
@@ -7,7 +7,6 @@
|
|
7
7
|
#include "duckdb/planner/expression_iterator.hpp"
|
8
8
|
#include "duckdb/planner/binder.hpp"
|
9
9
|
#include "duckdb/planner/operator/logical_any_join.hpp"
|
10
|
-
#include "duckdb/planner/operator/logical_asof_join.hpp"
|
11
10
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
12
11
|
#include "duckdb/planner/operator/logical_cross_product.hpp"
|
13
12
|
#include "duckdb/planner/operator/logical_dependent_join.hpp"
|
@@ -193,12 +192,11 @@ unique_ptr<LogicalOperator> LogicalComparisonJoin::CreateJoin(ClientContext &con
|
|
193
192
|
} else {
|
194
193
|
// we successfully converted expressions into JoinConditions
|
195
194
|
// create a LogicalComparisonJoin
|
196
|
-
|
195
|
+
auto logical_type = LogicalOperatorType::LOGICAL_COMPARISON_JOIN;
|
197
196
|
if (reftype == JoinRefType::ASOF) {
|
198
|
-
|
199
|
-
} else {
|
200
|
-
comp_join = make_uniq<LogicalComparisonJoin>(type);
|
197
|
+
logical_type = LogicalOperatorType::LOGICAL_ASOF_JOIN;
|
201
198
|
}
|
199
|
+
auto comp_join = make_uniq<LogicalComparisonJoin>(type, logical_type);
|
202
200
|
comp_join->conditions = std::move(conditions);
|
203
201
|
comp_join->children.push_back(std::move(left_child));
|
204
202
|
comp_join->children.push_back(std::move(right_child));
|
@@ -104,4 +104,27 @@ unique_ptr<Expression> BoundAggregateExpression::Deserialize(ExpressionDeseriali
|
|
104
104
|
return std::move(x);
|
105
105
|
}
|
106
106
|
|
107
|
+
void BoundAggregateExpression::FormatSerialize(FormatSerializer &serializer) const {
|
108
|
+
Expression::FormatSerialize(serializer);
|
109
|
+
serializer.WriteProperty("return_type", return_type);
|
110
|
+
serializer.WriteProperty("children", children);
|
111
|
+
FunctionSerializer::FormatSerialize(serializer, function, bind_info.get());
|
112
|
+
serializer.WriteProperty("aggregate_type", aggr_type);
|
113
|
+
serializer.WriteOptionalProperty("filter", filter);
|
114
|
+
serializer.WriteOptionalProperty("order_bys", order_bys);
|
115
|
+
}
|
116
|
+
|
117
|
+
unique_ptr<Expression> BoundAggregateExpression::FormatDeserialize(FormatDeserializer &deserializer) {
|
118
|
+
auto return_type = deserializer.ReadProperty<LogicalType>("return_type");
|
119
|
+
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>("children");
|
120
|
+
auto entry = FunctionSerializer::FormatDeserialize<AggregateFunction, AggregateFunctionCatalogEntry>(
|
121
|
+
deserializer, CatalogType::AGGREGATE_FUNCTION_ENTRY, children);
|
122
|
+
auto aggregate_type = deserializer.ReadProperty<AggregateType>("aggregate_type");
|
123
|
+
auto filter = deserializer.ReadOptionalProperty<unique_ptr<Expression>>("filter");
|
124
|
+
auto result = make_uniq<BoundAggregateExpression>(std::move(entry.first), std::move(children), std::move(filter),
|
125
|
+
std::move(entry.second), aggregate_type);
|
126
|
+
deserializer.ReadOptionalProperty("order_bys", result->order_bys);
|
127
|
+
return std::move(result);
|
128
|
+
}
|
129
|
+
|
107
130
|
} // namespace duckdb
|
@@ -3,6 +3,8 @@
|
|
3
3
|
#include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp"
|
4
4
|
#include "duckdb/common/types/hash.hpp"
|
5
5
|
#include "duckdb/function/function_serialization.hpp"
|
6
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
7
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
6
8
|
|
7
9
|
namespace duckdb {
|
8
10
|
|
@@ -92,4 +94,24 @@ unique_ptr<Expression> BoundFunctionExpression::Deserialize(ExpressionDeserializ
|
|
92
94
|
return make_uniq<BoundFunctionExpression>(std::move(return_type), std::move(function), std::move(children),
|
93
95
|
std::move(bind_info), is_operator);
|
94
96
|
}
|
97
|
+
|
98
|
+
void BoundFunctionExpression::FormatSerialize(FormatSerializer &serializer) const {
|
99
|
+
Expression::FormatSerialize(serializer);
|
100
|
+
serializer.WriteProperty("return_type", return_type);
|
101
|
+
serializer.WriteProperty("children", children);
|
102
|
+
FunctionSerializer::FormatSerialize(serializer, function, bind_info.get());
|
103
|
+
serializer.WriteProperty("is_operator", is_operator);
|
104
|
+
}
|
105
|
+
|
106
|
+
unique_ptr<Expression> BoundFunctionExpression::FormatDeserialize(FormatDeserializer &deserializer) {
|
107
|
+
auto return_type = deserializer.ReadProperty<LogicalType>("return_type");
|
108
|
+
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>("children");
|
109
|
+
auto entry = FunctionSerializer::FormatDeserialize<ScalarFunction, ScalarFunctionCatalogEntry>(
|
110
|
+
deserializer, CatalogType::SCALAR_FUNCTION_ENTRY, children);
|
111
|
+
auto result = make_uniq<BoundFunctionExpression>(std::move(return_type), std::move(entry.first),
|
112
|
+
std::move(children), std::move(entry.second));
|
113
|
+
deserializer.ReadProperty("is_operator", result->is_operator);
|
114
|
+
return std::move(result);
|
115
|
+
}
|
116
|
+
|
95
117
|
} // namespace duckdb
|
@@ -162,4 +162,51 @@ unique_ptr<Expression> BoundWindowExpression::Deserialize(ExpressionDeserializat
|
|
162
162
|
return std::move(result);
|
163
163
|
}
|
164
164
|
|
165
|
+
void BoundWindowExpression::FormatSerialize(FormatSerializer &serializer) const {
|
166
|
+
Expression::FormatSerialize(serializer);
|
167
|
+
serializer.WriteProperty("return_type", return_type);
|
168
|
+
serializer.WriteProperty("children", children);
|
169
|
+
if (type == ExpressionType::WINDOW_AGGREGATE) {
|
170
|
+
D_ASSERT(aggregate);
|
171
|
+
FunctionSerializer::FormatSerialize(serializer, *aggregate, bind_info.get());
|
172
|
+
}
|
173
|
+
serializer.WriteProperty("partitions", partitions);
|
174
|
+
serializer.WriteProperty("orders", orders);
|
175
|
+
serializer.WriteOptionalProperty("filters", filter_expr);
|
176
|
+
serializer.WriteProperty("ignore_nulls", ignore_nulls);
|
177
|
+
serializer.WriteProperty("start", start);
|
178
|
+
serializer.WriteProperty("end", end);
|
179
|
+
serializer.WriteOptionalProperty("start_expr", start_expr);
|
180
|
+
serializer.WriteOptionalProperty("end_expr", end_expr);
|
181
|
+
serializer.WriteOptionalProperty("offset_expr", offset_expr);
|
182
|
+
serializer.WriteOptionalProperty("default_expr", default_expr);
|
183
|
+
}
|
184
|
+
|
185
|
+
unique_ptr<Expression> BoundWindowExpression::FormatDeserialize(FormatDeserializer &deserializer) {
|
186
|
+
auto expression_type = deserializer.Get<ExpressionType>();
|
187
|
+
auto return_type = deserializer.ReadProperty<LogicalType>("return_type");
|
188
|
+
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>("children");
|
189
|
+
unique_ptr<AggregateFunction> aggregate;
|
190
|
+
unique_ptr<FunctionData> bind_info;
|
191
|
+
if (expression_type == ExpressionType::WINDOW_AGGREGATE) {
|
192
|
+
auto entry = FunctionSerializer::FormatDeserialize<AggregateFunction, AggregateFunctionCatalogEntry>(
|
193
|
+
deserializer, CatalogType::AGGREGATE_FUNCTION_ENTRY, children);
|
194
|
+
aggregate = make_uniq<AggregateFunction>(std::move(entry.first));
|
195
|
+
bind_info = std::move(entry.second);
|
196
|
+
}
|
197
|
+
auto result =
|
198
|
+
make_uniq<BoundWindowExpression>(expression_type, return_type, std::move(aggregate), std::move(bind_info));
|
199
|
+
deserializer.ReadProperty("partitions", result->partitions);
|
200
|
+
deserializer.ReadProperty("orders", result->orders);
|
201
|
+
deserializer.ReadOptionalProperty("filters", result->filter_expr);
|
202
|
+
deserializer.ReadProperty("ignore_nulls", result->ignore_nulls);
|
203
|
+
deserializer.ReadProperty("start", result->start);
|
204
|
+
deserializer.ReadProperty("end", result->end);
|
205
|
+
deserializer.ReadOptionalProperty("start_expr", result->start_expr);
|
206
|
+
deserializer.ReadOptionalProperty("end_expr", result->end_expr);
|
207
|
+
deserializer.ReadOptionalProperty("offset_expr", result->offset_expr);
|
208
|
+
deserializer.ReadOptionalProperty("default_expr", result->default_expr);
|
209
|
+
return std::move(result);
|
210
|
+
}
|
211
|
+
|
165
212
|
} // namespace duckdb
|
@@ -131,7 +131,6 @@ void LogicalOperator::Verify(ClientContext &context) {
|
|
131
131
|
}
|
132
132
|
BufferedSerializer serializer;
|
133
133
|
// We are serializing a query plan
|
134
|
-
serializer.is_query_plan = true;
|
135
134
|
try {
|
136
135
|
expressions[expr_idx]->Serialize(serializer);
|
137
136
|
} catch (NotImplementedException &ex) {
|
@@ -266,12 +265,8 @@ unique_ptr<LogicalOperator> LogicalOperator::Deserialize(Deserializer &deseriali
|
|
266
265
|
break;
|
267
266
|
case LogicalOperatorType::LOGICAL_JOIN:
|
268
267
|
throw InternalException("LogicalJoin deserialize not supported");
|
269
|
-
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
270
|
-
result = LogicalDelimJoin::Deserialize(state, reader);
|
271
|
-
break;
|
272
268
|
case LogicalOperatorType::LOGICAL_ASOF_JOIN:
|
273
|
-
|
274
|
-
break;
|
269
|
+
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
275
270
|
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
|
276
271
|
result = LogicalComparisonJoin::Deserialize(state, reader);
|
277
272
|
break;
|