duckdb 0.3.2-dev1156.0 → 0.3.2-dev1199.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 "9707f53ce"
15
- #define DUCKDB_VERSION "v0.3.2-dev1156"
14
+ #define DUCKDB_SOURCE_ID "7b08af6b3"
15
+ #define DUCKDB_VERSION "v0.3.2-dev1199"
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
@@ -10680,6 +10694,9 @@ public:
10680
10694
  DUCKDB_API shared_ptr<Relation> Join(const shared_ptr<Relation> &other, const string &condition,
10681
10695
  JoinType type = JoinType::INNER);
10682
10696
 
10697
+ // CROSS PRODUCT operation
10698
+ DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other);
10699
+
10683
10700
  // SET operations
10684
10701
  DUCKDB_API shared_ptr<Relation> Union(const shared_ptr<Relation> &other);
10685
10702
  DUCKDB_API shared_ptr<Relation> Except(const shared_ptr<Relation> &other);
@@ -13533,6 +13550,8 @@ namespace duckdb {
13533
13550
 
13534
13551
  class Serializer;
13535
13552
  class Deserializer;
13553
+ class FieldWriter;
13554
+ class FieldReader;
13536
13555
 
13537
13556
  //===--------------------------------------------------------------------===//
13538
13557
  // Constraint Types
@@ -13555,13 +13574,14 @@ public:
13555
13574
 
13556
13575
  public:
13557
13576
  DUCKDB_API virtual string ToString() const = 0;
13558
- DUCKDB_API void Print();
13577
+ DUCKDB_API void Print() const;
13559
13578
 
13560
- DUCKDB_API virtual unique_ptr<Constraint> Copy() = 0;
13579
+ DUCKDB_API virtual unique_ptr<Constraint> Copy() const = 0;
13561
13580
  //! Serializes a Constraint to a stand-alone binary blob
13562
- DUCKDB_API virtual void Serialize(Serializer &serializer);
13563
- //! Deserializes a blob back into a Constraint, returns NULL if
13564
- //! 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
13565
13585
  DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
13566
13586
  };
13567
13587
  } // namespace duckdb
@@ -13832,10 +13852,8 @@ enum class AlterType : uint8_t {
13832
13852
  };
13833
13853
 
13834
13854
  struct AlterInfo : public ParseInfo {
13835
- AlterInfo(AlterType type, string schema, string name) : type(type), schema(move(schema)), name(move(name)) {
13836
- }
13837
- ~AlterInfo() override {
13838
- }
13855
+ AlterInfo(AlterType type, string schema, string name);
13856
+ ~AlterInfo() override;
13839
13857
 
13840
13858
  AlterType type;
13841
13859
  //! Schema name to alter
@@ -13844,9 +13862,10 @@ struct AlterInfo : public ParseInfo {
13844
13862
  string name;
13845
13863
 
13846
13864
  public:
13847
- virtual CatalogType GetCatalogType() = 0;
13865
+ virtual CatalogType GetCatalogType() const = 0;
13848
13866
  virtual unique_ptr<AlterInfo> Copy() const = 0;
13849
- virtual void Serialize(Serializer &serializer);
13867
+ void Serialize(Serializer &serializer) const;
13868
+ virtual void Serialize(FieldWriter &writer) const = 0;
13850
13869
  static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
13851
13870
  };
13852
13871
 
@@ -13855,10 +13874,7 @@ public:
13855
13874
  //===--------------------------------------------------------------------===//
13856
13875
  struct ChangeOwnershipInfo : public AlterInfo {
13857
13876
  ChangeOwnershipInfo(CatalogType entry_catalog_type, string entry_schema, string entry_name, string owner_schema,
13858
- string owner_name)
13859
- : AlterInfo(AlterType::CHANGE_OWNERSHIP, entry_schema, entry_name), entry_catalog_type(entry_catalog_type),
13860
- owner_schema(owner_schema), owner_name(owner_name) {
13861
- }
13877
+ string owner_name);
13862
13878
 
13863
13879
  // Catalog type refers to the entry type, since this struct is usually built from an
13864
13880
  // ALTER <TYPE> <schema>.<name> OWNED BY <owner_schema>.<owner_name> statement
@@ -13869,8 +13885,9 @@ struct ChangeOwnershipInfo : public AlterInfo {
13869
13885
  string owner_name;
13870
13886
 
13871
13887
  public:
13872
- CatalogType GetCatalogType() override;
13888
+ CatalogType GetCatalogType() const override;
13873
13889
  unique_ptr<AlterInfo> Copy() const override;
13890
+ void Serialize(FieldWriter &writer) const override;
13874
13891
  };
13875
13892
 
13876
13893
  //===--------------------------------------------------------------------===//
@@ -13887,32 +13904,24 @@ enum class AlterTableType : uint8_t {
13887
13904
  };
13888
13905
 
13889
13906
  struct AlterTableInfo : public AlterInfo {
13890
- AlterTableInfo(AlterTableType type, string schema, string table)
13891
- : AlterInfo(AlterType::ALTER_TABLE, schema, table), alter_table_type(type) {
13892
- }
13893
- ~AlterTableInfo() override {
13894
- }
13907
+ AlterTableInfo(AlterTableType type, string schema, string table);
13908
+ ~AlterTableInfo() override;
13895
13909
 
13896
13910
  AlterTableType alter_table_type;
13897
13911
 
13898
13912
  public:
13899
- CatalogType GetCatalogType() override {
13900
- return CatalogType::TABLE_ENTRY;
13901
- }
13902
- void Serialize(Serializer &serializer) override;
13903
- 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);
13904
13917
  };
13905
13918
 
13906
13919
  //===--------------------------------------------------------------------===//
13907
13920
  // RenameColumnInfo
13908
13921
  //===--------------------------------------------------------------------===//
13909
13922
  struct RenameColumnInfo : public AlterTableInfo {
13910
- RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p)
13911
- : AlterTableInfo(AlterTableType::RENAME_COLUMN, move(schema), move(table)), old_name(move(old_name_p)),
13912
- new_name(move(new_name_p)) {
13913
- }
13914
- ~RenameColumnInfo() override {
13915
- }
13923
+ RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p);
13924
+ ~RenameColumnInfo() override;
13916
13925
 
13917
13926
  //! Column old name
13918
13927
  string old_name;
@@ -13921,58 +13930,48 @@ struct RenameColumnInfo : public AlterTableInfo {
13921
13930
 
13922
13931
  public:
13923
13932
  unique_ptr<AlterInfo> Copy() const override;
13924
- void Serialize(Serializer &serializer) override;
13925
- 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);
13926
13935
  };
13927
13936
 
13928
13937
  //===--------------------------------------------------------------------===//
13929
13938
  // RenameTableInfo
13930
13939
  //===--------------------------------------------------------------------===//
