duckdb 0.3.2-dev1175.0 → 0.3.2-dev1203.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/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "c49927a99"
15
- #define DUCKDB_VERSION "v0.3.2-dev1175"
14
+ #define DUCKDB_SOURCE_ID "c5011ea99"
15
+ #define DUCKDB_VERSION "v0.3.2-dev1203"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -1550,6 +1550,7 @@ public:
1550
1550
  } // namespace duckdb
1551
1551
 
1552
1552
 
1553
+ #include <type_traits>
1553
1554
 
1554
1555
  namespace duckdb {
1555
1556
 
@@ -1563,19 +1564,18 @@ public:
1563
1564
 
1564
1565
  template <class T>
1565
1566
  void Write(T element) {
1567
+ static_assert(std::is_trivially_destructible<T>(), "Write element must be trivially destructible");
1568
+
1566
1569
  WriteData((const_data_ptr_t)&element, sizeof(T));
1567
1570
  }
1568
1571
 
1569
- //! Write data from a string buffer directly (wihtout length prefix)
1572
+ //! Write data from a string buffer directly (without length prefix)
1570
1573
  void WriteBufferData(const string &str) {
1571
1574
  WriteData((const_data_ptr_t)str.c_str(), str.size());
1572
1575
  }
1573
1576
  //! Write a string with a length prefix
1574
1577
  void WriteString(const string &val) {
1575
- Write<uint32_t>((uint32_t)val.size());
1576
- if (!val.empty()) {
1577
- WriteData((const_data_ptr_t)val.c_str(), val.size());
1578
- }
1578
+ WriteStringLen((const_data_ptr_t)val.c_str(), val.size());
1579
1579
  }
1580
1580
  void WriteStringLen(const_data_ptr_t val, idx_t len) {
1581
1581
  Write<uint32_t>((uint32_t)len);
@@ -1585,7 +1585,7 @@ public:
1585
1585
  }
1586
1586
 
1587
1587
  template <class T>
1588
- void WriteList(vector<unique_ptr<T>> &list) {
1588
+ void WriteList(const vector<unique_ptr<T>> &list) {
1589
1589
  Write<uint32_t>((uint32_t)list.size());
1590
1590
  for (auto &child : list) {
1591
1591
  child->Serialize(*this);
@@ -2777,7 +2777,7 @@ public:
2777
2777
  DUCKDB_API bool TryCastAs(const LogicalType &target_type, bool strict = false);
2778
2778
 
2779
2779
  //! Serializes a Value to a stand-alone binary blob
2780
- DUCKDB_API void Serialize(Serializer &serializer);
2780
+ DUCKDB_API void Serialize(Serializer &serializer) const;
2781
2781
  //! Deserializes a Value from a blob
2782
2782
  DUCKDB_API static Value Deserialize(Deserializer &source);
2783
2783
 
@@ -5818,6 +5818,8 @@ public:
5818
5818
  namespace duckdb {
5819
5819
  class Serializer;
5820
5820
  class Deserializer;
5821
+ class FieldWriter;
5822
+ class FieldReader;
5821
5823
 
5822
5824
  //! The ParsedExpression class is a base class that can represent any expression
5823
5825
  //! part of a SQL statement.
@@ -5851,7 +5853,10 @@ public:
5851
5853
  virtual unique_ptr<ParsedExpression> Copy() const = 0;
5852
5854
 
5853
5855
  //! Serializes an Expression to a stand-alone binary blob
5854
- virtual void Serialize(Serializer &serializer);
5856
+ void Serialize(Serializer &serializer) const;
5857
+ //! Serializes an Expression to a stand-alone binary blob
5858
+ virtual void Serialize(FieldWriter &writer) const = 0;
5859
+
5855
5860
  //! Deserializes a blob back into an Expression [CAN THROW:
5856
5861
  //! SerializationException]
5857
5862
  static unique_ptr<ParsedExpression> Deserialize(Deserializer &source);
@@ -6731,6 +6736,8 @@ struct SelectionVector;
6731
6736
 
6732
6737
  class Serializer;
6733
6738
  class Deserializer;
6739
+ class FieldWriter;
6740
+ class FieldReader;
6734
6741
  class Vector;
6735
6742
  class ValidityStatistics;
6736
6743
 
@@ -6745,24 +6752,27 @@ public:
6745
6752
  unique_ptr<BaseStatistics> validity_stats;
6746
6753
 
6747
6754
  public:
6748
- bool CanHaveNull();
6749
- bool CanHaveNoNull();
6755
+ bool CanHaveNull() const;
6756
+ bool CanHaveNoNull() const;
6750
6757
 
6751
- virtual bool IsConstant() {
6758
+ virtual bool IsConstant() const {
6752
6759
  return false;
6753
6760
  }
6754
6761
 
6755
6762
  static unique_ptr<BaseStatistics> CreateEmpty(LogicalType type);
6756
6763
 
6757
6764
  virtual void Merge(const BaseStatistics &other);
6758
- virtual unique_ptr<BaseStatistics> Copy();
6759
- virtual void Serialize(Serializer &serializer);
6765
+
6766
+ virtual unique_ptr<BaseStatistics> Copy() const;
6767
+ void Serialize(Serializer &serializer) const;
6768
+ virtual void Serialize(FieldWriter &writer) const;
6760
6769
  static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
6770
+
6761
6771
  //! Verify that a vector does not violate the statistics
6762
- virtual void Verify(Vector &vector, const SelectionVector &sel, idx_t count);
6763
- void Verify(Vector &vector, idx_t count);
6772
+ virtual void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const;
6773
+ void Verify(Vector &vector, idx_t count) const;
6764
6774
 
6765
- virtual string ToString();
6775
+ virtual string ToString() const;
6766
6776
  };
6767
6777
 
6768
6778
  } // namespace duckdb
@@ -7387,6 +7397,8 @@ enum class OrderByNullType : uint8_t { INVALID = 0, ORDER_DEFAULT = 1, NULLS_FIR
7387
7397
 
7388
7398
 
7389
7399
  namespace duckdb {
7400
+ class FieldWriter;
7401
+ class FieldReader;
7390
7402
 
7391
7403
  enum ResultModifierType : uint8_t {
7392
7404
  LIMIT_MODIFIER = 1,
@@ -7410,9 +7422,11 @@ public:
7410
7422
  virtual bool Equals(const ResultModifier *other) const;
7411
7423
 
7412
7424
  //! Create a copy of this ResultModifier
7413
- virtual unique_ptr<ResultModifier> Copy() = 0;
7425
+ virtual unique_ptr<ResultModifier> Copy() const = 0;
7414
7426
  //! Serializes a ResultModifier to a stand-alone binary blob
7415
- virtual void Serialize(Serializer &serializer);
7427
+ void Serialize(Serializer &serializer) const;
7428
+ //! Serializes a ResultModifier to a stand-alone binary blob
7429
+ virtual void Serialize(FieldWriter &writer) const = 0;
7416
7430
  //! Deserializes a blob back into a ResultModifier
7417
7431
  static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
7418
7432
  };
@@ -7431,7 +7445,7 @@ struct OrderByNode {
7431
7445
  unique_ptr<ParsedExpression> expression;
7432
7446
 
7433
7447
  public:
7434
- void Serialize(Serializer &serializer);
7448
+ void Serialize(Serializer &serializer) const;
7435
7449
  string ToString() const;
7436
7450
  static OrderByNode Deserialize(Deserializer &source);
7437
7451
  };
@@ -7448,9 +7462,9 @@ public:
7448
7462
 
7449
7463
  public:
7450
7464
  bool Equals(const ResultModifier *other) const override;
7451
- unique_ptr<ResultModifier> Copy() override;
7452
- void Serialize(Serializer &serializer) override;
7453
- static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
7465
+ unique_ptr<ResultModifier> Copy() const override;
7466
+ void Serialize(FieldWriter &writer) const override;
7467
+ static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
7454
7468
  };
7455
7469
 
7456
7470
  class OrderModifier : public ResultModifier {
@@ -7463,9 +7477,9 @@ public:
7463
7477
 
7464
7478
  public:
7465
7479
  bool Equals(const ResultModifier *other) const override;
7466
- unique_ptr<ResultModifier> Copy() override;
7467
- void Serialize(Serializer &serializer) override;
7468
- static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
7480
+ unique_ptr<ResultModifier> Copy() const override;
7481
+ void Serialize(FieldWriter &writer) const override;
7482
+ static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
7469
7483
  };
7470
7484
 
7471
7485
  class DistinctModifier : public ResultModifier {
@@ -7478,9 +7492,9 @@ public:
7478
7492
 
7479
7493
  public:
7480
7494
  bool Equals(const ResultModifier *other) const override;
7481
- unique_ptr<ResultModifier> Copy() override;
7482
- void Serialize(Serializer &serializer) override;
7483
- static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
7495
+ unique_ptr<ResultModifier> Copy() const override;
7496
+ void Serialize(FieldWriter &writer) const override;
7497
+ static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
7484
7498
  };
7485
7499
 
7486
7500
  class LimitPercentModifier : public ResultModifier {
@@ -7495,9 +7509,9 @@ public:
7495
7509
 
7496
7510
  public:
7497
7511
  bool Equals(const ResultModifier *other) const override;
7498
- unique_ptr<ResultModifier> Copy() override;
7499
- void Serialize(Serializer &serializer) override;
7500
- static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
7512
+ unique_ptr<ResultModifier> Copy() const override;
7513
+ void Serialize(FieldWriter &writer) const override;
7514
+ static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
7501
7515
  };
7502
7516
 
7503
7517
  } // namespace duckdb
@@ -13536,6 +13550,8 @@ namespace duckdb {
13536
13550
 
13537
13551
  class Serializer;
13538
13552
  class Deserializer;
13553
+ class FieldWriter;
13554
+ class FieldReader;
13539
13555
 
13540
13556
  //===--------------------------------------------------------------------===//
13541
13557
  // Constraint Types
@@ -13558,13 +13574,14 @@ public:
13558
13574
 
13559
13575
  public:
13560
13576
  DUCKDB_API virtual string ToString() const = 0;
13561
- DUCKDB_API void Print();
13577
+ DUCKDB_API void Print() const;
13562
13578
 
13563
- DUCKDB_API virtual unique_ptr<Constraint> Copy() = 0;
13579
+ DUCKDB_API virtual unique_ptr<Constraint> Copy() const = 0;
13564
13580
  //! Serializes a Constraint to a stand-alone binary blob
13565
- DUCKDB_API virtual void Serialize(Serializer &serializer);
13566
- //! Deserializes a blob back into a Constraint, returns NULL if
13567
- //! deserialization is not possible
13581
+ DUCKDB_API void Serialize(Serializer &serializer) const;
13582
+ //! Serializes a Constraint to a stand-alone binary blob
13583
+ DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
13584
+ //! Deserializes a blob back into a Constraint
13568
13585
  DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
13569
13586
  };
13570
13587
  } // namespace duckdb
@@ -13835,10 +13852,8 @@ enum class AlterType : uint8_t {
13835
13852
  };
13836
13853
 
13837
13854
  struct AlterInfo : public ParseInfo {
13838
- AlterInfo(AlterType type, string schema, string name) : type(type), schema(move(schema)), name(move(name)) {
13839
- }
13840
- ~AlterInfo() override {
13841
- }
13855
+ AlterInfo(AlterType type, string schema, string name);
13856
+ ~AlterInfo() override;
13842
13857
 
13843
13858
  AlterType type;
13844
13859
  //! Schema name to alter
@@ -13847,9 +13862,10 @@ struct AlterInfo : public ParseInfo {
13847
13862
  string name;
13848
13863
 
13849
13864
  public:
13850
- virtual CatalogType GetCatalogType() = 0;
13865
+ virtual CatalogType GetCatalogType() const = 0;
13851
13866
  virtual unique_ptr<AlterInfo> Copy() const = 0;
13852
- virtual void Serialize(Serializer &serializer);
13867
+ void Serialize(Serializer &serializer) const;
13868
+ virtual void Serialize(FieldWriter &writer) const = 0;
13853
13869
  static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
13854
13870
  };
13855
13871
 
@@ -13858,10 +13874,7 @@ public:
13858
13874
  //===--------------------------------------------------------------------===//
13859
13875
  struct ChangeOwnershipInfo : public AlterInfo {
13860
13876
  ChangeOwnershipInfo(CatalogType entry_catalog_type, string entry_schema, string entry_name, string owner_schema,
13861
- string owner_name)
13862
- : AlterInfo(AlterType::CHANGE_OWNERSHIP, entry_schema, entry_name), entry_catalog_type(entry_catalog_type),
13863
- owner_schema(owner_schema), owner_name(owner_name) {
13864
- }
13877
+ string owner_name);
13865
13878
 
13866
13879
  // Catalog type refers to the entry type, since this struct is usually built from an
13867
13880
  // ALTER <TYPE> <schema>.<name> OWNED BY <owner_schema>.<owner_name> statement
@@ -13872,8 +13885,9 @@ struct ChangeOwnershipInfo : public AlterInfo {
13872
13885
  string owner_name;
13873
13886
 
13874
13887
  public:
13875
- CatalogType GetCatalogType() override;
13888
+ CatalogType GetCatalogType() const override;
13876
13889
  unique_ptr<AlterInfo> Copy() const override;
13890
+ void Serialize(FieldWriter &writer) const override;
13877
13891
  };
13878
13892
 
13879
13893
  //===--------------------------------------------------------------------===//
@@ -13890,32 +13904,24 @@ enum class AlterTableType : uint8_t {
13890
13904
  };
13891
13905
 
13892
13906
  struct AlterTableInfo : public AlterInfo {
13893
- AlterTableInfo(AlterTableType type, string schema, string table)
13894
- : AlterInfo(AlterType::ALTER_TABLE, schema, table), alter_table_type(type) {
13895
- }
13896
- ~AlterTableInfo() override {
13897
- }
13907
+ AlterTableInfo(AlterTableType type, string schema, string table);
13908
+ ~AlterTableInfo() override;
13898
13909
 
13899
13910
  AlterTableType alter_table_type;
13900
13911
 
13901
13912
  public:
13902
- CatalogType GetCatalogType() override {
13903
- return CatalogType::TABLE_ENTRY;
13904
- }
13905
- void Serialize(Serializer &serializer) override;
13906
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
13913
+ CatalogType GetCatalogType() const override;
13914
+ void Serialize(FieldWriter &writer) const override;
13915
+ virtual void SerializeAlterTable(FieldWriter &writer) const = 0;
13916
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
13907
13917
  };
13908
13918
 
13909
13919
  //===--------------------------------------------------------------------===//
13910
13920
  // RenameColumnInfo
13911
13921
  //===--------------------------------------------------------------------===//
13912
13922
  struct RenameColumnInfo : public AlterTableInfo {
13913
- RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p)
13914
- : AlterTableInfo(AlterTableType::RENAME_COLUMN, move(schema), move(table)), old_name(move(old_name_p)),
13915
- new_name(move(new_name_p)) {
13916
- }
13917
- ~RenameColumnInfo() override {
13918
- }
13923
+ RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p);
13924
+ ~RenameColumnInfo() override;
13919
13925
 
13920
13926
  //! Column old name
13921
13927
  string old_name;
@@ -13924,58 +13930,48 @@ struct RenameColumnInfo : public AlterTableInfo {
13924
13930
 
13925
13931
  public:
13926
13932
  unique_ptr<AlterInfo> Copy() const override;
13927
- void Serialize(Serializer &serializer) override;
13928
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
13933
+ void SerializeAlterTable(FieldWriter &writer) const override;
13934
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
13929
13935
  };
13930
13936
 
13931
13937
  //===--------------------------------------------------------------------===//
13932
13938
  // RenameTableInfo
13933
13939
  //===--------------------------------------------------------------------===//
13934
13940
  struct RenameTableInfo : public AlterTableInfo {
13935
- RenameTableInfo(string schema, string table, string new_name)
13936
- : AlterTableInfo(AlterTableType::RENAME_TABLE, schema, table), new_table_name(new_name) {
13937
- }
13938
- ~RenameTableInfo() override {
13939
- }
13941
+ RenameTableInfo(string schema, string table, string new_name);
13942
+ ~RenameTableInfo() override;
13940
13943
 
13941
13944
  //! Relation new name
13942
13945
  string new_table_name;
13943
13946
 
13944
13947
  public:
13945
13948
  unique_ptr<AlterInfo> Copy() const override;
13946
- void Serialize(Serializer &serializer) override;
13947
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
13949
+ void SerializeAlterTable(FieldWriter &writer) const override;
13950
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
13948
13951
  };
13949
13952
 
13950
13953
  //===--------------------------------------------------------------------===//
13951
13954
  // AddColumnInfo
13952
13955
  //===--------------------------------------------------------------------===//
13953
13956
  struct AddColumnInfo : public AlterTableInfo {
13954
- AddColumnInfo(string schema, string table, ColumnDefinition new_column)
13955
- : AlterTableInfo(AlterTableType::ADD_COLUMN, schema, table), new_column(move(new_column)) {
13956
- }
13957
- ~AddColumnInfo() override {
13958
- }
13957
+ AddColumnInfo(string schema, string table, ColumnDefinition new_column);
13958
+ ~AddColumnInfo() override;
13959
13959
 
13960
13960
  //! New column
13961
13961
  ColumnDefinition new_column;
13962
13962
 
13963
13963
  public:
13964
13964
  unique_ptr<AlterInfo> Copy() const override;
13965
- void Serialize(Serializer &serializer) override;
13966
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
13965
+ void SerializeAlterTable(FieldWriter &writer) const override;
13966
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
13967
13967
  };
13968
13968
 
13969
13969
  //===--------------------------------------------------------------------===//
13970
13970
  // RemoveColumnInfo
13971
13971
  //===--------------------------------------------------------------------===//
13972
13972
  struct RemoveColumnInfo : public AlterTableInfo {
13973
- RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists)
13974
- : AlterTableInfo(AlterTableType::REMOVE_COLUMN, schema, table), removed_column(move(removed_column)),
13975
- if_exists(if_exists) {
13976
- }
13977
- ~RemoveColumnInfo() override {
13978
- }
13973
+ RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists);
13974
+ ~RemoveColumnInfo() override;
13979
13975
 
13980
13976
  //! The column to remove
13981
13977
  string removed_column;
@@ -13984,8 +13980,8 @@ struct RemoveColumnInfo : public AlterTableInfo {
13984
13980
 
13985
13981
  public:
13986
13982
  unique_ptr<AlterInfo> Copy() const override;
13987
- void Serialize(Serializer &serializer) override;
13988
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
13983
+ void SerializeAlterTable(FieldWriter &writer) const override;
13984
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
13989
13985
  };
13990
13986
 
13991
13987
  //===--------------------------------------------------------------------===//
@@ -13993,12 +13989,8 @@ public:
13993
13989
  //===--------------------------------------------------------------------===//
13994
13990
  struct ChangeColumnTypeInfo : public AlterTableInfo {
13995
13991
  ChangeColumnTypeInfo(string schema, string table, string column_name, LogicalType target_type,
13996
- unique_ptr<ParsedExpression> expression)
13997
- : AlterTableInfo(AlterTableType::ALTER_COLUMN_TYPE, schema, table), column_name(move(column_name)),
13998
- target_type(move(target_type)), expression(move(expression)) {
13999
- }
14000
- ~ChangeColumnTypeInfo() override {
14001
- }
13992
+ unique_ptr<ParsedExpression> expression);
13993
+ ~ChangeColumnTypeInfo() override;
14002
13994
 
14003
13995
  //! The column name to alter
14004
13996
  string column_name;
@@ -14009,20 +14001,16 @@ struct ChangeColumnTypeInfo : public AlterTableInfo {
14009
14001
 
14010
14002
  public:
14011
14003
  unique_ptr<AlterInfo> Copy() const override;
14012
- void Serialize(Serializer &serializer) override;
14013
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
14004
+ void SerializeAlterTable(FieldWriter &writer) const override;
14005
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
14014
14006
  };
14015
14007
 
14016
14008
  //===--------------------------------------------------------------------===//
14017
14009
  // SetDefaultInfo
14018
14010
  //===--------------------------------------------------------------------===//
14019
14011
  struct SetDefaultInfo : public AlterTableInfo {
14020
- SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default)
14021
- : AlterTableInfo(AlterTableType::SET_DEFAULT, schema, table), column_name(move(column_name)),
14022
- expression(move(new_default)) {
14023
- }
14024
- ~SetDefaultInfo() override {
14025
- }
14012
+ SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default);
14013
+ ~SetDefaultInfo() override;
14026
14014
 
14027
14015
  //! The column name to alter
14028
14016
  string column_name;
@@ -14031,8 +14019,8 @@ struct SetDefaultInfo : public AlterTableInfo {
14031
14019
 
14032
14020
  public:
14033
14021
  unique_ptr<AlterInfo> Copy() const override;
14034
- void Serialize(Serializer &serializer) override;
14035
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
14022
+ void SerializeAlterTable(FieldWriter &writer) const override;
14023
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
14036
14024
  };
14037
14025
 
14038
14026
  //===--------------------------------------------------------------------===//
@@ -14041,39 +14029,32 @@ public:
14041
14029
  enum class AlterViewType : uint8_t { INVALID = 0, RENAME_VIEW = 1 };
14042
14030
 
14043
14031
  struct AlterViewInfo : public AlterInfo {
14044
- AlterViewInfo(AlterViewType type, string schema, string view)
14045
- : AlterInfo(AlterType::ALTER_VIEW, schema, view), alter_view_type(type) {
14046
- }
14047
- ~AlterViewInfo() override {
14048
- }
14032
+ AlterViewInfo(AlterViewType type, string schema, string view);
14033
+ ~AlterViewInfo() override;
14049
14034
 
14050
14035
  AlterViewType alter_view_type;
14051
14036
 
14052
14037
  public:
14053
- CatalogType GetCatalogType() override {
14054
- return CatalogType::VIEW_ENTRY;
14055
- }
14056
- void Serialize(Serializer &serializer) override;
14057
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
14038
+ CatalogType GetCatalogType() const override;
14039
+ void Serialize(FieldWriter &writer) const override;
14040
+ virtual void SerializeAlterView(FieldWriter &writer) const = 0;
14041
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
14058
14042
  };
14059
14043
 
14060
14044
  //===--------------------------------------------------------------------===//
14061
14045
  // RenameViewInfo
14062
14046
  //===--------------------------------------------------------------------===//
14063
14047
  struct RenameViewInfo : public AlterViewInfo {
14064
- RenameViewInfo(string schema, string view, string new_name)
14065
- : AlterViewInfo(AlterViewType::RENAME_VIEW, schema, view), new_view_name(new_name) {
14066
- }
14067
- ~RenameViewInfo() override {
14068
- }
14048
+ RenameViewInfo(string schema, string view, string new_name);
14049
+ ~RenameViewInfo() override;
14069
14050
 
14070
14051
  //! Relation new name
14071
14052
  string new_view_name;
14072
14053
 
14073
14054
  public:
14074
14055
  unique_ptr<AlterInfo> Copy() const override;
14075
- void Serialize(Serializer &serializer) override;
14076
- static unique_ptr<AlterInfo> Deserialize(Deserializer &source, string schema, string table);
14056
+ void SerializeAlterView(FieldWriter &writer) const override;
14057
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
14077
14058
  };
14078
14059
 
14079
14060
  } // namespace duckdb
