duckdb 0.7.2-dev3515.0 → 0.7.2-dev3666.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.
Files changed (133) hide show
  1. package/configure.py +2 -0
  2. package/package.json +1 -1
  3. package/src/database.cpp +1 -0
  4. package/src/duckdb/extension/json/buffered_json_reader.cpp +56 -17
  5. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +56 -31
  6. package/src/duckdb/extension/json/include/json_common.hpp +5 -4
  7. package/src/duckdb/extension/json/include/json_executors.hpp +13 -18
  8. package/src/duckdb/extension/json/include/json_functions.hpp +3 -0
  9. package/src/duckdb/extension/json/include/json_scan.hpp +106 -153
  10. package/src/duckdb/extension/json/include/json_transform.hpp +2 -2
  11. package/src/duckdb/extension/json/json_common.cpp +1 -1
  12. package/src/duckdb/extension/json/json_functions/copy_json.cpp +94 -38
  13. package/src/duckdb/extension/json/json_functions/json_contains.cpp +7 -8
  14. package/src/duckdb/extension/json/json_functions/json_create.cpp +7 -7
  15. package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +4 -4
  16. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +4 -4
  17. package/src/duckdb/extension/json/json_functions/json_structure.cpp +7 -5
  18. package/src/duckdb/extension/json/json_functions/json_transform.cpp +10 -8
  19. package/src/duckdb/extension/json/json_functions/json_valid.cpp +1 -1
  20. package/src/duckdb/extension/json/json_functions/read_json.cpp +167 -169
  21. package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +37 -16
  22. package/src/duckdb/extension/json/json_functions.cpp +11 -4
  23. package/src/duckdb/extension/json/json_scan.cpp +593 -374
  24. package/src/duckdb/extension/parquet/parquet-extension.cpp +5 -0
  25. package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +42 -0
  26. package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
  27. package/src/duckdb/src/catalog/catalog_set.cpp +1 -1
  28. package/src/duckdb/src/common/constants.cpp +1 -0
  29. package/src/duckdb/src/common/file_system.cpp +26 -6
  30. package/src/duckdb/src/common/local_file_system.cpp +0 -13
  31. package/src/duckdb/src/common/types/vector.cpp +3 -3
  32. package/src/duckdb/src/common/types/vector_buffer.cpp +11 -3
  33. package/src/duckdb/src/common/types/vector_cache.cpp +5 -5
  34. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +12 -6
  35. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +10 -0
  36. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -2
  37. package/src/duckdb/src/function/macro_function.cpp +43 -0
  38. package/src/duckdb/src/function/pragma/pragma_queries.cpp +5 -3
  39. package/src/duckdb/src/function/scalar/strftime_format.cpp +1 -0
  40. package/src/duckdb/src/function/scalar_macro_function.cpp +10 -0
  41. package/src/duckdb/src/function/table/copy_csv.cpp +68 -18
  42. package/src/duckdb/src/function/table/read_csv.cpp +30 -3
  43. package/src/duckdb/src/function/table/version/pragma_version.cpp +8 -2
  44. package/src/duckdb/src/function/table_macro_function.cpp +10 -0
  45. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/column_dependency_manager.hpp +1 -1
  46. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -1
  47. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +0 -6
  48. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +0 -6
  49. package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +1 -1
  50. package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +1 -1
  51. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  52. package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -3
  53. package/src/duckdb/src/include/duckdb/common/field_writer.hpp +3 -3
  54. package/src/duckdb/src/include/duckdb/common/file_system.hpp +5 -0
  55. package/src/duckdb/src/include/duckdb/common/http_state.hpp +2 -1
  56. package/src/duckdb/src/include/duckdb/common/hugeint.hpp +6 -6
  57. package/src/duckdb/src/include/duckdb/common/limits.hpp +46 -46
  58. package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +8 -8
  59. package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +6 -6
  60. package/src/duckdb/src/include/duckdb/common/operator/convert_to_string.hpp +1 -1
  61. package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +2 -4
  62. package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +1 -1
  63. package/src/duckdb/src/include/duckdb/common/operator/subtract.hpp +1 -1
  64. package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +1 -1
  65. package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +1 -1
  66. package/src/duckdb/src/include/duckdb/common/string_util.hpp +7 -7
  67. package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +10 -10
  68. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +12 -12
  69. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_iterators.hpp +2 -2
  70. package/src/duckdb/src/include/duckdb/common/types/value.hpp +1 -1
  71. package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +12 -2
  72. package/src/duckdb/src/include/duckdb/common/types.hpp +2 -2
  73. package/src/duckdb/src/include/duckdb/common/winapi.hpp +1 -1
  74. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -1
  75. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +9 -5
  76. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
  77. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +10 -14
  78. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +7 -1
  79. package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +3 -4
  80. package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +7 -2
  81. package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
  82. package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +5 -0
  83. package/src/duckdb/src/include/duckdb/function/udf_function.hpp +56 -50
  84. package/src/duckdb/src/include/duckdb/main/appender.hpp +2 -2
  85. package/src/duckdb/src/include/duckdb/main/client_context.hpp +2 -2
  86. package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -1
  87. package/src/duckdb/src/include/duckdb/main/connection.hpp +8 -9
  88. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
  89. package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -3
  90. package/src/duckdb/src/include/duckdb/main/relation.hpp +6 -7
  91. package/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp +1 -1
  92. package/src/duckdb/src/include/duckdb/parser/column_list.hpp +7 -7
  93. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +4 -7
  94. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +8 -12
  95. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +6 -20
  96. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +6 -18
  97. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +4 -8
  98. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +4 -38
  99. package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +5 -2
  100. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -10
  101. package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -2
  102. package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +1 -1
  103. package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +1 -1
  104. package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +2 -2
  105. package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +2 -2
  106. package/src/duckdb/src/parser/parsed_data/attach_info.cpp +42 -0
  107. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +0 -7
  108. package/src/duckdb/src/parser/parsed_data/create_info.cpp +19 -8
  109. package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +46 -0
  110. package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +56 -0
  111. package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +47 -0
  112. package/src/duckdb/src/parser/parsed_data/detach_info.cpp +34 -0
  113. package/src/duckdb/src/parser/parsed_data/drop_info.cpp +46 -0
  114. package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +24 -0
  115. package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +37 -0
  116. package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +27 -9
  117. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +9 -4
  118. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
  119. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -0
  120. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +1 -1
  121. package/src/duckdb/src/planner/logical_operator.cpp +1 -2
  122. package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -25
  123. package/src/duckdb/src/planner/operator/logical_insert.cpp +30 -0
  124. package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -5
  125. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +6 -16
  126. package/src/duckdb/src/planner/planner.cpp +4 -13
  127. package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -6
  128. package/src/duckdb/src/storage/single_file_block_manager.cpp +0 -4
  129. package/src/duckdb/src/storage/storage_info.cpp +1 -1
  130. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +5735 -5773
  131. package/src/duckdb/ub_src_catalog_catalog_entry.cpp +1 -1
  132. package/src/duckdb/ub_src_parser_parsed_data.cpp +16 -0
  133. package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +0 -104