13931
13940
  struct RenameTableInfo : public AlterTableInfo {
13932
- RenameTableInfo(string schema, string table, string new_name)
13933
- : AlterTableInfo(AlterTableType::RENAME_TABLE, schema, table), new_table_name(new_name) {
13934
- }
13935
- ~RenameTableInfo() override {
13936
- }
13941
+ RenameTableInfo(string schema, string table, string new_name);
13942
+ ~RenameTableInfo() override;
13937
13943
 
13938
13944
  //! Relation new name
13939
13945
  string new_table_name;
13940
13946
 
13941
13947
  public:
13942
13948
  unique_ptr<AlterInfo> Copy() const override;
13943
- void Serialize(Serializer &serializer) override;
13944
- 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);
13945
13951
  };
13946
13952
 
13947
13953
  //===--------------------------------------------------------------------===//
13948
13954
  // AddColumnInfo
13949
13955
  //===--------------------------------------------------------------------===//
13950
13956
  struct AddColumnInfo : public AlterTableInfo {
13951
- AddColumnInfo(string schema, string table, ColumnDefinition new_column)
13952
- : AlterTableInfo(AlterTableType::ADD_COLUMN, schema, table), new_column(move(new_column)) {
13953
- }
13954
- ~AddColumnInfo() override {
13955
- }
13957
+ AddColumnInfo(string schema, string table, ColumnDefinition new_column);
13958
+ ~AddColumnInfo() override;
13956
13959
 
13957
13960
  //! New column
13958
13961
  ColumnDefinition new_column;
13959
13962
 
13960
13963
  public:
13961
13964
  unique_ptr<AlterInfo> Copy() const override;
13962
- void Serialize(Serializer &serializer) override;
13963
- 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);
13964
13967
  };
13965
13968
 
13966
13969
  //===--------------------------------------------------------------------===//
13967
13970
  // RemoveColumnInfo
13968
13971
  //===--------------------------------------------------------------------===//
13969
13972
  struct RemoveColumnInfo : public AlterTableInfo {
13970
- RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists)
13971
- : AlterTableInfo(AlterTableType::REMOVE_COLUMN, schema, table), removed_column(move(removed_column)),
13972
- if_exists(if_exists) {
13973
- }
13974
- ~RemoveColumnInfo() override {
13975
- }
13973
+ RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists);
13974
+ ~RemoveColumnInfo() override;
13976
13975
 
13977
13976
  //! The column to remove
13978
13977
  string removed_column;
@@ -13981,8 +13980,8 @@ struct RemoveColumnInfo : public AlterTableInfo {
13981
13980
 
13982
13981
  public:
13983
13982
  unique_ptr<AlterInfo> Copy() const override;
13984
- void Serialize(Serializer &serializer) override;
13985
- 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);
13986
13985
  };
13987
13986
 
13988
13987
  //===--------------------------------------------------------------------===//
@@ -13990,12 +13989,8 @@ public:
13990
13989
  //===--------------------------------------------------------------------===//
13991
13990
  struct ChangeColumnTypeInfo : public AlterTableInfo {
13992
13991
  ChangeColumnTypeInfo(string schema, string table, string column_name, LogicalType target_type,
13993
- unique_ptr<ParsedExpression> expression)
13994
- : AlterTableInfo(AlterTableType::ALTER_COLUMN_TYPE, schema, table), column_name(move(column_name)),
13995
- target_type(move(target_type)), expression(move(expression)) {
13996
- }
13997
- ~ChangeColumnTypeInfo() override {
13998
- }
13992
+ unique_ptr<ParsedExpression> expression);
13993
+ ~ChangeColumnTypeInfo() override;
13999
13994
 
14000
13995
  //! The column name to alter
14001
13996
  string column_name;
@@ -14006,20 +14001,16 @@ struct ChangeColumnTypeInfo : public AlterTableInfo {
14006
14001
 
14007
14002
  public:
14008
14003
  unique_ptr<AlterInfo> Copy() const override;
14009
- void Serialize(Serializer &serializer) override;
14010
- 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);
14011
14006
  };
14012
14007
 
14013
14008
  //===--------------------------------------------------------------------===//
14014
14009
  // SetDefaultInfo
14015
14010
  //===--------------------------------------------------------------------===//
14016
14011
  struct SetDefaultInfo : public AlterTableInfo {
14017
- SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default)
14018
- : AlterTableInfo(AlterTableType::SET_DEFAULT, schema, table), column_name(move(column_name)),
14019
- expression(move(new_default)) {
14020
- }
14021
- ~SetDefaultInfo() override {
14022
- }
14012
+ SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default);
14013
+ ~SetDefaultInfo() override;
14023
14014
 
14024
14015
  //! The column name to alter
14025
14016
  string column_name;
@@ -14028,8 +14019,8 @@ struct SetDefaultInfo : public AlterTableInfo {
14028
14019
 
14029
14020
  public:
14030
14021
  unique_ptr<AlterInfo> Copy() const override;
14031
- void Serialize(Serializer &serializer) override;
14032
- 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);
14033
14024
  };
14034
14025
 
14035
14026
  //===--------------------------------------------------------------------===//
@@ -14038,39 +14029,32 @@ public:
14038
14029
  enum class AlterViewType : uint8_t { INVALID = 0, RENAME_VIEW = 1 };
14039
14030
 
14040
14031
  struct AlterViewInfo : public AlterInfo {
14041
- AlterViewInfo(AlterViewType type, string schema, string view)
14042
- : AlterInfo(AlterType::ALTER_VIEW, schema, view), alter_view_type(type) {
14043
- }
14044
- ~AlterViewInfo() override {
14045
- }
14032
+ AlterViewInfo(AlterViewType type, string schema, string view);
14033
+ ~AlterViewInfo() override;
14046
14034
 
14047
14035
  AlterViewType alter_view_type;
14048
14036
 
14049
14037
  public:
14050
- CatalogType GetCatalogType() override {
14051
- return CatalogType::VIEW_ENTRY;
14052
- }
14053
- void Serialize(Serializer &serializer) override;
14054
- 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);
14055
14042
  };
14056
14043
 
14057
14044
  //===--------------------------------------------------------------------===//
14058
14045
  // RenameViewInfo
14059
14046
  //===--------------------------------------------------------------------===//
14060
14047
  struct RenameViewInfo : public AlterViewInfo {
14061
- RenameViewInfo(string schema, string view, string new_name)
14062
- : AlterViewInfo(AlterViewType::RENAME_VIEW, schema, view), new_view_name(new_name) {
14063
- }
14064
- ~RenameViewInfo() override {
14065
- }
14048
+ RenameViewInfo(string schema, string view, string new_name);
14049
+ ~RenameViewInfo() override;
14066
14050
 
14067
14051
  //! Relation new name
14068
14052
  string new_view_name;
14069
14053
 
14070
14054
  public:
14071
14055
  unique_ptr<AlterInfo> Copy() const override;
14072
- void Serialize(Serializer &serializer) override;
14073
- 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);
14074
14058
  };
14075
14059
 
14076
14060
  } // namespace duckdb
@@ -15156,8 +15140,8 @@ public:
15156
15140
 