@@ -15159,8 +15140,8 @@ public:
15159
15140
 
15160
15141
  unique_ptr<ParsedExpression> Copy() const override;
15161
15142
 
15162
- void Serialize(Serializer &serializer) override;
15163
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
15143
+ void Serialize(FieldWriter &writer) const override;
15144
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
15164
15145
  };
15165
15146
  } // namespace duckdb
15166
15147
 
@@ -15394,6 +15375,10 @@ public:
15394
15375
  unique_ptr<ParsedExpression> Copy() const override {
15395
15376
  throw SerializationException("Cannot copy or serialize bound expression");
15396
15377
  }
15378
+
15379
+ void Serialize(FieldWriter &writer) const override {
15380
+ throw SerializationException("Cannot copy or serialize bound expression");
15381
+ }
15397
15382
  };
15398
15383
 
15399
15384
  } // namespace duckdb
@@ -16173,9 +16158,11 @@ public:
16173
16158
  virtual unique_ptr<TableRef> Copy() = 0;
16174
16159
 
16175
16160
  //! Serializes a TableRef to a stand-alone binary blob
16176
- virtual void Serialize(Serializer &serializer);
16161
+ DUCKDB_API void Serialize(Serializer &serializer) const;
16162
+ //! Serializes a TableRef to a stand-alone binary blob
16163
+ DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
16177
16164
  //! Deserializes a blob back into a TableRef