@@ -15,8 +15,7 @@
15
15
  namespace duckdb {
16
16
 
17
17
  struct DropInfo : public ParseInfo {
18
- DropInfo() : catalog(INVALID_CATALOG), schema(INVALID_SCHEMA), cascade(false) {
19
- }
18
+ DropInfo();
20
19
 
21
20
  //! The catalog type to drop
22
21
  CatalogType type;
@@ -35,43 +34,10 @@ struct DropInfo : public ParseInfo {
35
34
  bool allow_drop_internal = false;
36
35
 
37
36
  public:
38
- unique_ptr<DropInfo> Copy() const {
39
- auto result = make_uniq<DropInfo>();
40
- result->type = type;
41
- result->catalog = catalog;
42
- result->schema = schema;
43
- result->name = name;
44
- result->if_not_found = if_not_found;
45
- result->cascade = cascade;
46
- result->allow_drop_internal = allow_drop_internal;
47
- return result;
48
- }
37
+ unique_ptr<DropInfo> Copy() const;
49
38
 
50
- void Serialize(Serializer &serializer) const {
51
- FieldWriter writer(serializer);
52
- writer.WriteField<CatalogType>(type);
53
- writer.WriteString(catalog);
54
- writer.WriteString(schema);
55
- writer.WriteString(name);
56
- writer.WriteField(if_not_found);
57
- writer.WriteField(cascade);
58
- writer.WriteField(allow_drop_internal);
59
- writer.Finalize();
60
- }
61
-
62
- static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer) {
63
- FieldReader reader(deserializer);
64
- auto drop_info = make_uniq<DropInfo>();
65
- drop_info->type = reader.ReadRequired<CatalogType>();
66
- drop_info->catalog = reader.ReadRequired<string>();
67
- drop_info->schema = reader.ReadRequired<string>();
68
- drop_info->name = reader.ReadRequired<string>();
69
- drop_info->if_not_found = reader.ReadRequired<OnEntryNotFound>();
70
- drop_info->cascade = reader.ReadRequired<bool>();
71
- drop_info->allow_drop_internal = reader.ReadRequired<bool>();
72
- reader.Finalize();
73
- return std::move(drop_info);
74
- }
39
+ void Serialize(Serializer &serializer) const;
40
+ static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer);
75
41
  };