15157
15141
  unique_ptr<ParsedExpression> Copy() const override;
15158
15142
 
15159
- void Serialize(Serializer &serializer) override;
15160
- 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);
15161
15145
  };
15162
15146
  } // namespace duckdb
15163
15147
 
@@ -15391,6 +15375,10 @@ public:
15391
15375
  unique_ptr<ParsedExpression> Copy() const override {
15392
15376
  throw SerializationException("Cannot copy or serialize bound expression");
15393
15377
  }
15378
+
15379
+ void Serialize(FieldWriter &writer) const override {
15380
+ throw SerializationException("Cannot copy or serialize bound expression");
15381
+ }
15394
15382
  };
15395
15383
 
15396
15384
  } // namespace duckdb
@@ -16170,9 +16158,11 @@ public:
16170
16158
  virtual unique_ptr<TableRef> Copy() = 0;
16171
16159
 
16172
16160
  //! Serializes a TableRef to a stand-alone binary blob
16173
- 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;
16174
16164
  //! Deserializes a blob back into a TableRef
16175
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
16165
+ DUCKDB_API static unique_ptr<TableRef> Deserialize(Deserializer &source);
16176
16166
 
16177
16167
  //! Copy the properties of this table ref to the target
16178
16168
  void CopyProperties(TableRef &target) const;
@@ -16197,7 +16187,7 @@ public:
16197
16187
  //! Create a copy of this SelectStatement
16198
16188
  unique_ptr<SQLStatement> Copy() const override;
16199
16189
  //! Serializes a SelectStatement to a stand-alone binary blob
16200
- void Serialize(Serializer &serializer);
16190
+ void Serialize(Serializer &serializer) const;
16201
16191
  //! Deserializes a blob back into a SelectStatement, returns nullptr if
16202
16192
  //! deserialization is not possible
16203
16193
  static unique_ptr<SelectStatement> Deserialize(Deserializer &source);
@@ -16248,12 +16238,13 @@ public:
16248
16238
  virtual bool Equals(const QueryNode *other) const;
16249
16239
 
16250
16240
  //! Create a copy of this QueryNode
16251
- virtual unique_ptr<QueryNode> Copy() = 0;
16241
+ virtual unique_ptr<QueryNode> Copy() const = 0;
16252
16242
  //! Serializes a QueryNode to a stand-alone binary blob
16253
- virtual void Serialize(Serializer &serializer);
16254
- //! Deserializes a blob back into a QueryNode, returns nullptr if
16255
- //! deserialization is not possible
16256
- 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);
16257
16248
 
16258
16249
  protected:
16259
16250
  //! Copy base QueryNode properties from another expression to this one,
@@ -16448,8 +16439,8 @@ public:
16448
16439
 
16449
16440
  unique_ptr<ParsedExpression> Copy() const override;
16450
16441
 
16451
- void Serialize(Serializer &serializer) override;
16452
- 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);
16453
16444
  };
16454
16445
  } // namespace duckdb
16455
16446
 
@@ -18605,12 +18596,12 @@ public:
18605
18596
  public:
18606
18597
  DUCKDB_API string ToString() const override;
18607
18598
 
18608
- DUCKDB_API unique_ptr<Constraint> Copy() override;
18599
+ DUCKDB_API unique_ptr<Constraint> Copy() const override;
18609
18600
 
18610
18601
  //! Serialize to a stand-alone binary blob
18611
- DUCKDB_API void Serialize(Serializer &serializer) override;
18602
+ DUCKDB_API void Serialize(FieldWriter &writer) const override;
18612
18603
  //! Deserializes a NotNullConstraint
18613
- DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
18604
+ DUCKDB_API static unique_ptr<Constraint> Deserialize(FieldReader &source);
18614
18605
  };
18615
18606
 
18616
18607
  } // namespace duckdb
@@ -20164,17 +20155,17 @@ public:
20164
20155
  public:
20165
20156
  void Merge(const BaseStatistics &other) override;
20166
20157
 
20167
- bool IsConstant() override;
20158
+ bool IsConstant() const override;
20168
20159
 
20169
- unique_ptr<BaseStatistics> Copy() override;
20170
- void Serialize(Serializer &serializer) override;
20171
- static unique_ptr<BaseStatistics> Deserialize(Deserializer &source);
20172
- 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;
20173
20164
 
20174
20165
  static unique_ptr<BaseStatistics> Combine(const unique_ptr<BaseStatistics> &lstats,
20175
20166
  const unique_ptr<BaseStatistics> &rstats);
20176
20167
 
20177
- string ToString() override;
20168
+ string ToString() const override;
20178
20169
  };
20179
20170
 
20180
20171
  } // namespace duckdb
@@ -20204,14 +20195,14 @@ public:
20204
20195
  void Update(const string_t &value);
20205
20196
  void Merge(const BaseStatistics &other) override;
20206
20197
 
20207
- unique_ptr<BaseStatistics> Copy() override;
20208
- void Serialize(Serializer &serializer) override;
20209
- static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
20210
- 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;
20211
20202
 
20212
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value);
20203
+ FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value) const;
20213
20204
 
20214
- string ToString() override;
20205
+ string ToString() const override;
20215
20206
  };
20216
20207
 
20217
20208
  } // namespace duckdb
@@ -20292,20 +20283,20 @@ public:
20292
20283
  public:
20293
20284
  void Merge(const BaseStatistics &other) override;
20294
20285
 
20295
- bool IsConstant() override;
20286
+ bool IsConstant() const override;
20296
20287
 
20297
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant);
20288
+ FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
20298
20289
 
20299
- unique_ptr<BaseStatistics> Copy() override;
20300
- void Serialize(Serializer &serializer) override;
20301
- static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
20302
- 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;
20303
20294
 
20304
- string ToString() override;
20295
+ string ToString() const override;
20305
20296
 
20306
20297
  private:
20307
20298
  template <class T>
20308
- void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count);
20299
+ void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count) const;
20309
20300
 
20310
20301
  public:
20311
20302
  template <class T>
@@ -21009,7 +21000,7 @@ private:
21009
21000
  //===----------------------------------------------------------------------===//
21010
21001
  // DuckDB
21011
21002
  //
21012
- // duckdb/parser/expression/star_expression.hpp
21003
+ // duckdb/parser/expression/comparison_expression.hpp
21013
21004
  //
21014
21005
  //
21015
21006
  //===----------------------------------------------------------------------===//
@@ -21018,36 +21009,31 @@ private:
21018
21009
 
21019
21010
 
21020
21011
 