16178
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
16165
+ DUCKDB_API static unique_ptr<TableRef> Deserialize(Deserializer &source);
16179
16166
 
16180
16167
  //! Copy the properties of this table ref to the target
16181
16168
  void CopyProperties(TableRef &target) const;
@@ -16200,7 +16187,7 @@ public:
16200
16187
  //! Create a copy of this SelectStatement
16201
16188
  unique_ptr<SQLStatement> Copy() const override;
16202
16189
  //! Serializes a SelectStatement to a stand-alone binary blob
16203
- void Serialize(Serializer &serializer);
16190
+ void Serialize(Serializer &serializer) const;
16204
16191
  //! Deserializes a blob back into a SelectStatement, returns nullptr if
16205
16192
  //! deserialization is not possible
16206
16193
  static unique_ptr<SelectStatement> Deserialize(Deserializer &source);
@@ -16251,12 +16238,13 @@ public:
16251
16238
  virtual bool Equals(const QueryNode *other) const;
16252
16239
 
16253
16240
  //! Create a copy of this QueryNode
16254
- virtual unique_ptr<QueryNode> Copy() = 0;
16241
+ virtual unique_ptr<QueryNode> Copy() const = 0;
16255
16242
  //! Serializes a QueryNode to a stand-alone binary blob
16256
- virtual void Serialize(Serializer &serializer);
16257
- //! Deserializes a blob back into a QueryNode, returns nullptr if
16258
- //! deserialization is not possible
16259
- static unique_ptr<QueryNode> Deserialize(Deserializer &source);
16243
+ DUCKDB_API void Serialize(Serializer &serializer) const;
16244
+ //! Serializes a QueryNode to a stand-alone binary blob
16245
+ DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
16246
+ //! Deserializes a blob back into a QueryNode
16247
+ DUCKDB_API static unique_ptr<QueryNode> Deserialize(Deserializer &source);
16260
16248
 
16261
16249
  protected:
16262
16250
  //! Copy base QueryNode properties from another expression to this one,
@@ -16451,8 +16439,8 @@ public:
16451
16439
 
16452
16440
  unique_ptr<ParsedExpression> Copy() const override;
16453
16441
 
16454
- void Serialize(Serializer &serializer) override;
16455
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
16442
+ void Serialize(FieldWriter &writer) const override;
16443
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
16456
16444
  };
16457
16445
  } // namespace duckdb
16458
16446
 
@@ -18608,12 +18596,12 @@ public:
18608
18596
  public:
18609
18597
  DUCKDB_API string ToString() const override;
18610
18598
 
18611
- DUCKDB_API unique_ptr<Constraint> Copy() override;
18599
+ DUCKDB_API unique_ptr<Constraint> Copy() const override;
18612
18600
 
18613
18601
  //! Serialize to a stand-alone binary blob
18614
- DUCKDB_API void Serialize(Serializer &serializer) override;
18602
+ DUCKDB_API void Serialize(FieldWriter &writer) const override;
18615
18603
  //! Deserializes a NotNullConstraint
18616
- DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
18604
+ DUCKDB_API static unique_ptr<Constraint> Deserialize(FieldReader &source);
18617
18605
  };
18618
18606
 
18619
18607
  } // namespace duckdb
@@ -20167,17 +20155,17 @@ public:
20167
20155
  public:
20168
20156
  void Merge(const BaseStatistics &other) override;
20169
20157
 
20170
- bool IsConstant() override;
20158
+ bool IsConstant() const override;
20171
20159
 
20172
- unique_ptr<BaseStatistics> Copy() override;
20173
- void Serialize(Serializer &serializer) override;
20174
- static unique_ptr<BaseStatistics> Deserialize(Deserializer &source);
20175
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) override;
20160
+ unique_ptr<BaseStatistics> Copy() const override;
20161
+ void Serialize(FieldWriter &writer) const override;
20162
+ static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader);
20163
+ void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
20176
20164
 
20177
20165
  static unique_ptr<BaseStatistics> Combine(const unique_ptr<BaseStatistics> &lstats,
20178
20166
  const unique_ptr<BaseStatistics> &rstats);
20179
20167
 