76
42
 
77
43
  } // namespace duckdb
@@ -15,11 +15,14 @@ namespace duckdb {
15
15
  enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
16
16
 
17
17
  struct TransactionInfo : public ParseInfo {
18
- explicit TransactionInfo(TransactionType type) : type(type) {
19
- }
18
+ explicit TransactionInfo(TransactionType type);
20
19
 
21
20
  //! The type of transaction statement
22
21
  TransactionType type;
22
+
23
+ public:
24
+ void Serialize(Serializer &serializer) const;
25
+ static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer);
23
26
  };
24
27
 
25
28
  } // namespace duckdb
@@ -17,22 +17,16 @@
17
17
  namespace duckdb {
18
18
 
19
19
  struct VacuumOptions {
20
+ VacuumOptions() : vacuum(false), analyze(false) {
21
+ }
22
+
20
23
  bool vacuum;
21
24
  bool analyze;
22
25
  };
23
26
 
24
27
  struct VacuumInfo : public ParseInfo {
25
28
  public:
26
- explicit VacuumInfo(VacuumOptions options) : options(options), has_table(false) {};
27
-
28
- unique_ptr<VacuumInfo> Copy() {
29
- auto result = make_uniq<VacuumInfo>(options);
30
- result->has_table = has_table;
31
- if (has_table) {
32
- result->ref = ref->Copy();
33
- }
34
- return result;
35
- }
29
+ explicit VacuumInfo(VacuumOptions options);
36
30
 
37
31
  const VacuumOptions options;
38
32
 
@@ -42,6 +36,12 @@ public:
42
36
  optional_ptr<TableCatalogEntry> table;
43
37
  unordered_map<idx_t, idx_t> column_id_map;
44
38
  vector<string> columns;
39
+
40
+ public:
41
+ unique_ptr<VacuumInfo> Copy();
42
+
43
+ void Serialize(Serializer &serializer) const;
44
+ static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer);
45
45
  };
46
46
 
47
47
  } // namespace duckdb