21021
-
21022
21012
  namespace duckdb {
21023
-
21024
- //! Represents a * expression in the SELECT clause
21025
- 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 {
21026
21016
  public:
21027
- StarExpression(string relation_name = string());
21017
+ ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21028
21018
 
21029
- //! The relation name in case of tbl.*, or empty if this is a normal *
21030
- string relation_name;
21031
- //! List of columns to exclude from the STAR expression
21032
- case_insensitive_set_t exclude_list;
21033
- //! List of columns to replace with another expression
21034
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
21019
+ unique_ptr<ParsedExpression> left;
21020
+ unique_ptr<ParsedExpression> right;
21035
21021
 
21036
21022
  public:
21037
21023
  string ToString() const override;
21038
21024
 
21039
- static bool Equals(const StarExpression *a, const StarExpression *b);
21025
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
21040
21026
 
21041
21027
  unique_ptr<ParsedExpression> Copy() const override;
21042
21028
 
21043
- void Serialize(Serializer &serializer) override;
21044
- 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);
21045
21031
  };
21046
21032
  } // namespace duckdb
21047
21033
  //===----------------------------------------------------------------------===//
21048
21034
  // DuckDB
21049
21035
  //
21050
- // duckdb/parser/expression/conjunction_expression.hpp
21036
+ // duckdb/parser/expression/constant_expression.hpp
21051
21037
  //
21052
21038
  //
21053
21039
  //===----------------------------------------------------------------------===//
@@ -21059,32 +21045,31 @@ public:
21059
21045
 
21060
21046
  namespace duckdb {
21061
21047
 
21062
- //! Represents a conjunction (AND/OR)
21063
- class ConjunctionExpression : public ParsedExpression {
21048
+ //! ConstantExpression represents a constant value in the query
21049
+ class ConstantExpression : public ParsedExpression {
21064
21050
  public:
21065
- explicit ConjunctionExpression(ExpressionType type);
21066
- ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21067
- ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21051
+ explicit ConstantExpression(Value val);
21068
21052
 
21069
- vector<unique_ptr<ParsedExpression>> children;
21053
+ //! The constant value referenced
21054
+ Value value;
21070
21055
 
21071
21056
  public:
21072
- void AddExpression(unique_ptr<ParsedExpression> expr);
21073
-
21074
21057
  string ToString() const override;
21075
21058
 
21076
- 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;
21077
21061
 
21078
21062
  unique_ptr<ParsedExpression> Copy() const override;
21079
21063
 
21080
- void Serialize(Serializer &serializer) override;
21081
- 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);
21082
21066
  };
21067
+
21083
21068
  } // namespace duckdb
21084
21069
  //===----------------------------------------------------------------------===//
21085
21070
  // DuckDB
21086
21071
  //
21087
- // duckdb/parser/expression/collate_expression.hpp
21072
+ // duckdb/parser/expression/operator_expression.hpp
21088
21073
  //
21089
21074
  //
21090
21075
  //===----------------------------------------------------------------------===//
@@ -21093,27 +21078,26 @@ public:
21093
21078
 
21094
21079
 
21095
21080
 
21096
- namespace duckdb {
21097
21081
 
21098
- //! CollateExpression represents a COLLATE statement
21099
- class CollateExpression : public ParsedExpression {
21082
+ namespace duckdb {
21083
+ //! Represents a built-in operator expression
21084
+ class OperatorExpression : public ParsedExpression {
21100
21085
  public:
21101
- 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);
21102
21089
 
21103
- //! The child of the cast expression
21104
- unique_ptr<ParsedExpression> child;
21105
- //! The collation clause
21106
- string collation;
21090
+ vector<unique_ptr<ParsedExpression>> children;
21107
21091
 
21108
21092
  public:
21109
21093
  string ToString() const override;
21110
21094
 
21111
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
21095
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
21112
21096
 
21113
21097
  unique_ptr<ParsedExpression> Copy() const override;
21114
21098
 
21115
- void Serialize(Serializer &serializer) override;
21116
- 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);
21117
21101
  };
21118
21102
  } // namespace duckdb
21119
21103
  //===----------------------------------------------------------------------===//
@@ -21161,14 +21145,14 @@ public:
21161
21145
 
21162
21146
  unique_ptr<ParsedExpression> Copy() const override;
21163
21147
 
21164
- void Serialize(Serializer &serializer) override;
21165
- 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);
21166
21150
  };
21167
21151
  } // namespace duckdb
21168
21152
  //===----------------------------------------------------------------------===//
21169
21153
  // DuckDB
21170
21154
  //
21171
- // duckdb/parser/expression/constant_expression.hpp
21155
+ // duckdb/parser/expression/conjunction_expression.hpp
21172
21156
  //
21173
21157
  //
21174
21158
  //===----------------------------------------------------------------------===//
@@ -21180,31 +21164,32 @@ public:
21180
21164
 
21181
21165
  namespace duckdb {
21182
21166
 
21183
- //! ConstantExpression represents a constant value in the query
21184
- class ConstantExpression : public ParsedExpression {
21167
+ //! Represents a conjunction (AND/OR)
21168
+ class ConjunctionExpression : public ParsedExpression {
21185
21169
  public:
21186
- 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);
21187
21173
 
21188
- //! The constant value referenced
21189
- Value value;
21174
+ vector<unique_ptr<ParsedExpression>> children;
21190
21175
 
21191
21176
  public:
21177
+ void AddExpression(unique_ptr<ParsedExpression> expr);
21178
+
21192
21179
  string ToString() const override;
21193
21180
 
21194
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
21195
- hash_t Hash() const override;
21181
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
21196
21182
 
21197
21183
  unique_ptr<ParsedExpression> Copy() const override;
21198
21184
 
21199
- void Serialize(Serializer &serializer) override;
21200
- 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);
21201
21187
  };
21202
-
21203
21188
  } // namespace duckdb
21204
21189
  //===----------------------------------------------------------------------===//
21205
21190
  // DuckDB
21206
21191
  //
21207
- // duckdb/parser/expression/lambda_expression.hpp
21192
+ // duckdb/parser/expression/between_expression.hpp
21208
21193
  //
21209
21194
  //
21210
21195
  //===----------------------------------------------------------------------===//
@@ -21213,35 +21198,32 @@ public:
21213
21198
 
21214
21199
 
21215
21200
 
21216
-
21217
21201
  namespace duckdb {
21218
21202
 
21219
- //! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
21220
- //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
21221
- class LambdaExpression : public ParsedExpression {
21203
+ class BetweenExpression : public ParsedExpression {
21222
21204
  public:
21223
- LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21205
+ BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
21206
+ unique_ptr<ParsedExpression> upper);
21224
21207
 
21225
- vector<string> parameters;
21226
- unique_ptr<ParsedExpression> expression;
21208
+ unique_ptr<ParsedExpression> input;
21209
+ unique_ptr<ParsedExpression> lower;
21210
+ unique_ptr<ParsedExpression> upper;
21227
21211
 
21228
21212
  public:
21229
21213
  string ToString() const override;
21230
21214
 
21231
- static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
21232
- hash_t Hash() const override;
21215
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
21233
21216
 
21234
21217
  unique_ptr<ParsedExpression> Copy() const override;
21235
21218
 
21236
- void Serialize(Serializer &serializer) override;
21237
- 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);
21238
21221
  };
21239
-
21240
21222
  } // namespace duckdb