20180
- string ToString() override;
20168
+ string ToString() const override;
20181
20169
  };
20182
20170
 
20183
20171
  } // namespace duckdb
@@ -20207,14 +20195,14 @@ public:
20207
20195
  void Update(const string_t &value);
20208
20196
  void Merge(const BaseStatistics &other) override;
20209
20197
 
20210
- unique_ptr<BaseStatistics> Copy() override;
20211
- void Serialize(Serializer &serializer) override;
20212
- static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
20213
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) override;
20198
+ unique_ptr<BaseStatistics> Copy() const override;
20199
+ void Serialize(FieldWriter &writer) const override;
20200
+ static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
20201
+ void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
20214
20202
 
20215
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value);
20203
+ FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value) const;
20216
20204
 
20217
- string ToString() override;
20205
+ string ToString() const override;
20218
20206
  };
20219
20207
 
20220
20208
  } // namespace duckdb
@@ -20295,20 +20283,20 @@ public:
20295
20283
  public:
20296
20284
  void Merge(const BaseStatistics &other) override;
20297
20285
 
20298
- bool IsConstant() override;
20286
+ bool IsConstant() const override;
20299
20287
 
20300
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant);
20288
+ FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
20301
20289
 
20302
- unique_ptr<BaseStatistics> Copy() override;
20303
- void Serialize(Serializer &serializer) override;
20304
- static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
20305
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) override;
20290
+ unique_ptr<BaseStatistics> Copy() const override;
20291
+ void Serialize(FieldWriter &writer) const override;
20292
+ static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
20293
+ void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
20306
20294
 
20307
- string ToString() override;
20295
+ string ToString() const override;
20308
20296
 
20309
20297
  private:
20310
20298
  template <class T>
20311
- void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count);
20299
+ void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count) const;
20312
20300
 
20313
20301
  public:
20314
20302
  template <class T>
@@ -21012,7 +21000,7 @@ private:
21012
21000
  //===----------------------------------------------------------------------===//
21013
21001
  // DuckDB
21014
21002
  //
21015
- // duckdb/parser/expression/star_expression.hpp
21003
+ // duckdb/parser/expression/comparison_expression.hpp
21016
21004
  //
21017
21005
  //
21018
21006
  //===----------------------------------------------------------------------===//
@@ -21021,36 +21009,31 @@ private:
21021
21009
 
21022
21010
 
21023
21011
 