@@ -17,7 +17,7 @@ namespace duckdb {
17
17
  //! The ParserExtensionInfo holds static information relevant to the parser extension
18
18
  //! It is made available in the parse_function, and will be kept alive as long as the database system is kept alive
19
19
  struct ParserExtensionInfo {
20
- DUCKDB_API virtual ~ParserExtensionInfo() {
20
+ virtual ~ParserExtensionInfo() {
21
21
  }
22
22
  };
23
23
 
@@ -29,7 +29,7 @@ enum class ParserExtensionResultType : uint8_t { PARSE_SUCCESSFUL, DISPLAY_ORIGI
29
29
  //! The ParserExtensionParseData holds the result of a successful parse step
30
30
  //! It will be passed along to the subsequent plan function
31
31
  struct ParserExtensionParseData {
32
- DUCKDB_API virtual ~ParserExtensionParseData() {
32
+ virtual ~ParserExtensionParseData() {
33
33
  }
34
34
 
35
35
  virtual unique_ptr<ParserExtensionParseData> Copy() const = 0;
@@ -41,7 +41,7 @@ protected:
41
41
  SQLStatement(const SQLStatement &other) = default;
42
42
 
43
43
  public:
44
- DUCKDB_API virtual string ToString() const {
44
+ virtual string ToString() const {
45
45
  throw InternalException("ToString not supported for this type of SQLStatement: '%s'",
46
46
  StatementTypeToString(type));
47
47
  }
@@ -26,7 +26,7 @@ public:
26
26
  static constexpr const StatementType TYPE = StatementType::SELECT_STATEMENT;
27
27
 
28
28
  public:
29
- DUCKDB_API SelectStatement() : SQLStatement(StatementType::SELECT_STATEMENT) {
29
+ SelectStatement() : SQLStatement(StatementType::SELECT_STATEMENT) {
30
30
  }
31
31
 
32
32
  //! The main query node
@@ -16,7 +16,7 @@ namespace duckdb {
16
16
 
17
17
  //! The OperatorExtensionInfo holds static information relevant to the operator extension
18
18
  struct OperatorExtensionInfo {
19
- DUCKDB_API virtual ~OperatorExtensionInfo() {
19
+ virtual ~OperatorExtensionInfo() {
20
20
  }
21
21
  };
22
22
 
@@ -37,7 +37,7 @@ public:
37
37
  virtual unique_ptr<LogicalExtensionOperator> Deserialize(LogicalDeserializationState &state,
38
38
  FieldReader &reader) = 0;
39
39
 
40
- DUCKDB_API virtual ~OperatorExtension() {
40
+ virtual ~OperatorExtension() {
41
41
  }
42
42
  };
43
43
 
@@ -20,7 +20,7 @@ class TransactionManager;
20
20
 
21
21
  //! The StorageExtensionInfo holds static information relevant to the storage extension
22
22
  struct StorageExtensionInfo {
23
- DUCKDB_API virtual ~StorageExtensionInfo() {
23
+ virtual ~StorageExtensionInfo() {
24
24
  }
25
25
  };
26
26
 
@@ -43,7 +43,7 @@ public:
43
43
  //! Additional info passed to the various storage functions
44
44
  shared_ptr<StorageExtensionInfo> storage_info;
45
45
 
46
- DUCKDB_API virtual ~StorageExtension() {
46
+ virtual ~StorageExtension() {
47
47
  }
48
48
  };
49
49
 
@@ -0,0 +1,42 @@
1
+ #include "duckdb/parser/parsed_data/attach_info.hpp"
2
+ #include "duckdb/common/field_writer.hpp"
3
+
4
+ namespace duckdb {
5
+
6
+ unique_ptr<AttachInfo> AttachInfo::Copy() const {
7
+ auto result = make_uniq<AttachInfo>();
8
+ result->name = name;
9
+ result->path = path;
10
+ result->options = options;
11
+ return result;
12
+ }
13
+
14
+ void AttachInfo::Serialize(Serializer &main_serializer) const {
15
+ FieldWriter writer(main_serializer);
16
+ writer.WriteString(name);
17
+ writer.WriteString(path);
18
+ writer.WriteField<uint32_t>(options.size());
19
+ auto &serializer = writer.GetSerializer();
20
+ for (auto &kv : options) {
21
+ serializer.WriteString(kv.first);
22
+ kv.second.Serialize(serializer);
23
+ }
24
+ writer.Finalize();
25
+ }
26
+
27
+ unique_ptr<ParseInfo> AttachInfo::Deserialize(Deserializer &deserializer) {
28
+ FieldReader reader(deserializer);
29
+ auto attach_info = make_uniq<AttachInfo>();
30
+ attach_info->name = reader.ReadRequired<string>();
31
+ attach_info->path = reader.ReadRequired<string>();
32
+ auto default_attach_count = reader.ReadRequired<uint32_t>();
33
+ auto &source = reader.GetSource();
34
+ for (idx_t i = 0; i < default_attach_count; i++) {
35
+ auto name = source.Read<string>();
36
+ attach_info->options[name] = Value::Deserialize(source);
37
+ }
38
+ reader.Finalize();
39
+ return std::move(attach_info);
40
+ }
41
+
42
+ } // namespace duckdb
@@ -5,7 +5,6 @@
5
5
  namespace duckdb {
6
6
 
7
7
  unique_ptr<CreateInfo> CreateIndexInfo::Copy() const {
8
-
9
8
  auto result = make_uniq<CreateIndexInfo>();
10
9
  CopyProperties(*result);
11
10
 
@@ -27,24 +26,20 @@ unique_ptr<CreateInfo> CreateIndexInfo::Copy() const {
27
26
  }
28
27
 
29
28
  void CreateIndexInfo::SerializeInternal(Serializer &serializer) const {
30
-
31
29
  FieldWriter writer(serializer);
32
30
  writer.WriteField(index_type);
33
31
  writer.WriteString(index_name);
34
32
  writer.WriteField(constraint_type);
35
33
 
36
- writer.WriteSerializableList<ParsedExpression>(expressions);
37
34
  writer.WriteSerializableList<ParsedExpression>(parsed_expressions);
38
35
 
39
36
  writer.WriteRegularSerializableList(scan_types);
40
37
  writer.WriteList<string>(names);
41
38
  writer.WriteList<column_t>(column_ids);
42
-
43
39
  writer.Finalize();
44
40
  }
45
41
 
46
42
  unique_ptr<CreateIndexInfo> CreateIndexInfo::Deserialize(Deserializer &deserializer) {
47
-
48
43
  auto result = make_uniq<CreateIndexInfo>();
49
44
  result->DeserializeBase(deserializer);
50
45
 
@@ -53,13 +48,11 @@ unique_ptr<CreateIndexInfo> CreateIndexInfo::Deserialize(Deserializer &deseriali
53
48
  result->index_name = reader.ReadRequired<string>();
54
49
  result->constraint_type = reader.ReadRequired<IndexConstraintType>();
55
50
 
56
- result->expressions = reader.ReadRequiredSerializableList<ParsedExpression>();
57
51
  result->parsed_expressions = reader.ReadRequiredSerializableList<ParsedExpression>();
58
52
 
59
53
  result->scan_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
60
54
  result->names = reader.ReadRequiredList<string>();
61
55
  result->column_ids = reader.ReadRequiredList<column_t>();
62
-
63
56
  reader.Finalize();
64
57
  return result;
65
58
  }
@@ -4,18 +4,13 @@
4
4
  #include "duckdb/parser/parsed_data/create_schema_info.hpp"
5
5
  #include "duckdb/parser/parsed_data/create_table_info.hpp"
6
6
  #include "duckdb/parser/parsed_data/create_view_info.hpp"
7
+ #include "duckdb/parser/parsed_data/create_sequence_info.hpp"
7
8
  #include "duckdb/parser/parsed_data/create_database_info.hpp"
9
+ #include "duckdb/parser/parsed_data/create_type_info.hpp"
8
10
  #include "duckdb/parser/parsed_data/alter_info.hpp"
11
+ #include "duckdb/parser/parsed_data/create_macro_info.hpp"
9
12
 
10
13
  namespace duckdb {
11
- void CreateInfo::DeserializeBase(Deserializer &deserializer) {
12
- this->catalog = deserializer.Read<string>();
13
- this->schema = deserializer.Read<string>();
14
- this->on_conflict = deserializer.Read<OnCreateConflict>();
15
- this->temporary = deserializer.Read<bool>();
16
- this->internal = deserializer.Read<bool>();
17
- this->sql = deserializer.Read<string>();
18
- }
19
14
 
20
15
  void CreateInfo::Serialize(Serializer &serializer) const {
21
16
  serializer.Write(type);
@@ -28,6 +23,15 @@ void CreateInfo::Serialize(Serializer &serializer) const {
28
23
  SerializeInternal(serializer);
29
24
  }
30
25
 
26
+ void CreateInfo::DeserializeBase(Deserializer &deserializer) {
27
+ this->catalog = deserializer.Read<string>();
28
+ this->schema = deserializer.Read<string>();
29
+ this->on_conflict = deserializer.Read<OnCreateConflict>();
30
+ this->temporary = deserializer.Read<bool>();
31
+ this->internal = deserializer.Read<bool>();
32
+ this->sql = deserializer.Read<string>();
33
+ }
34
+
31
35
  unique_ptr<CreateInfo> CreateInfo::Deserialize(Deserializer &deserializer) {
32
36
  auto type = deserializer.Read<CatalogType>();
33
37
  switch (type) {
@@ -41,6 +45,13 @@ unique_ptr<CreateInfo> CreateInfo::Deserialize(Deserializer &deserializer) {
41
45
  return CreateViewInfo::Deserialize(deserializer);
42
46
  case CatalogType::DATABASE_ENTRY:
43
47
  return CreateDatabaseInfo::Deserialize(deserializer);
48
+ case CatalogType::TYPE_ENTRY:
49
+ return CreateTypeInfo::Deserialize(deserializer);
50
+ case CatalogType::MACRO_ENTRY:
51
+ case CatalogType::TABLE_MACRO_ENTRY:
52
+ return CreateMacroInfo::Deserialize(deserializer);
53
+ case CatalogType::SEQUENCE_ENTRY:
54
+ return CreateSequenceInfo::Deserialize(deserializer);
44
55
  default:
45
56
  throw NotImplementedException("Cannot deserialize '%s'", CatalogTypeToString(type));
46
57
  }
@@ -0,0 +1,46 @@
1
+ #include "duckdb/parser/parsed_data/create_macro_info.hpp"
2
+ #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
3
+ #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
+ #include "duckdb/catalog/catalog.hpp"
5
+
6
+ namespace duckdb {
7
+
8
+ CreateMacroInfo::CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
9
+ }
10
+
11
+ CreateMacroInfo::CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
12
+ }
13
+
14
+ unique_ptr<CreateInfo> CreateMacroInfo::Copy() const {
15
+ auto result = make_uniq<CreateMacroInfo>();
16
+ result->function = function->Copy();
17
+ result->name = name;
18
+ CopyProperties(*result);
19
+ return std::move(result);
20
+ }
21
+
22
+ void CreateMacroInfo::SerializeInternal(Serializer &serializer) const {
23
+ FieldWriter writer(serializer);
24
+ writer.WriteString(name);
25
+ writer.WriteSerializable(*function);
26
+ writer.Finalize();
27
+ }
28
+
29
+ unique_ptr<CreateMacroInfo> CreateMacroInfo::Deserialize(Deserializer &deserializer) {
30
+ auto result = make_uniq<CreateMacroInfo>();
31
+ result->DeserializeBase(deserializer);
32
+
33
+ FieldReader reader(deserializer);
34
+ result->name = reader.ReadRequired<string>();
35
+ result->function = reader.ReadRequiredSerializable<MacroFunction>();
36
+ reader.Finalize();
37
+
38
+ if (result->function->type == MacroType::TABLE_MACRO) {
39
+ result->type = CatalogType::TABLE_MACRO_ENTRY;
40
+ } else {
41
+ result->type = CatalogType::MACRO_ENTRY;
42
+ }
43
+ return result;
44
+ }
45
+
46
+ } // namespace duckdb
@@ -0,0 +1,56 @@
1
+ #include "duckdb/parser/parsed_data/create_sequence_info.hpp"
2
+ #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
3
+ #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
+ #include "duckdb/catalog/catalog.hpp"
5
+
6
+ namespace duckdb {
7
+
8
+ CreateSequenceInfo::CreateSequenceInfo()
9
+ : CreateInfo(CatalogType::SEQUENCE_ENTRY, INVALID_SCHEMA), name(string()), usage_count(0), increment(1),
10
+ min_value(1), max_value(NumericLimits<int64_t>::Maximum()), start_value(1), cycle(false) {
11
+ }
12
+
13
+ unique_ptr<CreateInfo> CreateSequenceInfo::Copy() const {
14
+ auto result = make_uniq<CreateSequenceInfo>();
15
+ CopyProperties(*result);
16
+ result->name = name;
17
+ result->schema = schema;
18
+ result->usage_count = usage_count;
19
+ result->increment = increment;
20
+ result->min_value = min_value;
21
+ result->max_value = max_value;
22
+ result->start_value = start_value;
23
+ result->cycle = cycle;
24
+ return std::move(result);
25
+ }
26
+
27
+ void CreateSequenceInfo::SerializeInternal(Serializer &serializer) const {
28
+ FieldWriter writer(serializer);
29
+ writer.WriteString(name);
30
+ writer.WriteField(usage_count);
31
+ writer.WriteField(increment);
32
+ writer.WriteField(min_value);
33
+ writer.WriteField(max_value);
34
+ writer.WriteField(start_value);
35
+ writer.WriteField(cycle);
36
+ writer.Finalize();
37
+ }
38
+
39
+ unique_ptr<CreateSequenceInfo> CreateSequenceInfo::Deserialize(Deserializer &deserializer) {
40
+ auto result = make_uniq<CreateSequenceInfo>();
41
+ result->DeserializeBase(deserializer);
42
+
43
+ FieldReader reader(deserializer);
44
+ result->name = reader.ReadRequired<string>();
45
+ result->usage_count = reader.ReadRequired<uint64_t>();
46
+ result->increment = reader.ReadRequired<int64_t>();
47
+ result->min_value = reader.ReadRequired<int64_t>();
48
+ result->max_value = reader.ReadRequired<int64_t>();
49
+ result->start_value = reader.ReadRequired<int64_t>();
50
+ result->cycle = reader.ReadRequired<bool>();
51
+ reader.Finalize();
52
+
53
+ return result;
54
+ }
55
+
56
+ } // namespace duckdb
@@ -0,0 +1,47 @@
1
+ #include "duckdb/parser/parsed_data/create_type_info.hpp"
2
+ #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
3
+ #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
+ #include "duckdb/catalog/catalog.hpp"
5
+
6
+ namespace duckdb {
7
+
8
+ CreateTypeInfo::CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
9
+ }
10
+ CreateTypeInfo::CreateTypeInfo(string name_p, LogicalType type_p)
11
+ : CreateInfo(CatalogType::TYPE_ENTRY), name(std::move(name_p)), type(std::move(type_p)) {
12
+ }
13
+
14
+ unique_ptr<CreateInfo> CreateTypeInfo::Copy() const {
15
+ auto result = make_uniq<CreateTypeInfo>();
16
+ CopyProperties(*result);
17
+ result->name = name;
18
+ result->type = type;
19
+ if (query) {
20
+ result->query = query->Copy();
21
+ }
22
+ return std::move(result);
23
+ }
24
+
25
+ void CreateTypeInfo::SerializeInternal(Serializer &serializer) const {
26
+ FieldWriter writer(serializer);
27
+ writer.WriteString(name);
28
+ writer.WriteSerializable(type);
29
+ if (query) {
30
+ throw InternalException("Cannot serialize CreateTypeInfo with query");
31
+ }
32
+ writer.Finalize();
33
+ }
34
+
35
+ unique_ptr<CreateTypeInfo> CreateTypeInfo::Deserialize(Deserializer &deserializer) {
36
+ auto result = make_uniq<CreateTypeInfo>();
37
+ result->DeserializeBase(deserializer);
38
+
39
+ FieldReader reader(deserializer);
40
+ result->name = reader.ReadRequired<string>();
41
+ result->type = reader.ReadRequiredSerializable<LogicalType, LogicalType>();
42
+ reader.Finalize();
43
+
44
+ return result;
45
+ }
46
+
47
+ } // namespace duckdb
@@ -0,0 +1,34 @@
1
+ #include "duckdb/parser/parsed_data/detach_info.hpp"
2
+ #include "duckdb/common/field_writer.hpp"
3
+
4
+ namespace duckdb {
5
+
6
+ DetachInfo::DetachInfo() {
7
+ }
8
+
9
+ unique_ptr<DetachInfo> DetachInfo::Copy() const {
10
+ auto result = make_uniq<DetachInfo>();
11
+ result->name = name;
12
+ result->if_not_found = if_not_found;
13
+ return result;
14
+ }
15
+
16
+ void DetachInfo::Serialize(Serializer &serializer) const {
17
+ FieldWriter writer(serializer);
18
+ writer.WriteString(name);
19
+ writer.WriteField(if_not_found);
20
+ writer.Finalize();
21
+ }
22
+
23
+ unique_ptr<ParseInfo> DetachInfo::Deserialize(Deserializer &deserializer) {
24
+ auto result = make_uniq<DetachInfo>();
25
+
26
+ FieldReader reader(deserializer);
27
+ result->name = reader.ReadRequired<string>();
28
+ result->if_not_found = reader.ReadRequired<OnEntryNotFound>();
29
+ reader.Finalize();
30
+
31
+ return std::move(result);
32
+ }
33
+
34
+ } // namespace duckdb
@@ -0,0 +1,46 @@
1
+ #include "duckdb/parser/parsed_data/drop_info.hpp"
2
+
3
+ namespace duckdb {
4
+
5
+ DropInfo::DropInfo() : catalog(INVALID_CATALOG), schema(INVALID_SCHEMA), cascade(false) {
6
+ }
7
+
8
+ unique_ptr<DropInfo> DropInfo::Copy() const {
9
+ auto result = make_uniq<DropInfo>();
10
+ result->type = type;
11
+ result->catalog = catalog;
12
+ result->schema = schema;
13
+ result->name = name;
14
+ result->if_not_found = if_not_found;
15
+ result->cascade = cascade;
16
+ result->allow_drop_internal = allow_drop_internal;
17
+ return result;
18
+ }
19
+
20
+ void DropInfo::Serialize(Serializer &serializer) const {
21
+ FieldWriter writer(serializer);
22
+ writer.WriteField<CatalogType>(type);
23
+ writer.WriteString(catalog);
24
+ writer.WriteString(schema);
25
+ writer.WriteString(name);
26
+ writer.WriteField(if_not_found);
27
+ writer.WriteField(cascade);
28
+ writer.WriteField(allow_drop_internal);
29
+ writer.Finalize();
30
+ }
31
+
32
+ unique_ptr<ParseInfo> DropInfo::Deserialize(Deserializer &deserializer) {
33
+ FieldReader reader(deserializer);
34
+ auto drop_info = make_uniq<DropInfo>();
35
+ drop_info->type = reader.ReadRequired<CatalogType>();
36
+ drop_info->catalog = reader.ReadRequired<string>();
37
+ drop_info->schema = reader.ReadRequired<string>();
38
+ drop_info->name = reader.ReadRequired<string>();
39
+ drop_info->if_not_found = reader.ReadRequired<OnEntryNotFound>();
40
+ drop_info->cascade = reader.ReadRequired<bool>();
41
+ drop_info->allow_drop_internal = reader.ReadRequired<bool>();
42
+ reader.Finalize();
43
+ return std::move(drop_info);
44
+ }
45
+
46
+ } // namespace duckdb
@@ -0,0 +1,24 @@
1
+ #include "duckdb/parser/parsed_data/transaction_info.hpp"
2
+ #include "duckdb/common/field_writer.hpp"
3
+
4
+ namespace duckdb {
5
+
6
+ TransactionInfo::TransactionInfo(TransactionType type) : type(type) {
7
+ }
8
+
9
+ void TransactionInfo::Serialize(Serializer &serializer) const {
10
+ FieldWriter writer(serializer);
11
+ writer.WriteField(type);
12
+ writer.Finalize();
13
+ }
14
+
15
+ unique_ptr<ParseInfo> TransactionInfo::Deserialize(Deserializer &deserializer) {
16
+ FieldReader reader(deserializer);
17
+ auto transaction_type = reader.ReadRequired<TransactionType>();
18
+ reader.Finalize();
19
+
20
+ auto transaction_info = make_uniq<TransactionInfo>(transaction_type);
21
+ return std::move(transaction_info);
22
+ }
23
+
24
+ } // namespace duckdb
@@ -0,0 +1,37 @@
1
+ #include "duckdb/parser/parsed_data/vacuum_info.hpp"
2
+ #include "duckdb/common/field_writer.hpp"
3
+
4
+ namespace duckdb {
5
+
6
+ VacuumInfo::VacuumInfo(VacuumOptions options) : options(options), has_table(false) {
7
+ }
8
+
9
+ unique_ptr<VacuumInfo> VacuumInfo::Copy() {
10
+ auto result = make_uniq<VacuumInfo>(options);
11
+ result->has_table = has_table;
12
+ if (has_table) {
13
+ result->ref = ref->Copy();
14
+ }
15
+ return result;
16
+ }
17
+
18
+ void VacuumInfo::Serialize(Serializer &serializer) const {
19
+ FieldWriter writer(serializer);
20
+ writer.WriteField(options.analyze);
21
+ writer.WriteField(options.vacuum);
22
+ writer.Finalize();
23
+ }
24
+
25
+ unique_ptr<ParseInfo> VacuumInfo::Deserialize(Deserializer &deserializer) {
26
+
27
+ VacuumOptions options;
28
+ FieldReader reader(deserializer);
29
+ options.analyze = reader.ReadRequired<bool>();
30
+ options.vacuum = reader.ReadRequired<bool>();
31
+ reader.Finalize();
32
+
33
+ auto vacuum_info = make_uniq<VacuumInfo>(options);
34
+ return std::move(vacuum_info);
35
+ }
36
+
37
+ } // namespace duckdb