21241
21223
  //===----------------------------------------------------------------------===//
21242
21224
  // DuckDB
21243
21225
  //
21244
- // duckdb/parser/expression/positional_reference_expression.hpp
21226
+ // duckdb/parser/expression/parameter_expression.hpp
21245
21227
  //
21246
21228
  //
21247
21229
  //===----------------------------------------------------------------------===//
@@ -21251,25 +21233,65 @@ public:
21251
21233
 
21252
21234
 
21253
21235
  namespace duckdb {
21254
- class PositionalReferenceExpression : public ParsedExpression {
21236
+ class ParameterExpression : public ParsedExpression {
21255
21237
  public:
21256
- PositionalReferenceExpression(idx_t index);
21238
+ ParameterExpression();
21257
21239
 
21258
- idx_t index;
21240
+ idx_t parameter_nr;
21259
21241
 
21260
21242
  public:
21261
21243
  bool IsScalar() const override {
21262
- return false;
21244
+ return true;
21245
+ }
21246
+ bool HasParameter() const override {
21247
+ return true;
21263
21248
  }
21264
21249
 
21265
21250
  string ToString() const override;
21266
21251
 
21267
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
21268
21252
  unique_ptr<ParsedExpression> Copy() const override;
21269
21253
  hash_t Hash() const override;
21270
21254
 
21271
- void Serialize(Serializer &serializer) override;
21272
- 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);
21273
21295
  };
21274
21296
  } // namespace duckdb
21275
21297
  //===----------------------------------------------------------------------===//
@@ -21307,14 +21329,14 @@ public:
21307
21329
 
21308
21330
  unique_ptr<ParsedExpression> Copy() const override;
21309
21331
 
21310
- void Serialize(Serializer &serializer) override;
21311
- 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);
21312
21334
  };
21313
21335
  } // namespace duckdb
21314
21336
  //===----------------------------------------------------------------------===//
21315
21337
  // DuckDB
21316
21338
  //
21317
- // duckdb/parser/expression/between_expression.hpp
21339
+ // duckdb/parser/expression/cast_expression.hpp
21318
21340
  //
21319
21341
  //
21320
21342
  //===----------------------------------------------------------------------===//
@@ -21323,32 +21345,36 @@ public:
21323
21345
 
21324
21346
 
21325
21347
 
21348
+
21326
21349
  namespace duckdb {
21327
21350
 
21328
- class BetweenExpression : public ParsedExpression {
21351
+ //! CastExpression represents a type cast from one SQL type to another SQL type
21352
+ class CastExpression : public ParsedExpression {
21329
21353
  public:
21330
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
21331
- unique_ptr<ParsedExpression> upper);
21354
+ CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
21332
21355
 
21333
- unique_ptr<ParsedExpression> input;
21334
- unique_ptr<ParsedExpression> lower;
21335
- 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;
21336
21362
 
21337
21363
  public:
21338
21364
  string ToString() const override;
21339
21365
 
21340
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
21366
+ static bool Equals(const CastExpression *a, const CastExpression *b);
21341
21367
 
21342
21368
  unique_ptr<ParsedExpression> Copy() const override;
21343
21369
 
21344
- void Serialize(Serializer &serializer) override;
21345
- 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);
21346
21372
  };
21347
21373
  } // namespace duckdb
21348
21374
  //===----------------------------------------------------------------------===//
21349
21375
  // DuckDB
21350
21376
  //
21351
- // duckdb/parser/expression/comparison_expression.hpp
21377
+ // duckdb/parser/expression/positional_reference_expression.hpp
21352
21378
  //
21353
21379
  //
21354
21380
  //===----------------------------------------------------------------------===//
@@ -21358,30 +21384,31 @@ public:
21358
21384
 
21359
21385
 
21360
21386
  namespace duckdb {
21361
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
21362
- //! and has two children.
21363
- class ComparisonExpression : public ParsedExpression {
21387
+ class PositionalReferenceExpression : public ParsedExpression {
21364
21388
  public:
21365
- ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21389
+ PositionalReferenceExpression(idx_t index);
21366
21390
 
21367
- unique_ptr<ParsedExpression> left;
21368
- unique_ptr<ParsedExpression> right;
21391
+ idx_t index;
21369
21392
 
21370
21393
  public:
21371
- string ToString() const override;
21394
+ bool IsScalar() const override {
21395
+ return false;
21396
+ }
21372
21397
 
21373
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
21398
+ string ToString() const override;
21374
21399
 
21400
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
21375
21401
  unique_ptr<ParsedExpression> Copy() const override;
21402
+ hash_t Hash() const override;
21376
21403
 
21377
- void Serialize(Serializer &serializer) override;
21378
- 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);
21379
21406
  };
21380
21407
  } // namespace duckdb
21381
21408
  //===----------------------------------------------------------------------===//
21382
21409
  // DuckDB
21383
21410
  //
21384
- // duckdb/parser/expression/cast_expression.hpp
21411
+ // duckdb/parser/expression/lambda_expression.hpp
21385
21412
  //
21386
21413
  //
21387
21414
  //===----------------------------------------------------------------------===//
@@ -21393,33 +21420,67 @@ public:
21393
21420
 
21394
21421
  namespace duckdb {
21395
21422
 
21396
- //! CastExpression represents a type cast from one SQL type to another SQL type
21397
- 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 {
21398
21426
  public:
21399
- CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
21427
+ LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21400
21428
 
21401
- //! The child of the cast expression
21402
- unique_ptr<ParsedExpression> child;
21403
- //! The type to cast to
21404
- LogicalType cast_type;
21405
- //! Whether or not this is a try_cast expression
21406
- bool try_cast;
21429
+ vector<string> parameters;
21430
+ unique_ptr<ParsedExpression> expression;
21407
21431
 
21408
21432
  public:
21409
21433
  string ToString() const override;
21410
21434
 
21411
- 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;
21412
21437
 
21413
21438
  unique_ptr<ParsedExpression> Copy() const override;
21414
21439
 
21415
- void Serialize(Serializer &serializer) override;
21416
- 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);
21417
21442
  };
21443
+
21418
21444
  } // namespace duckdb
21419
21445
 
21420
21446
 
21421
21447
 
21422
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
21423
21484
 
21424
21485
 
21425
21486
 
@@ -21452,7 +21513,8 @@ public:
21452
21513
 
21453
21514
  unique_ptr<ParsedExpression> Copy() const override;
21454
21515
 
21455
- 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);
21456
21518
  };
21457
21519
  } // namespace duckdb
21458
21520
 
@@ -21504,85 +21566,13 @@ public:
21504
21566
  static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
21505
21567
  hash_t Hash() const override;
21506
21568
 
21507
- //! Serializes a FunctionExpression to a stand-alone binary blob
21508
- void Serialize(Serializer &serializer) override;
21509
- //! Deserializes a blob back into an FunctionExpression
21510
- 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);
21511
21571
  };
21512
21572
  } // namespace duckdb
21513
21573
 