21024
-
21025
21012
  namespace duckdb {
21026
-
21027
- //! Represents a * expression in the SELECT clause
21028
- class StarExpression : public ParsedExpression {
21013
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
21014
+ //! and has two children.
21015
+ class ComparisonExpression : public ParsedExpression {
21029
21016
  public:
21030
- StarExpression(string relation_name = string());
21017
+ ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21031
21018
 
21032
- //! The relation name in case of tbl.*, or empty if this is a normal *
21033
- string relation_name;
21034
- //! List of columns to exclude from the STAR expression
21035
- case_insensitive_set_t exclude_list;
21036
- //! List of columns to replace with another expression
21037
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
21019
+ unique_ptr<ParsedExpression> left;
21020
+ unique_ptr<ParsedExpression> right;
21038
21021
 
21039
21022
  public:
21040
21023
  string ToString() const override;
21041
21024
 
21042
- static bool Equals(const StarExpression *a, const StarExpression *b);
21025
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
21043
21026
 
21044
21027
  unique_ptr<ParsedExpression> Copy() const override;
21045
21028
 
21046
- void Serialize(Serializer &serializer) override;
21047
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21029
+ void Serialize(FieldWriter &writer) const override;
21030
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21048
21031
  };
21049
21032
  } // namespace duckdb
21050
21033
  //===----------------------------------------------------------------------===//
21051
21034
  // DuckDB
21052
21035
  //
21053
- // duckdb/parser/expression/conjunction_expression.hpp
21036
+ // duckdb/parser/expression/constant_expression.hpp
21054
21037
  //
21055
21038
  //
21056
21039
  //===----------------------------------------------------------------------===//
@@ -21062,32 +21045,31 @@ public:
21062
21045
 
21063
21046
  namespace duckdb {
21064
21047
 
21065
- //! Represents a conjunction (AND/OR)
21066
- class ConjunctionExpression : public ParsedExpression {
21048
+ //! ConstantExpression represents a constant value in the query
21049
+ class ConstantExpression : public ParsedExpression {
21067
21050
  public:
21068
- explicit ConjunctionExpression(ExpressionType type);
21069
- ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21070
- ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21051
+ explicit ConstantExpression(Value val);
21071
21052
 
21072
- vector<unique_ptr<ParsedExpression>> children;
21053
+ //! The constant value referenced
21054
+ Value value;
21073
21055
 
21074
21056
  public:
21075
- void AddExpression(unique_ptr<ParsedExpression> expr);
21076
-
21077
21057
  string ToString() const override;
21078
21058
 
21079
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
21059
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
21060
+ hash_t Hash() const override;
21080
21061
 
21081
21062
  unique_ptr<ParsedExpression> Copy() const override;
21082
21063
 
21083
- void Serialize(Serializer &serializer) override;
21084
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21064
+ void Serialize(FieldWriter &writer) const override;
21065
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21085
21066
  };
21067
+
21086
21068
  } // namespace duckdb
21087
21069
  //===----------------------------------------------------------------------===//
21088
21070
  // DuckDB
21089
21071
  //
21090
- // duckdb/parser/expression/collate_expression.hpp
21072
+ // duckdb/parser/expression/operator_expression.hpp
21091
21073
  //
21092
21074
  //
21093
21075
  //===----------------------------------------------------------------------===//
@@ -21096,27 +21078,26 @@ public:
21096
21078
 
21097
21079
 
21098
21080
 
21099
- namespace duckdb {
21100
21081
 
21101
- //! CollateExpression represents a COLLATE statement
21102
- class CollateExpression : public ParsedExpression {
21082
+ namespace duckdb {
21083
+ //! Represents a built-in operator expression
21084
+ class OperatorExpression : public ParsedExpression {
21103
21085
  public:
21104
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
21086
+ explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
21087
+ unique_ptr<ParsedExpression> right = nullptr);
21088
+ OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21105
21089
 
21106
- //! The child of the cast expression
21107
- unique_ptr<ParsedExpression> child;
21108
- //! The collation clause
21109
- string collation;
21090
+ vector<unique_ptr<ParsedExpression>> children;
21110
21091
 
21111
21092
  public:
21112
21093
  string ToString() const override;
21113
21094
 
21114
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
21095
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
21115
21096
 
21116
21097
  unique_ptr<ParsedExpression> Copy() const override;
21117
21098
 
21118
- void Serialize(Serializer &serializer) override;
21119
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21099
+ void Serialize(FieldWriter &writer) const override;
21100
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21120
21101
  };
21121
21102
  } // namespace duckdb
21122
21103
  //===----------------------------------------------------------------------===//
@@ -21164,14 +21145,14 @@ public:
21164
21145
 
21165
21146
  unique_ptr<ParsedExpression> Copy() const override;
21166
21147
 
21167
- void Serialize(Serializer &serializer) override;
21168
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21148
+ void Serialize(FieldWriter &writer) const override;
21149
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21169
21150
  };
21170
21151
  } // namespace duckdb
21171
21152
  //===----------------------------------------------------------------------===//
21172
21153
  // DuckDB
21173
21154
  //
21174
- // duckdb/parser/expression/constant_expression.hpp
21155
+ // duckdb/parser/expression/conjunction_expression.hpp
21175
21156
  //
21176
21157
  //
21177
21158
  //===----------------------------------------------------------------------===//
@@ -21183,31 +21164,32 @@ public:
21183
21164
 
21184
21165
  namespace duckdb {
21185
21166
 
21186
- //! ConstantExpression represents a constant value in the query
21187
- class ConstantExpression : public ParsedExpression {
21167
+ //! Represents a conjunction (AND/OR)
21168
+ class ConjunctionExpression : public ParsedExpression {
21188
21169
  public:
21189
- explicit ConstantExpression(Value val);
21170
+ explicit ConjunctionExpression(ExpressionType type);
21171
+ ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21172
+ ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21190
21173
 
21191
- //! The constant value referenced
21192
- Value value;
21174
+ vector<unique_ptr<ParsedExpression>> children;
21193
21175
 
21194
21176
  public:
21177
+ void AddExpression(unique_ptr<ParsedExpression> expr);
21178
+
21195
21179
  string ToString() const override;
21196
21180
 
21197
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
21198
- hash_t Hash() const override;
21181
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
21199
21182
 
21200
21183
  unique_ptr<ParsedExpression> Copy() const override;
21201
21184
 
21202
- void Serialize(Serializer &serializer) override;
21203
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21185
+ void Serialize(FieldWriter &writer) const override;
21186
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21204
21187
  };
21205
-
21206
21188
  } // namespace duckdb
21207
21189
  //===----------------------------------------------------------------------===//
21208
21190
  // DuckDB
21209
21191
  //
21210
- // duckdb/parser/expression/lambda_expression.hpp
21192
+ // duckdb/parser/expression/between_expression.hpp
21211
21193
  //
21212
21194
  //
21213
21195
  //===----------------------------------------------------------------------===//
@@ -21216,35 +21198,32 @@ public:
21216
21198
 
21217
21199
 
21218
21200
 
21219
-
21220
21201
  namespace duckdb {
21221
21202
 
21222
- //! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
21223
- //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
21224
- class LambdaExpression : public ParsedExpression {
21203
+ class BetweenExpression : public ParsedExpression {
21225
21204
  public:
21226
- LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21205
+ BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
21206
+ unique_ptr<ParsedExpression> upper);
21227
21207
 
21228
- vector<string> parameters;
21229
- unique_ptr<ParsedExpression> expression;
21208
+ unique_ptr<ParsedExpression> input;
21209
+ unique_ptr<ParsedExpression> lower;
21210
+ unique_ptr<ParsedExpression> upper;
21230
21211
 
21231
21212
  public:
21232
21213
  string ToString() const override;
21233
21214
 
21234
- static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
21235
- hash_t Hash() const override;
21215
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
21236
21216
 
21237
21217
  unique_ptr<ParsedExpression> Copy() const override;
21238
21218
 
21239
- void Serialize(Serializer &serializer) override;
21240
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21219
+ void Serialize(FieldWriter &writer) const override;
21220
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21241
21221
  };
21242
-
21243
21222
  } // namespace duckdb
21244
21223
  //===----------------------------------------------------------------------===//
21245
21224
  // DuckDB
21246
21225
  //
21247
- // duckdb/parser/expression/positional_reference_expression.hpp
21226
+ // duckdb/parser/expression/parameter_expression.hpp
21248
21227
  //
21249
21228
  //
21250
21229
  //===----------------------------------------------------------------------===//
@@ -21254,25 +21233,65 @@ public:
21254
21233
 
21255
21234
 
21256
21235
  namespace duckdb {
21257
- class PositionalReferenceExpression : public ParsedExpression {
21236
+ class ParameterExpression : public ParsedExpression {
21258
21237
  public:
21259
- PositionalReferenceExpression(idx_t index);
21238
+ ParameterExpression();
21260
21239
 
21261
- idx_t index;
21240
+ idx_t parameter_nr;
21262
21241
 
21263
21242
  public:
21264
21243
  bool IsScalar() const override {
21265
- return false;
21244
+ return true;
21245
+ }
21246
+ bool HasParameter() const override {
21247
+ return true;
21266
21248
  }
21267
21249
 
21268
21250
  string ToString() const override;
21269
21251
 
21270
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
21271
21252
  unique_ptr<ParsedExpression> Copy() const override;
21272
21253
  hash_t Hash() const override;
21273
21254
 
21274
- void Serialize(Serializer &serializer) override;
21275
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21255
+ void Serialize(FieldWriter &writer) const override;
21256
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21257
+ };
21258
+ } // namespace duckdb
21259
+ //===----------------------------------------------------------------------===//
21260
+ // DuckDB
21261
+ //
21262
+ // duckdb/parser/expression/star_expression.hpp
21263
+ //
21264
+ //
21265
+ //===----------------------------------------------------------------------===//
21266
+
21267
+
21268
+
21269
+
21270
+
21271
+
21272
+ namespace duckdb {
21273
+
21274
+ //! Represents a * expression in the SELECT clause
21275
+ class StarExpression : public ParsedExpression {
21276
+ public:
21277
+ StarExpression(string relation_name = string());
21278
+
21279
+ //! The relation name in case of tbl.*, or empty if this is a normal *
21280
+ string relation_name;
21281
+ //! List of columns to exclude from the STAR expression
21282
+ case_insensitive_set_t exclude_list;
21283
+ //! List of columns to replace with another expression
21284
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
21285
+
21286
+ public:
21287
+ string ToString() const override;
21288
+
21289
+ static bool Equals(const StarExpression *a, const StarExpression *b);
21290
+
21291
+ unique_ptr<ParsedExpression> Copy() const override;
21292
+
21293
+ void Serialize(FieldWriter &writer) const override;
21294
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21276
21295
  };
21277
21296
  } // namespace duckdb
21278
21297
  //===----------------------------------------------------------------------===//
@@ -21310,14 +21329,14 @@ public:
21310
21329
 
21311
21330
  unique_ptr<ParsedExpression> Copy() const override;
21312
21331
 
21313
- void Serialize(Serializer &serializer) override;
21314
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21332
+ void Serialize(FieldWriter &writer) const override;
21333
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21315
21334
  };
21316
21335
  } // namespace duckdb
21317
21336
  //===----------------------------------------------------------------------===//
21318
21337
  // DuckDB
21319
21338
  //
21320
- // duckdb/parser/expression/between_expression.hpp
21339
+ // duckdb/parser/expression/cast_expression.hpp
21321
21340
  //
21322
21341
  //
21323
21342
  //===----------------------------------------------------------------------===//
@@ -21326,32 +21345,36 @@ public:
21326
21345
 
21327
21346
 
21328
21347
 
21348
+
21329
21349
  namespace duckdb {
21330
21350
 
21331
- class BetweenExpression : public ParsedExpression {
21351
+ //! CastExpression represents a type cast from one SQL type to another SQL type
21352
+ class CastExpression : public ParsedExpression {
21332
21353
  public:
21333
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
21334
- unique_ptr<ParsedExpression> upper);
21354
+ CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
21335
21355
 
21336
- unique_ptr<ParsedExpression> input;
21337
- unique_ptr<ParsedExpression> lower;
21338
- unique_ptr<ParsedExpression> upper;
21356
+ //! The child of the cast expression
21357
+ unique_ptr<ParsedExpression> child;
21358
+ //! The type to cast to
21359
+ LogicalType cast_type;
21360
+ //! Whether or not this is a try_cast expression
21361
+ bool try_cast;
21339
21362
 
21340
21363
  public:
21341
21364
  string ToString() const override;
21342
21365
 
21343
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
21366
+ static bool Equals(const CastExpression *a, const CastExpression *b);
21344
21367
 
21345
21368
  unique_ptr<ParsedExpression> Copy() const override;
21346
21369
 
21347
- void Serialize(Serializer &serializer) override;
21348
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21370
+ void Serialize(FieldWriter &writer) const override;
21371
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21349
21372
  };
21350
21373
  } // namespace duckdb
21351
21374
  //===----------------------------------------------------------------------===//
21352
21375
  // DuckDB
21353
21376
  //
21354
- // duckdb/parser/expression/comparison_expression.hpp
21377
+ // duckdb/parser/expression/positional_reference_expression.hpp
21355
21378
  //
21356
21379
  //
21357
21380
  //===----------------------------------------------------------------------===//
@@ -21361,30 +21384,31 @@ public:
21361
21384
 
21362
21385
 
21363
21386
  namespace duckdb {
21364
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
21365
- //! and has two children.
21366
- class ComparisonExpression : public ParsedExpression {
21387
+ class PositionalReferenceExpression : public ParsedExpression {
21367
21388
  public:
21368
- ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21389
+ PositionalReferenceExpression(idx_t index);
21369
21390
 
21370
- unique_ptr<ParsedExpression> left;
21371
- unique_ptr<ParsedExpression> right;
21391
+ idx_t index;
21372
21392
 
21373
21393
  public:
21374
- string ToString() const override;
21394
+ bool IsScalar() const override {
21395
+ return false;
21396
+ }
21375
21397
 
21376
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
21398
+ string ToString() const override;
21377
21399
 
21400
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
21378
21401
  unique_ptr<ParsedExpression> Copy() const override;
21402
+ hash_t Hash() const override;
21379
21403
 
21380
- void Serialize(Serializer &serializer) override;
21381
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21404
+ void Serialize(FieldWriter &writer) const override;
21405
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21382
21406
  };
21383
21407
  } // namespace duckdb
21384
21408
  //===----------------------------------------------------------------------===//
21385
21409
  // DuckDB
21386
21410
  //
21387
- // duckdb/parser/expression/cast_expression.hpp
21411
+ // duckdb/parser/expression/lambda_expression.hpp
21388
21412
  //
21389
21413
  //
21390
21414
  //===----------------------------------------------------------------------===//
@@ -21396,33 +21420,67 @@ public:
21396
21420
 
21397
21421
  namespace duckdb {
21398
21422
 
21399
- //! CastExpression represents a type cast from one SQL type to another SQL type
21400
- class CastExpression : public ParsedExpression {
21423
+ //! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
21424
+ //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
21425
+ class LambdaExpression : public ParsedExpression {
21401
21426
  public:
21402
- CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
21427
+ LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21403
21428
 
21404
- //! The child of the cast expression
21405
- unique_ptr<ParsedExpression> child;
21406
- //! The type to cast to
21407
- LogicalType cast_type;
21408
- //! Whether or not this is a try_cast expression
21409
- bool try_cast;
21429
+ vector<string> parameters;
21430
+ unique_ptr<ParsedExpression> expression;
21410
21431
 
21411
21432
  public:
21412
21433
  string ToString() const override;
21413
21434
 
21414
- static bool Equals(const CastExpression *a, const CastExpression *b);
21435
+ static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
21436
+ hash_t Hash() const override;
21415
21437
 
21416
21438
  unique_ptr<ParsedExpression> Copy() const override;
21417
21439
 
21418
- void Serialize(Serializer &serializer) override;
21419
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21440
+ void Serialize(FieldWriter &writer) const override;
21441
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21420
21442
  };
21443
+
21421
21444
  } // namespace duckdb
21422
21445
 
21423
21446
 
21424
21447
 
21425
21448
 
21449
+ //===----------------------------------------------------------------------===//
21450
+ // DuckDB
21451
+ //
21452
+ // duckdb/parser/expression/collate_expression.hpp
21453
+ //
21454
+ //
21455
+ //===----------------------------------------------------------------------===//
21456
+
21457
+
21458
+
21459
+
21460
+
21461
+ namespace duckdb {
21462
+
21463
+ //! CollateExpression represents a COLLATE statement
21464
+ class CollateExpression : public ParsedExpression {
21465
+ public:
21466
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
21467
+
21468
+ //! The child of the cast expression
21469
+ unique_ptr<ParsedExpression> child;
21470
+ //! The collation clause
21471
+ string collation;
21472
+
21473
+ public:
21474
+ string ToString() const override;
21475
+
21476
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
21477
+
21478
+ unique_ptr<ParsedExpression> Copy() const override;
21479
+
21480
+ void Serialize(FieldWriter &writer) const override;
21481
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21482
+ };
21483
+ } // namespace duckdb
21426
21484
 
21427
21485
 
21428
21486
 
@@ -21455,7 +21513,8 @@ public:
21455
21513
 
21456
21514
  unique_ptr<ParsedExpression> Copy() const override;
21457
21515
 
21458
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21516
+ void Serialize(FieldWriter &writer) const override;
21517
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21459
21518
  };
21460
21519
  } // namespace duckdb
21461
21520
 
@@ -21507,94 +21566,22 @@ public:
21507
21566
  static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
21508
21567
  hash_t Hash() const override;
21509
21568
 
21510
- //! Serializes a FunctionExpression to a stand-alone binary blob
21511
- void Serialize(Serializer &serializer) override;
21512
- //! Deserializes a blob back into an FunctionExpression
21513
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21569
+ void Serialize(FieldWriter &writer) const override;
21570
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21514
21571
  };
21515
21572
  } // namespace duckdb
21516
21573
 
21517
21574
 
21518
- //===----------------------------------------------------------------------===//
21519
- // DuckDB
21520
- //
21521
- // duckdb/parser/expression/operator_expression.hpp
21522
- //
21523
- //
21524
- //===----------------------------------------------------------------------===//
21525
-
21526
21575
 
21527
21576
 
21528
21577
 
21529
21578
 
21530
21579
 
21531
- namespace duckdb {
21532
- //! Represents a built-in operator expression
21533
- class OperatorExpression : public ParsedExpression {
21534
- public:
21535
- explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
21536
- unique_ptr<ParsedExpression> right = nullptr);
21537
- OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21538
-
21539
- vector<unique_ptr<ParsedExpression>> children;
21540
-
21541
- public:
21542
- string ToString() const override;
21543
-
21544
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
21545
-
21546
- unique_ptr<ParsedExpression> Copy() const override;
21547
-
21548
- void Serialize(Serializer &serializer) override;
21549
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21550
- };
21551
- } // namespace duckdb
21552
21580
 
21553
21581
  //===----------------------------------------------------------------------===//
21554
21582
  // DuckDB
21555
21583
  //
21556
- // duckdb/parser/expression/parameter_expression.hpp
21557
- //
21558
- //
21559
- //===----------------------------------------------------------------------===//
21560
-
21561
-
21562
-
21563
-
21564
-
21565
- namespace duckdb {
21566
- class ParameterExpression : public ParsedExpression {
21567
- public:
21568
- ParameterExpression();
21569
-
21570
- idx_t parameter_nr;
21571
-
21572
- public:
21573
- bool IsScalar() const override {
21574
- return true;
21575
- }
21576
- bool HasParameter() const override {
21577
- return true;
21578
- }
21579
-
21580
- string ToString() const override;
21581
-
21582
- unique_ptr<ParsedExpression> Copy() const override;
21583
- hash_t Hash() const override;
21584
-
21585
- void Serialize(Serializer &serializer) override;
21586
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21587
- };
21588
- } // namespace duckdb
21589
-
21590
-
21591
-
21592
-
21593
-
21594
- //===----------------------------------------------------------------------===//
21595
- // DuckDB
21596
- //
21597
- // duckdb/parser/parsed_data/create_type_info.hpp
21584
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
21598
21585
  //
21599
21586
  //
21600
21587
  //===----------------------------------------------------------------------===//
@@ -21604,26 +21591,28 @@ public:
21604
21591
 
21605
21592
 
21606
21593
 
21607
-
21608
-
21609
21594
  namespace duckdb {
21610
21595
 
21611
- struct CreateTypeInfo : public CreateInfo {
21612
-
21613
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
21596
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
21597
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
21598
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
21599
+ functions.push_back(move(function));
21600
+ this->name = function.name;
21601
+ }
21602
+ CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
21603
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
21604
+ this->name = name;
21605
+ for (auto &function : functions) {
21606
+ function.name = name;
21607
+ }
21614
21608
  }
21615
21609
 
21616
- //! Name of the Type
21617
- string name;
21618
- //! Shared Pointer of Logical Type
21619
- unique_ptr<LogicalType> type;
21610
+ vector<PragmaFunction> functions;
21620
21611
 
21621
21612
  public:
21622
21613
  unique_ptr<CreateInfo> Copy() const override {
21623
- auto result = make_unique<CreateTypeInfo>();
21614
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
21624
21615
  CopyProperties(*result);
21625
- result->name = name;
21626
- result->type = make_unique<LogicalType>(*type);
21627
21616
  return move(result);
21628
21617
  }
21629
21618
  };
@@ -21632,7 +21621,7 @@ public:
21632
21621
  //===----------------------------------------------------------------------===//
21633
21622
  // DuckDB
21634
21623
  //
21635
- // duckdb/parser/parsed_data/vacuum_info.hpp
21624
+ // duckdb/parser/parsed_data/create_collation_info.hpp
21636
21625
  //
21637
21626
  //
21638
21627
  //===----------------------------------------------------------------------===//
@@ -21641,20 +21630,32 @@ public:
21641
21630
 
21642
21631
 
21643
21632
 