21514
21574
 
21515
- //===----------------------------------------------------------------------===//
21516
- // DuckDB
21517
- //
21518
- // duckdb/parser/expression/operator_expression.hpp
21519
- //
21520
- //
21521
- //===----------------------------------------------------------------------===//
21522
-
21523
-
21524
-
21525
-
21526
-
21527
-
21528
- namespace duckdb {
21529
- //! Represents a built-in operator expression
21530
- class OperatorExpression : public ParsedExpression {
21531
- public:
21532
- explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
21533
- unique_ptr<ParsedExpression> right = nullptr);
21534
- OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21535
-
21536
- vector<unique_ptr<ParsedExpression>> children;
21537
-
21538
- public:
21539
- string ToString() const override;
21540
-
21541
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
21542
-
21543
- unique_ptr<ParsedExpression> Copy() const override;
21544
-
21545
- void Serialize(Serializer &serializer) override;
21546
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21547
- };
21548
- } // namespace duckdb
21549
-
21550
- //===----------------------------------------------------------------------===//
21551
- // DuckDB
21552
- //
21553
- // duckdb/parser/expression/parameter_expression.hpp
21554
- //
21555
- //
21556
- //===----------------------------------------------------------------------===//
21557
-
21558
-
21559
-
21560
-
21561
-
21562
- namespace duckdb {
21563
- class ParameterExpression : public ParsedExpression {
21564
- public:
21565
- ParameterExpression();
21566
-
21567
- idx_t parameter_nr;
21568
-
21569
- public:
21570
- bool IsScalar() const override {
21571
- return true;
21572
- }
21573
- bool HasParameter() const override {
21574
- return true;
21575
- }
21576
-
21577
- string ToString() const override;
21578
-
21579
- unique_ptr<ParsedExpression> Copy() const override;
21580
- hash_t Hash() const override;
21581
21575
 
21582
- void Serialize(Serializer &serializer) override;
21583
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
21584
- };
21585
- } // namespace duckdb
21586
21576
 
21587
21577
 
21588
21578
 
@@ -21591,7 +21581,7 @@ public:
21591
21581
  //===----------------------------------------------------------------------===//
21592
21582
  // DuckDB
21593
21583
  //
21594
- // duckdb/parser/parsed_data/create_type_info.hpp
21584
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
21595
21585
  //
21596
21586
  //
21597
21587
  //===----------------------------------------------------------------------===//
@@ -21601,26 +21591,28 @@ public:
21601
21591
 
21602
21592
 
21603
21593
 
21604
-
21605
-
21606
21594
  namespace duckdb {
21607
21595
 
21608
- struct CreateTypeInfo : public CreateInfo {
21609
-
21610
- 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
+ }
21611
21608
  }
21612
21609
 
21613
- //! Name of the Type
21614
- string name;
21615
- //! Shared Pointer of Logical Type
21616
- unique_ptr<LogicalType> type;
21610
+ vector<PragmaFunction> functions;
21617
21611
 
21618
21612
  public:
21619
21613
  unique_ptr<CreateInfo> Copy() const override {
21620
- auto result = make_unique<CreateTypeInfo>();
21614
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
21621
21615
  CopyProperties(*result);
21622
- result->name = name;
21623
- result->type = make_unique<LogicalType>(*type);
21624
21616
  return move(result);
21625
21617
  }
21626
21618
  };
@@ -21629,7 +21621,7 @@ public:
21629
21621
  //===----------------------------------------------------------------------===//
21630
21622
  // DuckDB
21631
21623
  //
21632
- // duckdb/parser/parsed_data/vacuum_info.hpp
21624
+ // duckdb/parser/parsed_data/create_collation_info.hpp
21633
21625
  //
21634
21626
  //
21635
21627
  //===----------------------------------------------------------------------===//
@@ -21638,20 +21630,32 @@ public:
21638
21630
 
21639
21631
 
21640
21632
 
21633
+
21641
21634
  namespace duckdb {
21642
21635
 
21643
- 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
+ }
21644
21642
 
21645
- struct LoadInfo : public ParseInfo {
21646
- std::string filename;
21647
- 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;
21648
21653
 
21649
21654
  public:
21650
- unique_ptr<LoadInfo> Copy() const {
21651
- auto result = make_unique<LoadInfo>();
21652
- result->filename = filename;
21653
- result->load_type = load_type;
21654
- 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);
21655
21659
  }
21656
21660
  };
21657
21661
 
@@ -21659,57 +21663,7 @@ public:
21659
21663
  //===----------------------------------------------------------------------===//
21660
21664
  // DuckDB
21661
21665
  //
21662
- // duckdb/parser/parsed_data/export_table_data.hpp
21663
- //
21664
- //
21665
- //===----------------------------------------------------------------------===//
21666
-
21667
-
21668
-
21669
-
21670
-
21671
-
21672
- namespace duckdb {
21673
-
21674
- struct ExportedTableData {
21675
- //! Name of the exported table
21676
- string table_name;
21677
-
21678
- //! Name of the schema
21679
- string schema_name;
21680
-
21681
- //! Path to be exported
21682
- string file_path;
21683
- };
21684
-
21685
- struct BoundExportData : public ParseInfo {
21686
- unordered_map<TableCatalogEntry *, ExportedTableData> data;
21687
- };
21688
-
21689
- } // namespace duckdb
21690
- //===----------------------------------------------------------------------===//
21691
- // DuckDB
21692
- //
21693
- // duckdb/parser/parsed_data/vacuum_info.hpp
21694
- //
21695
- //
21696
- //===----------------------------------------------------------------------===//
21697
-
21698
-
21699
-
21700
-
21701
-
21702
- namespace duckdb {
21703
-
21704
- struct VacuumInfo : public ParseInfo {
21705
- // nothing for now
21706
- };
21707
-
21708
- } // namespace duckdb
21709
- //===----------------------------------------------------------------------===//
21710
- // DuckDB
21711
- //
21712
- // duckdb/parser/parsed_data/create_collation_info.hpp
21666
+ // duckdb/parser/parsed_data/create_schema_info.hpp
21713
21667
  //
21714
21668
  //
21715
21669
  //===----------------------------------------------------------------------===//
@@ -21718,30 +21672,15 @@ struct VacuumInfo : public ParseInfo {
21718
21672
 
21719
21673
 
21720
21674
 
21721
-
21722
21675
  namespace duckdb {
21723
21676
 
21724
- struct CreateCollationInfo : public CreateInfo {
21725
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
21726
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
21727
- not_required_for_equality(not_required_for_equality_p) {
21728
- this->name = move(name_p);
21677
+ struct CreateSchemaInfo : public CreateInfo {
21678
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
21729
21679
  }
21730
21680
 
21731
- //! The name of the collation
21732
- string name;
21733
- //! The collation function to push in case collation is required
21734
- ScalarFunction function;
21735
- //! Whether or not the collation can be combined with other collations.
21736
- bool combinable;
21737
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
21738
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
21739
- //! speeds up processing.
21740
- bool not_required_for_equality;
21741
-
21742
21681
  public:
21743
21682
  unique_ptr<CreateInfo> Copy() const override {
21744
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
21683
+ auto result = make_unique<CreateSchemaInfo>();
21745
21684
  CopyProperties(*result);
21746
21685
  return move(result);
21747
21686
  }
@@ -21795,7 +21734,32 @@ public:
21795
21734
  //===----------------------------------------------------------------------===//
21796
21735
  // DuckDB
21797
21736
  //
21798
- // 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
21799
21763
  //
21800
21764
  //
21801
21765
  //===----------------------------------------------------------------------===//
@@ -21807,29 +21771,27 @@ public:
21807
21771
 
21808
21772
  namespace duckdb {
21809
21773
 
21810
- struct CreateViewInfo : public CreateInfo {
21811
- 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));
21812
21779
  }
21813
- CreateViewInfo(string schema, string view_name)
21814
- : 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
+ }
21815
21787
  }
21816
21788
 
21817
- //! Table name to insert to
21818
- string view_name;
21819
- //! Aliases of the view
21820
- vector<string> aliases;
21821
- //! Return types
21822
- vector<LogicalType> types;
21823
- //! The SelectStatement of the view
21824
- unique_ptr<SelectStatement> query;
21789
+ AggregateFunctionSet functions;
21825
21790
 
21826
21791
  public:
21827
21792
  unique_ptr<CreateInfo> Copy() const override {
21828
- auto result = make_unique<CreateViewInfo>(schema, view_name);
21793
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
21829
21794
  CopyProperties(*result);
21830
- result->aliases = aliases;
21831
- result->types = types;
21832
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
21833
21795
  return move(result);
21834
21796
  }
21835
21797
  };
@@ -21882,9 +21844,9 @@ public:
21882
21844
  unique_ptr<TableRef> Copy() override;
21883
21845
 
21884
21846
  //! Serializes a blob into a BaseTableRef
21885
- void Serialize(Serializer &serializer) override;
21847
+ void Serialize(FieldWriter &serializer) const override;
21886
21848
  //! Deserializes a blob back into a BaseTableRef
21887
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
21849
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
21888
21850
  };
21889
21851
  } // namespace duckdb
21890
21852
 
@@ -21902,110 +21864,22 @@ struct CreateIndexInfo : public CreateInfo {
21902
21864
  string index_name;
21903
21865
  //! If it is an unique index
21904
21866
  bool unique = false;
21905
- //! The table to create the index on
21906
- unique_ptr<BaseTableRef> table;
21907
- //! Set of expressions to index by
21908
- vector<unique_ptr<ParsedExpression>> expressions;
21909
-
21910
- public:
21911
- unique_ptr<CreateInfo> Copy() const override {
21912
- auto result = make_unique<CreateIndexInfo>();
21913
- CopyProperties(*result);
21914
- result->index_type = index_type;
21915
- result->index_name = index_name;
21916
- result->unique = unique;
21917
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
21918
- for (auto &expr : expressions) {
21919
- result->expressions.push_back(expr->Copy());
21920
- }
21921
- return move(result);
21922
- }
21923
- };
21924
-
21925
- } // namespace duckdb
21926
- //===----------------------------------------------------------------------===//
21927
- // DuckDB
21928
- //
21929
- // duckdb/parser/parsed_data/show_select_info.hpp
21930
- //
21931
- //
21932
- //===----------------------------------------------------------------------===//
21933
-
21934
-
21935
-
21936
-
21937
-
21938
-
21939
- namespace duckdb {
21940
-
21941
- struct ShowSelectInfo : public ParseInfo {
21942
- //! Types of projected columns
21943
- vector<LogicalType> types;
21944
- //! The QueryNode of select query
21945
- unique_ptr<QueryNode> query;
21946
- //! Aliases of projected columns
21947
- vector<string> aliases;
21948
- //! Whether or not we are requesting a summary or a describe
21949
- bool is_summary;
21950
-
21951
- unique_ptr<ShowSelectInfo> Copy() {
21952
- auto result = make_unique<ShowSelectInfo>();
21953
- result->types = types;
21954
- result->query = query->Copy();
21955
- result->aliases = aliases;
21956
- result->is_summary = is_summary;
21957
- return result;
21958
- }
21959
- };
21960
-
21961
- } // namespace duckdb
21962
- //===----------------------------------------------------------------------===//
21963
- // DuckDB
21964
- //
21965
- // duckdb/parser/parsed_data/transaction_info.hpp
21966
- //
21967
- //
21968
- //===----------------------------------------------------------------------===//
21969
-
21970
-
21971
-
21972
-
21973
-
21974
- namespace duckdb {
21975
-
21976
- enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
21977
-
21978
- struct TransactionInfo : public ParseInfo {
21979
- explicit TransactionInfo(TransactionType type) : type(type) {
21980
- }
21981
-
21982
- //! The type of transaction statement
21983
- TransactionType type;
21984
- };
21985
-
21986
- } // namespace duckdb
21987
- //===----------------------------------------------------------------------===//
21988
- // DuckDB
21989
- //
21990
- // duckdb/parser/parsed_data/create_schema_info.hpp
21991
- //
21992
- //
21993
- //===----------------------------------------------------------------------===//
21994
-
21995
-
21996
-
21997
-
21998
-
21999
- namespace duckdb {
22000
-
22001
- struct CreateSchemaInfo : public CreateInfo {
22002
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
22003
- }
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;
22004
21871
 
22005
21872
  public:
22006
21873
  unique_ptr<CreateInfo> Copy() const override {
22007
- auto result = make_unique<CreateSchemaInfo>();
21874
+ auto result = make_unique<CreateIndexInfo>();
22008
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
+ }
22009
21883
  return move(result);
22010
21884
  }
22011
21885
  };
@@ -22014,7 +21888,7 @@ public:
22014
21888
  //===----------------------------------------------------------------------===//
22015
21889
  // DuckDB
22016
21890
  //
22017
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
21891
+ // duckdb/parser/parsed_data/show_select_info.hpp
22018
21892
  //
22019
21893
  //
22020
21894
  //===----------------------------------------------------------------------===//
@@ -22026,27 +21900,23 @@ public:
22026
21900
 
22027
21901
  namespace duckdb {
22028
21902
 
22029
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
22030
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
22031
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
22032
- functions.push_back(move(function));
22033
- this->name = function.name;
22034
- }
22035
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
22036
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
22037
- this->name = name;
22038
- for (auto &function : functions) {
22039
- function.name = name;
22040
- }
22041
- }
22042
-
22043
- 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;
22044
21912
 
22045
- public:
22046
- unique_ptr<CreateInfo> Copy() const override {
22047
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
22048
- CopyProperties(*result);
22049
- 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;
22050
21920
  }
22051
21921
  };
22052
21922
 
@@ -22054,7 +21924,7 @@ public:
22054
21924
  //===----------------------------------------------------------------------===//