21633
+
21644
21634
  namespace duckdb {
21645
21635
 
21646
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
21636
+ struct CreateCollationInfo : public CreateInfo {
21637
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
21638
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
21639
+ not_required_for_equality(not_required_for_equality_p) {
21640
+ this->name = move(name_p);
21641
+ }
21647
21642
 
21648
- struct LoadInfo : public ParseInfo {
21649
- std::string filename;
21650
- LoadType load_type;
21643
+ //! The name of the collation
21644
+ string name;
21645
+ //! The collation function to push in case collation is required
21646
+ ScalarFunction function;
21647
+ //! Whether or not the collation can be combined with other collations.
21648
+ bool combinable;
21649
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
21650
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
21651
+ //! speeds up processing.
21652
+ bool not_required_for_equality;
21651
21653
 
21652
21654
  public:
21653
- unique_ptr<LoadInfo> Copy() const {
21654
- auto result = make_unique<LoadInfo>();
21655
- result->filename = filename;
21656
- result->load_type = load_type;
21657
- return result;
21655
+ unique_ptr<CreateInfo> Copy() const override {
21656
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
21657
+ CopyProperties(*result);
21658
+ return move(result);
21658
21659
  }
21659
21660
  };
21660
21661
 
@@ -21662,57 +21663,7 @@ public:
21662
21663
  //===----------------------------------------------------------------------===//
21663
21664
  // DuckDB
21664
21665
  //
21665
- // duckdb/parser/parsed_data/export_table_data.hpp
21666
- //
21667
- //
21668
- //===----------------------------------------------------------------------===//
21669
-
21670
-
21671
-
21672
-
21673
-
21674
-
21675
- namespace duckdb {
21676
-
21677
- struct ExportedTableData {
21678
- //! Name of the exported table
21679
- string table_name;
21680
-
21681
- //! Name of the schema
21682
- string schema_name;
21683
-
21684
- //! Path to be exported
21685
- string file_path;
21686
- };
21687
-
21688
- struct BoundExportData : public ParseInfo {
21689
- unordered_map<TableCatalogEntry *, ExportedTableData> data;
21690
- };
21691
-
21692
- } // namespace duckdb
21693
- //===----------------------------------------------------------------------===//
21694
- // DuckDB
21695
- //
21696
- // duckdb/parser/parsed_data/vacuum_info.hpp
21697
- //
21698
- //
21699
- //===----------------------------------------------------------------------===//
21700
-
21701
-
21702
-
21703
-
21704
-
21705
- namespace duckdb {
21706
-
21707
- struct VacuumInfo : public ParseInfo {
21708
- // nothing for now
21709
- };
21710
-
21711
- } // namespace duckdb
21712
- //===----------------------------------------------------------------------===//
21713
- // DuckDB
21714
- //
21715
- // duckdb/parser/parsed_data/create_collation_info.hpp
21666
+ // duckdb/parser/parsed_data/create_schema_info.hpp
21716
21667
  //
21717
21668
  //
21718
21669
  //===----------------------------------------------------------------------===//
@@ -21721,30 +21672,15 @@ struct VacuumInfo : public ParseInfo {
21721
21672
 
21722
21673
 
21723
21674
 
21724
-
21725
21675
  namespace duckdb {
21726
21676
 
21727
- struct CreateCollationInfo : public CreateInfo {
21728
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
21729
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
21730
- not_required_for_equality(not_required_for_equality_p) {
21731
- this->name = move(name_p);
21677
+ struct CreateSchemaInfo : public CreateInfo {
21678
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
21732
21679
  }
21733
21680
 
21734
- //! The name of the collation
21735
- string name;
21736
- //! The collation function to push in case collation is required
21737
- ScalarFunction function;
21738
- //! Whether or not the collation can be combined with other collations.
21739
- bool combinable;
21740
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
21741
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
21742
- //! speeds up processing.
21743
- bool not_required_for_equality;
21744
-
21745
21681
  public:
21746
21682
  unique_ptr<CreateInfo> Copy() const override {
21747
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
21683
+ auto result = make_unique<CreateSchemaInfo>();
21748
21684
  CopyProperties(*result);
21749
21685
  return move(result);
21750
21686
  }
@@ -21798,7 +21734,32 @@ public:
21798
21734
  //===----------------------------------------------------------------------===//
21799
21735
  // DuckDB
21800
21736
  //
21801
- // duckdb/parser/parsed_data/create_view_info.hpp
21737
+ // duckdb/parser/parsed_data/transaction_info.hpp
21738
+ //
21739
+ //
21740
+ //===----------------------------------------------------------------------===//
21741
+
21742
+
21743
+
21744
+
21745
+
21746
+ namespace duckdb {
21747
+
21748
+ enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
21749
+
21750
+ struct TransactionInfo : public ParseInfo {
21751
+ explicit TransactionInfo(TransactionType type) : type(type) {
21752
+ }
21753
+
21754
+ //! The type of transaction statement
21755
+ TransactionType type;
21756
+ };
21757
+
21758
+ } // namespace duckdb
21759
+ //===----------------------------------------------------------------------===//
21760
+ // DuckDB
21761
+ //
21762
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
21802
21763
  //
21803
21764
  //
21804
21765
  //===----------------------------------------------------------------------===//
@@ -21810,29 +21771,27 @@ public:
21810
21771
 
21811
21772
  namespace duckdb {
21812
21773
 
21813
- struct CreateViewInfo : public CreateInfo {
21814
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
21774
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
21775
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
21776
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
21777
+ this->name = function.name;
21778
+ functions.AddFunction(move(function));
21815
21779
  }
21816
- CreateViewInfo(string schema, string view_name)
21817
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
21780
+
21781
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
21782
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
21783
+ this->name = functions.name;
21784
+ for (auto &func : functions.functions) {
21785
+ func.name = functions.name;
21786
+ }
21818
21787
  }
21819
21788
 
21820
- //! Table name to insert to
21821
- string view_name;
21822
- //! Aliases of the view
21823
- vector<string> aliases;
21824
- //! Return types
21825
- vector<LogicalType> types;
21826
- //! The SelectStatement of the view
21827
- unique_ptr<SelectStatement> query;
21789
+ AggregateFunctionSet functions;
21828
21790
 
21829
21791
  public:
21830
21792
  unique_ptr<CreateInfo> Copy() const override {
21831
- auto result = make_unique<CreateViewInfo>(schema, view_name);
21793
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
21832
21794
  CopyProperties(*result);
21833
- result->aliases = aliases;
21834
- result->types = types;
21835
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
21836
21795
  return move(result);
21837
21796
  }
21838
21797
  };
@@ -21885,9 +21844,9 @@ public:
21885
21844
  unique_ptr<TableRef> Copy() override;
21886
21845
 
21887
21846
  //! Serializes a blob into a BaseTableRef
21888
- void Serialize(Serializer &serializer) override;
21847
+ void Serialize(FieldWriter &serializer) const override;
21889
21848
  //! Deserializes a blob back into a BaseTableRef
21890
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
21849
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
21891
21850
  };
21892
21851
  } // namespace duckdb
21893
21852
 
@@ -21905,110 +21864,22 @@ struct CreateIndexInfo : public CreateInfo {
21905
21864
  string index_name;
21906
21865
  //! If it is an unique index
21907
21866
  bool unique = false;
21908
- //! The table to create the index on
21909
- unique_ptr<BaseTableRef> table;
21910
- //! Set of expressions to index by
21911
- vector<unique_ptr<ParsedExpression>> expressions;
21912
-
21913
- public:
21914
- unique_ptr<CreateInfo> Copy() const override {
21915
- auto result = make_unique<CreateIndexInfo>();
21916
- CopyProperties(*result);
21917
- result->index_type = index_type;
21918
- result->index_name = index_name;
21919
- result->unique = unique;
21920
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
21921
- for (auto &expr : expressions) {
21922
- result->expressions.push_back(expr->Copy());
21923
- }
21924
- return move(result);
21925
- }
21926
- };
21927
-
21928
- } // namespace duckdb
21929
- //===----------------------------------------------------------------------===//
21930
- // DuckDB
21931
- //
21932
- // duckdb/parser/parsed_data/show_select_info.hpp
21933
- //
21934
- //
21935
- //===----------------------------------------------------------------------===//
21936
-
21937
-
21938
-
21939
-
21940
-
21941
-
21942
- namespace duckdb {
21943
-
21944
- struct ShowSelectInfo : public ParseInfo {
21945
- //! Types of projected columns
21946
- vector<LogicalType> types;
21947
- //! The QueryNode of select query
21948
- unique_ptr<QueryNode> query;
21949
- //! Aliases of projected columns
21950
- vector<string> aliases;
21951
- //! Whether or not we are requesting a summary or a describe
21952
- bool is_summary;
21953
-
21954
- unique_ptr<ShowSelectInfo> Copy() {
21955
- auto result = make_unique<ShowSelectInfo>();
21956
- result->types = types;
21957
- result->query = query->Copy();
21958
- result->aliases = aliases;
21959
- result->is_summary = is_summary;
21960
- return result;
21961
- }
21962
- };
21963
-
21964
- } // namespace duckdb
21965
- //===----------------------------------------------------------------------===//
21966
- // DuckDB
21967
- //
21968
- // duckdb/parser/parsed_data/transaction_info.hpp
21969
- //
21970
- //
21971
- //===----------------------------------------------------------------------===//
21972
-
21973
-
21974
-
21975
-
21976
-
21977
- namespace duckdb {
21978
-
21979
- enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
21980
-
21981
- struct TransactionInfo : public ParseInfo {
21982
- explicit TransactionInfo(TransactionType type) : type(type) {
21983
- }
21984
-
21985
- //! The type of transaction statement
21986
- TransactionType type;
21987
- };
21988
-
21989
- } // namespace duckdb
21990
- //===----------------------------------------------------------------------===//
21991
- // DuckDB
21992
- //
21993
- // duckdb/parser/parsed_data/create_schema_info.hpp
21994
- //
21995
- //
21996
- //===----------------------------------------------------------------------===//
21997
-
21998
-
21999
-
22000
-
22001
-
22002
- namespace duckdb {
22003
-
22004
- struct CreateSchemaInfo : public CreateInfo {
22005
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
22006
- }
21867
+ //! The table to create the index on
21868
+ unique_ptr<BaseTableRef> table;
21869
+ //! Set of expressions to index by
21870
+ vector<unique_ptr<ParsedExpression>> expressions;
22007
21871
 
22008
21872
  public:
22009
21873
  unique_ptr<CreateInfo> Copy() const override {
22010
- auto result = make_unique<CreateSchemaInfo>();
21874
+ auto result = make_unique<CreateIndexInfo>();
22011
21875
  CopyProperties(*result);
21876
+ result->index_type = index_type;
21877
+ result->index_name = index_name;
21878
+ result->unique = unique;
21879
+ result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
21880
+ for (auto &expr : expressions) {
21881
+ result->expressions.push_back(expr->Copy());
21882
+ }
22012
21883
  return move(result);
22013
21884
  }
22014
21885
  };
@@ -22017,7 +21888,7 @@ public:
22017
21888
  //===----------------------------------------------------------------------===//
22018
21889
  // DuckDB
22019
21890
  //
22020
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
21891
+ // duckdb/parser/parsed_data/show_select_info.hpp
22021
21892
  //
22022
21893
  //
22023
21894
  //===----------------------------------------------------------------------===//
@@ -22029,27 +21900,23 @@ public:
22029
21900
 
22030
21901
  namespace duckdb {
22031
21902
 
22032
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
22033
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
22034
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
22035
- functions.push_back(move(function));
22036
- this->name = function.name;
22037
- }
22038
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
22039
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
22040
- this->name = name;
22041
- for (auto &function : functions) {
22042
- function.name = name;
22043
- }
22044
- }
22045
-
22046
- vector<PragmaFunction> functions;
21903
+ struct ShowSelectInfo : public ParseInfo {
21904
+ //! Types of projected columns
21905
+ vector<LogicalType> types;
21906
+ //! The QueryNode of select query
21907
+ unique_ptr<QueryNode> query;
21908
+ //! Aliases of projected columns
21909
+ vector<string> aliases;
21910
+ //! Whether or not we are requesting a summary or a describe
21911
+ bool is_summary;
22047
21912
 
22048
- public:
22049
- unique_ptr<CreateInfo> Copy() const override {
22050
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
22051
- CopyProperties(*result);
22052
- return move(result);
21913
+ unique_ptr<ShowSelectInfo> Copy() {
21914
+ auto result = make_unique<ShowSelectInfo>();
21915
+ result->types = types;
21916
+ result->query = query->Copy();
21917
+ result->aliases = aliases;
21918
+ result->is_summary = is_summary;
21919
+ return result;
22053
21920
  }
22054
21921
  };
22055
21922
 
@@ -22057,7 +21924,7 @@ public:
22057
21924
  //===----------------------------------------------------------------------===//
22058
21925
  // DuckDB
22059
21926
  //
22060
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
21927
+ // duckdb/parser/parsed_data/create_type_info.hpp
22061
21928
  //
22062
21929
  //
22063
21930
  //===----------------------------------------------------------------------===//
@@ -22067,29 +21934,26 @@ public:
22067
21934
 
22068
21935
 
22069
21936
 
21937
+
21938
+
22070
21939
  namespace duckdb {
22071
21940
 
22072
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
22073
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
22074
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
22075
- this->name = function.name;
22076
- functions.AddFunction(move(function));
22077
- }
21941
+ struct CreateTypeInfo : public CreateInfo {
22078
21942
 
22079
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
22080
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
22081
- this->name = functions.name;
22082
- for (auto &func : functions.functions) {
22083
- func.name = functions.name;
22084
- }
21943
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
22085
21944
  }
22086
21945
 
22087
- AggregateFunctionSet functions;
21946
+ //! Name of the Type
21947
+ string name;
21948
+ //! Logical Type
21949
+ LogicalType type;
22088
21950
 
22089
21951
  public:
22090
21952
  unique_ptr<CreateInfo> Copy() const override {
22091
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
21953
+ auto result = make_unique<CreateTypeInfo>();
22092
21954
  CopyProperties(*result);
21955
+ result->name = name;
21956
+ result->type = type;
22093
21957
  return move(result);
22094
21958
  }
22095
21959
  };
@@ -22165,6 +22029,129 @@ public:
22165
22029
  }
22166
22030
  };