22055
21925
  // DuckDB
22056
21926
  //
22057
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
21927
+ // duckdb/parser/parsed_data/create_type_info.hpp
22058
21928
  //
22059
21929
  //
22060
21930
  //===----------------------------------------------------------------------===//
@@ -22064,29 +21934,26 @@ public:
22064
21934
 
22065
21935
 
22066
21936
 
21937
+
21938
+
22067
21939
  namespace duckdb {
22068
21940
 
22069
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
22070
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
22071
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
22072
- this->name = function.name;
22073
- functions.AddFunction(move(function));
22074
- }
21941
+ struct CreateTypeInfo : public CreateInfo {
22075
21942
 
22076
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
22077
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
22078
- this->name = functions.name;
22079
- for (auto &func : functions.functions) {
22080
- func.name = functions.name;
22081
- }
21943
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
22082
21944
  }
22083
21945
 
22084
- AggregateFunctionSet functions;
21946
+ //! Name of the Type
21947
+ string name;
21948
+ //! Logical Type
21949
+ LogicalType type;
22085
21950
 
22086
21951
  public:
22087
21952
  unique_ptr<CreateInfo> Copy() const override {
22088
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
21953
+ auto result = make_unique<CreateTypeInfo>();
22089
21954
  CopyProperties(*result);
21955
+ result->name = name;
21956
+ result->type = type;
22090
21957
  return move(result);
22091
21958
  }
22092
21959
  };
@@ -22162,6 +22029,129 @@ public:
22162
22029
  }
22163
22030
  };
22164
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
+
22165
22155
  } // namespace duckdb
22166
22156
  //===----------------------------------------------------------------------===//
22167
22157
  // DuckDB
@@ -22193,9 +22183,9 @@ public:
22193
22183
  unique_ptr<TableRef> Copy() override;
22194
22184
 
22195
22185
  //! Serializes a blob into a SubqueryRef
22196
- void Serialize(Serializer &serializer) override;
22186
+ void Serialize(FieldWriter &serializer) const override;
22197
22187
  //! Deserializes a blob back into a SubqueryRef
22198
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22188
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22199
22189
  };
22200
22190
  } // namespace duckdb
22201
22191
  //===----------------------------------------------------------------------===//
@@ -22228,9 +22218,9 @@ public:
22228
22218
  unique_ptr<TableRef> Copy() override;
22229
22219
 
22230
22220
  //! Serializes a blob into a CrossProductRef
22231
- void Serialize(Serializer &serializer) override;
22221
+ void Serialize(FieldWriter &serializer) const override;
22232
22222
  //! Deserializes a blob back into a CrossProductRef
22233
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22223
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22234
22224
  };
22235
22225
  } // namespace duckdb
22236
22226
  //===----------------------------------------------------------------------===//
@@ -22275,15 +22265,17 @@ public:
22275
22265
  unique_ptr<TableRef> Copy() override;
22276
22266
 
22277
22267
  //! Serializes a blob into a JoinRef
22278
- void Serialize(Serializer &serializer) override;
22268
+ void Serialize(FieldWriter &serializer) const override;
22279
22269
  //! Deserializes a blob back into a JoinRef
22280
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22270
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22281
22271
  };
22282
22272
  } // namespace duckdb
22273
+
22274
+
22283
22275
  //===----------------------------------------------------------------------===//
22284
22276
  // DuckDB
22285
22277
  //
22286
- // duckdb/parser/tableref/expressionlistref.hpp
22278
+ // duckdb/parser/tableref/emptytableref.hpp
22287
22279
  //
22288
22280
  //
22289
22281
  //===----------------------------------------------------------------------===//
@@ -22292,38 +22284,29 @@ public:
22292
22284
 
22293
22285
 
22294
22286
 
22295
-
22296
-
22297
-
22298
22287
  namespace duckdb {
22299
- //! Represents an expression list as generated by a VALUES statement
22300
- class ExpressionListRef : public TableRef {
22288
+ //! Represents a cross product
22289
+ class EmptyTableRef : public TableRef {
22301
22290
  public:
22302
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
22291
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
22303
22292
  }
22304
22293
 
22305
- //! Value list, only used for VALUES statement
22306
- vector<vector<unique_ptr<ParsedExpression>>> values;
22307
- //! Expected SQL types
22308
- vector<LogicalType> expected_types;
22309
- //! The set of expected names
22310
- vector<string> expected_names;
22311
-
22312
22294
  public:
22313
22295
  bool Equals(const TableRef *other_p) const override;
22314
22296
 
22315
22297
  unique_ptr<TableRef> Copy() override;
22316
22298
 
22317
- //! Serializes a blob into a ExpressionListRef
22318
- void Serialize(Serializer &serializer) override;
22319
- //! Deserializes a blob back into a ExpressionListRef
22320
- 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);
22321
22303
  };
22322
22304
  } // namespace duckdb
22305
+
22323
22306
  //===----------------------------------------------------------------------===//
22324
22307
  // DuckDB
22325
22308
  //
22326
- // duckdb/parser/tableref/emptytableref.hpp
22309
+ // duckdb/parser/tableref/expressionlistref.hpp
22327
22310
  //
22328
22311
  //
22329
22312
  //===----------------------------------------------------------------------===//
@@ -22332,24 +22315,37 @@ public:
22332
22315
 
22333
22316
 
22334
22317
 
22318
+
22319
+
22320
+
22335
22321
  namespace duckdb {
22336
- //! Represents a cross product
22337
- class EmptyTableRef : public TableRef {
22322
+ //! Represents an expression list as generated by a VALUES statement
22323
+ class ExpressionListRef : public TableRef {
22338
22324
  public:
22339
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
22325
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
22340
22326
  }
22341
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
+
22342
22335
  public:
22343
22336
  bool Equals(const TableRef *other_p) const override;
22344
22337
 
22345
22338
  unique_ptr<TableRef> Copy() override;
22346
22339
 
22347
- //! Serializes a blob into a DummyTableRef
22348
- void Serialize(Serializer &serializer) override;
22349
- //! Deserializes a blob back into a DummyTableRef
22350
- 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);
22351
22344
  };
22352
22345
  } // namespace duckdb
22346
+
22347
+
22348
+
22353
22349
  //===----------------------------------------------------------------------===//
22354
22350
  // DuckDB
22355
22351
  //
@@ -22386,15 +22382,9 @@ public:
22386
22382
  unique_ptr<TableRef> Copy() override;
22387
22383
 
22388
22384
  //! Serializes a blob into a BaseTableRef
22389
- void Serialize(Serializer &serializer) override;
22385
+ void Serialize(FieldWriter &serializer) const override;
22390
22386
  //! Deserializes a blob back into a BaseTableRef
22391
- static unique_ptr<TableRef> Deserialize(Deserializer &source);
22387
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
22392
22388
  };
22393
22389
  } // namespace duckdb
22394
22390
 
22395
-
22396
-
22397
-
22398
-
22399
-
22400
-