22167
22031
 
22032
+ } // namespace duckdb
22033
+ //===----------------------------------------------------------------------===//
22034
+ // DuckDB
22035
+ //
22036
+ // duckdb/parser/parsed_data/export_table_data.hpp
22037
+ //
22038
+ //
22039
+ //===----------------------------------------------------------------------===//
22040
+
22041
+
22042
+
22043
+
22044
+
22045
+
22046
+ namespace duckdb {
22047
+
22048
+ struct ExportedTableData {
22049
+ //! Name of the exported table
22050
+ string table_name;
22051
+
22052
+ //! Name of the schema
22053
+ string schema_name;
22054
+
22055
+ //! Path to be exported
22056
+ string file_path;
22057
+ };
22058
+
22059
+ struct BoundExportData : public ParseInfo {
22060
+ unordered_map<TableCatalogEntry *, ExportedTableData> data;
22061
+ };
22062
+
22063
+ } // namespace duckdb
22064
+ //===----------------------------------------------------------------------===//
22065
+ // DuckDB
22066
+ //
22067
+ // duckdb/parser/parsed_data/vacuum_info.hpp
22068
+ //
22069
+ //
22070
+ //===----------------------------------------------------------------------===//
22071
+
22072
+
22073
+
22074
+
22075
+
22076
+ namespace duckdb {
22077
+
22078
+ struct VacuumInfo : public ParseInfo {
22079
+ // nothing for now
22080
+ };
22081
+
22082
+ } // namespace duckdb
22083
+ //===----------------------------------------------------------------------===//
22084
+ // DuckDB
22085
+ //
22086
+ // duckdb/parser/parsed_data/create_view_info.hpp
22087
+ //
22088
+ //
22089
+ //===----------------------------------------------------------------------===//
22090
+
22091
+
22092
+
22093
+
22094
+
22095
+
22096
+ namespace duckdb {
22097
+
22098
+ struct CreateViewInfo : public CreateInfo {
22099
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
22100
+ }
22101
+ CreateViewInfo(string schema, string view_name)
22102
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
22103
+ }
22104
+
22105
+ //! Table name to insert to
22106
+ string view_name;
22107
+ //! Aliases of the view
22108
+ vector<string> aliases;
22109
+ //! Return types
22110
+ vector<LogicalType> types;
22111
+ //! The SelectStatement of the view
22112
+ unique_ptr<SelectStatement> query;
22113
+
22114
+ public:
22115
+ unique_ptr<CreateInfo> Copy() const override {
22116
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
22117
+ CopyProperties(*result);
22118
+ result->aliases = aliases;
22119
+ result->types = types;
22120
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
22121
+ return move(result);
22122
+ }
22123
+ };
22124
+
22125
+ } // namespace duckdb
22126
+ //===----------------------------------------------------------------------===//
22127
+ // DuckDB
22128
+ //
22129
+ // duckdb/parser/parsed_data/vacuum_info.hpp
22130
+ //
22131
+ //
22132
+ //===----------------------------------------------------------------------===//
22133
+
22134
+
22135
+
22136
+
22137
+
22138
+ namespace duckdb {
22139
+
22140
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
22141
+
22142
+ struct LoadInfo : public ParseInfo {
22143
+ std::string filename;
22144
+ LoadType load_type;
22145
+
22146
+ public:
22147
+ unique_ptr<LoadInfo> Copy() const {
22148
+ auto result = make_unique<LoadInfo>();
22149
+ result->filename = filename;
22150
+ result->load_type = load_type;
22151
+ return result;
22152
+ }
22153
+ };
22154
+
22168
22155
  } // namespace duckdb
22169
22156
  //===----------------------------------------------------------------------===//
22170
22157
  // DuckDB
@@ -22196,9 +22183,9 @@ public:
22196
22183
  unique_ptr<TableRef> Copy() override;
22197
22184
 
22198
22185
  //! Serializes a blob into a SubqueryRef
22199
- void Serialize(Serializer &serializer) override;
22186
+ void Serialize(FieldWriter &serializer) const override;
22200
22187
  //! Deserializes a blob back into a SubqueryRef
22201
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22188
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22202
22189
  };
22203
22190
  } // namespace duckdb
22204
22191
  //===----------------------------------------------------------------------===//
@@ -22231,9 +22218,9 @@ public:
22231
22218
  unique_ptr<TableRef> Copy() override;
22232
22219
 
22233
22220
  //! Serializes a blob into a CrossProductRef
22234
- void Serialize(Serializer &serializer) override;
22221
+ void Serialize(FieldWriter &serializer) const override;
22235
22222
  //! Deserializes a blob back into a CrossProductRef
22236
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22223
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22237
22224
  };
22238
22225
  } // namespace duckdb
22239
22226
  //===----------------------------------------------------------------------===//
@@ -22278,15 +22265,17 @@ public:
22278
22265
  unique_ptr<TableRef> Copy() override;
22279
22266
 
22280
22267
  //! Serializes a blob into a JoinRef
22281
- void Serialize(Serializer &serializer) override;
22268
+ void Serialize(FieldWriter &serializer) const override;
22282
22269
  //! Deserializes a blob back into a JoinRef
22283
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22270
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22284
22271
  };
22285
22272
  } // namespace duckdb
22273
+
22274
+
22286
22275
  //===----------------------------------------------------------------------===//
22287
22276
  // DuckDB
22288
22277
  //
22289
- // duckdb/parser/tableref/expressionlistref.hpp
22278
+ // duckdb/parser/tableref/emptytableref.hpp
22290
22279
  //
22291
22280
  //
22292
22281
  //===----------------------------------------------------------------------===//
@@ -22295,38 +22284,29 @@ public:
22295
22284
 
22296
22285
 
22297
22286
 
22298
-
22299
-
22300
-
22301
22287
  namespace duckdb {
22302
- //! Represents an expression list as generated by a VALUES statement
22303
- class ExpressionListRef : public TableRef {
22288
+ //! Represents a cross product
22289
+ class EmptyTableRef : public TableRef {
22304
22290
  public:
22305
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
22291
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
22306
22292
  }
22307
22293
 
22308
- //! Value list, only used for VALUES statement
22309
- vector<vector<unique_ptr<ParsedExpression>>> values;
22310
- //! Expected SQL types
22311
- vector<LogicalType> expected_types;
22312
- //! The set of expected names
22313
- vector<string> expected_names;
22314
-
22315
22294
  public:
22316
22295
  bool Equals(const TableRef *other_p) const override;
22317
22296
 
22318
22297
  unique_ptr<TableRef> Copy() override;
22319
22298
 
22320
- //! Serializes a blob into a ExpressionListRef
22321
- void Serialize(Serializer &serializer) override;
22322
- //! Deserializes a blob back into a ExpressionListRef
22323
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22299
+ //! Serializes a blob into a DummyTableRef
22300
+ void Serialize(FieldWriter &serializer) const override;
22301
+ //! Deserializes a blob back into a DummyTableRef
22302
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22324
22303
  };
22325
22304
  } // namespace duckdb
22305
+
22326
22306
  //===----------------------------------------------------------------------===//
22327
22307
  // DuckDB
22328
22308
  //
22329
- // duckdb/parser/tableref/emptytableref.hpp
22309
+ // duckdb/parser/tableref/expressionlistref.hpp
22330
22310
  //
22331
22311
  //
22332
22312
  //===----------------------------------------------------------------------===//
@@ -22335,24 +22315,37 @@ public:
22335
22315
 
22336
22316
 
22337
22317
 
22318
+
22319
+
22320
+
22338
22321
  namespace duckdb {
22339
- //! Represents a cross product
22340
- class EmptyTableRef : public TableRef {
22322
+ //! Represents an expression list as generated by a VALUES statement
22323
+ class ExpressionListRef : public TableRef {
22341
22324
  public:
22342
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
22325
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
22343
22326
  }
22344
22327
 
22328
+ //! Value list, only used for VALUES statement
22329
+ vector<vector<unique_ptr<ParsedExpression>>> values;
22330
+ //! Expected SQL types
22331
+ vector<LogicalType> expected_types;
22332
+ //! The set of expected names
22333
+ vector<string> expected_names;
22334
+
22345
22335
  public:
22346
22336
  bool Equals(const TableRef *other_p) const override;
22347
22337
 
22348
22338
  unique_ptr<TableRef> Copy() override;
22349
22339
 
22350
- //! Serializes a blob into a DummyTableRef
22351
- void Serialize(Serializer &serializer) override;
22352
- //! Deserializes a blob back into a DummyTableRef
22353
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22340
+ //! Serializes a blob into a ExpressionListRef
22341
+ void Serialize(FieldWriter &serializer) const override;
22342
+ //! Deserializes a blob back into a ExpressionListRef
22343
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22354
22344
  };
22355
22345
  } // namespace duckdb
22346
+
22347
+
22348
+
22356
22349
  //===----------------------------------------------------------------------===//
22357
22350
  // DuckDB
22358
22351
  //
@@ -22389,15 +22382,9 @@ public:
22389
22382
  unique_ptr<TableRef> Copy() override;
22390
22383
 
22391
22384
  //! Serializes a blob into a BaseTableRef
22392
- void Serialize(Serializer &serializer) override;
22385
+ void Serialize(FieldWriter &serializer) const override;
22393
22386
  //! Deserializes a blob back into a BaseTableRef
22394
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22387
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22395
22388
  };
22396
22389
  } // namespace duckdb
22397
22390
 
22398
-
22399
-
22400
-
22401
-
22402
-
22403
-