duckdb 0.3.5-dev584.0 → 0.3.5-dev593.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 "eecef371d"
15
- #define DUCKDB_VERSION "v0.3.5-dev584"
14
+ #define DUCKDB_SOURCE_ID "80d5c4cb1"
15
+ #define DUCKDB_VERSION "v0.3.5-dev593"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -12411,7 +12411,8 @@ public:
12411
12411
  }
12412
12412
 
12413
12413
  //! Cast an expression to the specified SQL type if required
12414
- static unique_ptr<Expression> AddCastToType(unique_ptr<Expression> expr, const LogicalType &target_type);
12414
+ static unique_ptr<Expression> AddCastToType(unique_ptr<Expression> expr, const LogicalType &target_type,
12415
+ bool try_cast = false);
12415
12416
  //! Returns true if a cast is invertible (i.e. CAST(s -> t -> s) = s for all values of s). This is not true for e.g.
12416
12417
  //! boolean casts, because that can be e.g. -1 -> TRUE -> 1. This is necessary to prevent some optimizer bugs.
12417
12418
  static bool CastIsInvertible(const LogicalType &source_type, const LogicalType &target_type);
@@ -22675,7 +22676,7 @@ public:
22675
22676
  //===----------------------------------------------------------------------===//
22676
22677
  // DuckDB
22677
22678
  //
22678
- // duckdb/parser/expression/star_expression.hpp
22679
+ // duckdb/parser/expression/parameter_expression.hpp
22679
22680
  //
22680
22681
  //
22681
22682
  //===----------------------------------------------------------------------===//
@@ -22684,25 +22685,54 @@ public:
22684
22685
 
22685
22686
 
22686
22687
 
22687
-
22688
22688
  namespace duckdb {
22689
-
22690
- //! Represents a * expression in the SELECT clause
22691
- class StarExpression : public ParsedExpression {
22689
+ class ParameterExpression : public ParsedExpression {
22692
22690
  public:
22693
- StarExpression(string relation_name = string());
22691
+ ParameterExpression();
22694
22692
 
22695
- //! The relation name in case of tbl.*, or empty if this is a normal *
22696
- string relation_name;
22697
- //! List of columns to exclude from the STAR expression
22698
- case_insensitive_set_t exclude_list;
22699
- //! List of columns to replace with another expression
22700
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
22693
+ idx_t parameter_nr;
22701
22694
 
22702
22695
  public:
22696
+ bool IsScalar() const override {
22697
+ return true;
22698
+ }
22699
+ bool HasParameter() const override {
22700
+ return true;
22701
+ }
22702
+
22703
22703
  string ToString() const override;
22704
22704
 
22705
- static bool Equals(const StarExpression *a, const StarExpression *b);
22705
+ unique_ptr<ParsedExpression> Copy() const override;
22706
+ hash_t Hash() const override;
22707
+
22708
+ void Serialize(FieldWriter &writer) const override;
22709
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22710
+ };
22711
+ } // namespace duckdb
22712
+ //===----------------------------------------------------------------------===//
22713
+ // DuckDB
22714
+ //
22715
+ // duckdb/parser/expression/default_expression.hpp
22716
+ //
22717
+ //
22718
+ //===----------------------------------------------------------------------===//
22719
+
22720
+
22721
+
22722
+
22723
+
22724
+ namespace duckdb {
22725
+ //! Represents the default value of a column
22726
+ class DefaultExpression : public ParsedExpression {
22727
+ public:
22728
+ DefaultExpression();
22729
+
22730
+ public:
22731
+ bool IsScalar() const override {
22732
+ return false;
22733
+ }
22734
+
22735
+ string ToString() const override;
22706
22736
 
22707
22737
  unique_ptr<ParsedExpression> Copy() const override;
22708
22738
 
@@ -22758,7 +22788,7 @@ public:
22758
22788
  //===----------------------------------------------------------------------===//
22759
22789
  // DuckDB
22760
22790
  //
22761
- // duckdb/parser/expression/positional_reference_expression.hpp
22791
+ // duckdb/parser/expression/between_expression.hpp
22762
22792
  //
22763
22793
  //
22764
22794
  //===----------------------------------------------------------------------===//
@@ -22768,31 +22798,39 @@ public:
22768
22798
 
22769
22799
 
22770
22800
  namespace duckdb {
22771
- class PositionalReferenceExpression : public ParsedExpression {
22801
+
22802
+ class BetweenExpression : public ParsedExpression {
22772
22803
  public:
22773
- DUCKDB_API PositionalReferenceExpression(idx_t index);
22804
+ DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22805
+ unique_ptr<ParsedExpression> upper);
22774
22806
 
22775
- idx_t index;
22807
+ unique_ptr<ParsedExpression> input;
22808
+ unique_ptr<ParsedExpression> lower;
22809
+ unique_ptr<ParsedExpression> upper;
22776
22810
 
22777
22811
  public:
22778
- bool IsScalar() const override {
22779
- return false;
22780
- }
22781
-
22782
22812
  string ToString() const override;
22783
22813
 
22784
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
22814
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22815
+
22785
22816
  unique_ptr<ParsedExpression> Copy() const override;
22786
- hash_t Hash() const override;
22787
22817
 
22788
22818
  void Serialize(FieldWriter &writer) const override;
22789
22819
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22820
+
22821
+ public:
22822
+ template <class T, class BASE>
22823
+ static string ToString(const T &entry) {
22824
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22825
+ }
22790
22826
  };
22791
22827
  } // namespace duckdb
22828
+
22829
+
22792
22830
  //===----------------------------------------------------------------------===//
22793
22831
  // DuckDB
22794
22832
  //
22795
- // duckdb/parser/expression/conjunction_expression.hpp
22833
+ // duckdb/parser/expression/case_expression.hpp
22796
22834
  //
22797
22835
  //
22798
22836
  //===----------------------------------------------------------------------===//
@@ -22804,22 +22842,23 @@ public:
22804
22842
 
22805
22843
  namespace duckdb {
22806
22844
 
22807
- //! Represents a conjunction (AND/OR)
22808
- class ConjunctionExpression : public ParsedExpression {
22845
+ struct CaseCheck {
22846
+ unique_ptr<ParsedExpression> when_expr;
22847
+ unique_ptr<ParsedExpression> then_expr;
22848
+ };
22849
+
22850
+ //! The CaseExpression represents a CASE expression in the query
22851
+ class CaseExpression : public ParsedExpression {
22809
22852
  public:
22810
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22811
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22812
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22813
- unique_ptr<ParsedExpression> right);
22853
+ DUCKDB_API CaseExpression();
22814
22854
 
22815
- vector<unique_ptr<ParsedExpression>> children;
22855
+ vector<CaseCheck> case_checks;
22856
+ unique_ptr<ParsedExpression> else_expr;
22816
22857
 
22817
22858
  public:
22818
- void AddExpression(unique_ptr<ParsedExpression> expr);
22819
-
22820
22859
  string ToString() const override;
22821
22860
 
22822
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22861
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
22823
22862
 
22824
22863
  unique_ptr<ParsedExpression> Copy() const override;
22825
22864
 
@@ -22829,50 +22868,19 @@ public:
22829
22868
  public:
22830
22869
  template <class T, class BASE>
22831
22870
  static string ToString(const T &entry) {
22832
- string result = "(" + entry.children[0]->ToString();
22833
- for (idx_t i = 1; i < entry.children.size(); i++) {
22834
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22871
+ string case_str = "CASE ";
22872
+ for (auto &check : entry.case_checks) {
22873
+ case_str += " WHEN (" + check.when_expr->ToString() + ")";
22874
+ case_str += " THEN (" + check.then_expr->ToString() + ")";
22835
22875
  }
22836
- return result + ")";
22876
+ case_str += " ELSE " + entry.else_expr->ToString();
22877
+ case_str += " END";
22878
+ return case_str;
22837
22879
  }
22838
22880
  };
22839
22881
  } // namespace duckdb
22840
- //===----------------------------------------------------------------------===//
22841
- // DuckDB
22842
- //
22843
- // duckdb/parser/expression/parameter_expression.hpp
22844
- //
22845
- //
22846
- //===----------------------------------------------------------------------===//
22847
-
22848
-
22849
-
22850
-
22851
22882
 
22852
- namespace duckdb {
22853
- class ParameterExpression : public ParsedExpression {
22854
- public:
22855
- ParameterExpression();
22856
-
22857
- idx_t parameter_nr;
22858
-
22859
- public:
22860
- bool IsScalar() const override {
22861
- return true;
22862
- }
22863
- bool HasParameter() const override {
22864
- return true;
22865
- }
22866
-
22867
- string ToString() const override;
22868
22883
 
22869
- unique_ptr<ParsedExpression> Copy() const override;
22870
- hash_t Hash() const override;
22871
-
22872
- void Serialize(FieldWriter &writer) const override;
22873
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22874
- };
22875
- } // namespace duckdb
22876
22884
  //===----------------------------------------------------------------------===//
22877
22885
  // DuckDB
22878
22886
  //
@@ -22908,59 +22916,12 @@ public:
22908
22916
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22909
22917
  };
22910
22918
  } // namespace duckdb
22911
- //===----------------------------------------------------------------------===//
22912
- // DuckDB
22913
- //
22914
- // duckdb/parser/expression/subquery_expression.hpp
22915
- //
22916
- //
22917
- //===----------------------------------------------------------------------===//
22918
-
22919
-
22920
-
22921
-
22922
-
22923
-
22924
-
22925
- namespace duckdb {
22926
-
22927
- //! Represents a subquery
22928
- class SubqueryExpression : public ParsedExpression {
22929
- public:
22930
- SubqueryExpression();
22931
-
22932
- //! The actual subquery
22933
- unique_ptr<SelectStatement> subquery;
22934
- //! The subquery type
22935
- SubqueryType subquery_type;
22936
- //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
22937
- //! subquery)
22938
- unique_ptr<ParsedExpression> child;
22939
- //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
22940
- ExpressionType comparison_type;
22941
-
22942
- public:
22943
- bool HasSubquery() const override {
22944
- return true;
22945
- }
22946
- bool IsScalar() const override {
22947
- return false;
22948
- }
22949
-
22950
- string ToString() const override;
22951
-
22952
- static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
22953
22919
 
22954
- unique_ptr<ParsedExpression> Copy() const override;
22955
22920
 
22956
- void Serialize(FieldWriter &writer) const override;
22957
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22958
- };
22959
- } // namespace duckdb
22960
22921
  //===----------------------------------------------------------------------===//
22961
22922
  // DuckDB
22962
22923
  //
22963
- // duckdb/parser/expression/between_expression.hpp
22924
+ // duckdb/parser/expression/comparison_expression.hpp
22964
22925
  //
22965
22926
  //
22966
22927
  //===----------------------------------------------------------------------===//
@@ -22970,20 +22931,20 @@ public:
22970
22931
 
22971
22932
 
22972
22933
  namespace duckdb {
22973
-
22974
- class BetweenExpression : public ParsedExpression {
22934
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22935
+ //! and has two children.
22936
+ class ComparisonExpression : public ParsedExpression {
22975
22937
  public:
22976
- DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22977
- unique_ptr<ParsedExpression> upper);
22938
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22939
+ unique_ptr<ParsedExpression> right);
22978
22940
 
22979
- unique_ptr<ParsedExpression> input;
22980
- unique_ptr<ParsedExpression> lower;
22981
- unique_ptr<ParsedExpression> upper;
22941
+ unique_ptr<ParsedExpression> left;
22942
+ unique_ptr<ParsedExpression> right;
22982
22943
 
22983
22944
  public:
22984
22945
  string ToString() const override;
22985
22946
 
22986
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22947
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22987
22948
 
22988
22949
  unique_ptr<ParsedExpression> Copy() const override;
22989
22950
 
@@ -22993,14 +22954,15 @@ public:
22993
22954
  public:
22994
22955
  template <class T, class BASE>
22995
22956
  static string ToString(const T &entry) {
22996
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22957
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22997
22958
  }
22998
22959
  };
22999
22960
  } // namespace duckdb
22961
+
23000
22962
  //===----------------------------------------------------------------------===//
23001
22963
  // DuckDB
23002
22964
  //
23003
- // duckdb/parser/expression/case_expression.hpp
22965
+ // duckdb/parser/expression/conjunction_expression.hpp
23004
22966
  //
23005
22967
  //
23006
22968
  //===----------------------------------------------------------------------===//
@@ -23012,23 +22974,22 @@ public:
23012
22974
 
23013
22975
  namespace duckdb {
23014
22976
 
23015
- struct CaseCheck {
23016
- unique_ptr<ParsedExpression> when_expr;
23017
- unique_ptr<ParsedExpression> then_expr;
23018
- };
23019
-
23020
- //! The CaseExpression represents a CASE expression in the query
23021
- class CaseExpression : public ParsedExpression {
22977
+ //! Represents a conjunction (AND/OR)
22978
+ class ConjunctionExpression : public ParsedExpression {
23022
22979
  public:
23023
- DUCKDB_API CaseExpression();
22980
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22981
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22982
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22983
+ unique_ptr<ParsedExpression> right);
23024
22984
 
23025
- vector<CaseCheck> case_checks;
23026
- unique_ptr<ParsedExpression> else_expr;
22985
+ vector<unique_ptr<ParsedExpression>> children;
23027
22986
 
23028
22987
  public:
22988
+ void AddExpression(unique_ptr<ParsedExpression> expr);
22989
+
23029
22990
  string ToString() const override;
23030
22991
 
23031
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
22992
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
23032
22993
 
23033
22994
  unique_ptr<ParsedExpression> Copy() const override;
23034
22995
 
@@ -23038,17 +22999,15 @@ public:
23038
22999
  public:
23039
23000
  template <class T, class BASE>
23040
23001
  static string ToString(const T &entry) {
23041
- string case_str = "CASE ";
23042
- for (auto &check : entry.case_checks) {
23043
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
23044
- case_str += " THEN (" + check.then_expr->ToString() + ")";
23002
+ string result = "(" + entry.children[0]->ToString();
23003
+ for (idx_t i = 1; i < entry.children.size(); i++) {
23004
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
23045
23005
  }
23046
- case_str += " ELSE " + entry.else_expr->ToString();
23047
- case_str += " END";
23048
- return case_str;
23006
+ return result + ")";
23049
23007
  }
23050
23008
  };
23051
23009
  } // namespace duckdb
23010
+
23052
23011
  //===----------------------------------------------------------------------===//
23053
23012
  // DuckDB
23054
23013
  //
@@ -23085,6 +23044,8 @@ public:
23085
23044
  };
23086
23045
 
23087
23046
  } // namespace duckdb
23047
+
23048
+
23088
23049
  //===----------------------------------------------------------------------===//
23089
23050
  // DuckDB
23090
23051
  //
@@ -23203,15 +23164,10 @@ public:
23203
23164
  };
23204
23165
  } // namespace duckdb
23205
23166
 
23206
-
23207
-
23208
-
23209
-
23210
-
23211
23167
  //===----------------------------------------------------------------------===//
23212
23168
  // DuckDB
23213
23169
  //
23214
- // duckdb/parser/expression/comparison_expression.hpp
23170
+ // duckdb/parser/expression/lambda_expression.hpp
23215
23171
  //
23216
23172
  //
23217
23173
  //===----------------------------------------------------------------------===//
@@ -23220,33 +23176,32 @@ public:
23220
23176
 
23221
23177
 
23222
23178
 
23179
+
23223
23180
  namespace duckdb {
23224
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
23225
- //! and has two children.
23226
- class ComparisonExpression : public ParsedExpression {
23181
+
23182
+ //! LambdaExpression represents either:
23183
+ //! 1. A lambda operator that can be used for e.g. mapping an expression to a list
23184
+ //! 2. An OperatorExpression with the "->" operator
23185
+ //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
23186
+ class LambdaExpression : public ParsedExpression {
23227
23187
  public:
23228
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
23229
- unique_ptr<ParsedExpression> right);
23188
+ LambdaExpression(unique_ptr<ParsedExpression> lhs, unique_ptr<ParsedExpression> rhs);
23230
23189
 
23231
- unique_ptr<ParsedExpression> left;
23232
- unique_ptr<ParsedExpression> right;
23190
+ unique_ptr<ParsedExpression> lhs;
23191
+ unique_ptr<ParsedExpression> rhs;
23233
23192
 
23234
23193
  public:
23235
23194
  string ToString() const override;
23236
23195
 
23237
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
23196
+ static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
23197
+ hash_t Hash() const override;
23238
23198
 
23239
23199
  unique_ptr<ParsedExpression> Copy() const override;
23240
23200
 
23241
23201
  void Serialize(FieldWriter &writer) const override;
23242
23202
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23243
-
23244
- public:
23245
- template <class T, class BASE>
23246
- static string ToString(const T &entry) {
23247
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
23248
- }
23249
23203
  };
23204
+
23250
23205
  } // namespace duckdb
23251
23206
 
23252
23207
 
@@ -23254,7 +23209,7 @@ public:
23254
23209
  //===----------------------------------------------------------------------===//
23255
23210
  // DuckDB
23256
23211
  //
23257
- // duckdb/parser/expression/default_expression.hpp
23212
+ // duckdb/parser/expression/positional_reference_expression.hpp
23258
23213
  //
23259
23214
  //
23260
23215
  //===----------------------------------------------------------------------===//
@@ -23264,10 +23219,11 @@ public:
23264
23219
 
23265
23220
 
23266
23221
  namespace duckdb {
23267
- //! Represents the default value of a column
23268
- class DefaultExpression : public ParsedExpression {
23222
+ class PositionalReferenceExpression : public ParsedExpression {
23269
23223
  public:
23270
- DefaultExpression();
23224
+ DUCKDB_API PositionalReferenceExpression(idx_t index);
23225
+
23226
+ idx_t index;
23271
23227
 
23272
23228
  public:
23273
23229
  bool IsScalar() const override {
@@ -23276,18 +23232,19 @@ public:
23276
23232
 
23277
23233
  string ToString() const override;
23278
23234
 
23235
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
23279
23236
  unique_ptr<ParsedExpression> Copy() const override;
23237
+ hash_t Hash() const override;
23280
23238
 
23281
23239
  void Serialize(FieldWriter &writer) const override;
23282
23240
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23283
23241
  };
23284
23242
  } // namespace duckdb
23285
23243
 
23286
-
23287
23244
  //===----------------------------------------------------------------------===//
23288
23245
  // DuckDB
23289
23246
  //
23290
- // duckdb/parser/expression/lambda_expression.hpp
23247
+ // duckdb/parser/expression/star_expression.hpp
23291
23248
  //
23292
23249
  //
23293
23250
  //===----------------------------------------------------------------------===//
@@ -23299,41 +23256,85 @@ public:
23299
23256
 
23300
23257
  namespace duckdb {
23301
23258
 
23302
- //! LambdaExpression represents either:
23303
- //! 1. A lambda operator that can be used for e.g. mapping an expression to a list
23304
- //! 2. An OperatorExpression with the "->" operator
23305
- //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
23306
- class LambdaExpression : public ParsedExpression {
23259
+ //! Represents a * expression in the SELECT clause
23260
+ class StarExpression : public ParsedExpression {
23307
23261
  public:
23308
- LambdaExpression(unique_ptr<ParsedExpression> lhs, unique_ptr<ParsedExpression> rhs);
23262
+ StarExpression(string relation_name = string());
23309
23263
 
23310
- unique_ptr<ParsedExpression> lhs;
23311
- unique_ptr<ParsedExpression> rhs;
23264
+ //! The relation name in case of tbl.*, or empty if this is a normal *
23265
+ string relation_name;
23266
+ //! List of columns to exclude from the STAR expression
23267
+ case_insensitive_set_t exclude_list;
23268
+ //! List of columns to replace with another expression
23269
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
23312
23270
 
23313
23271
  public:
23314
23272
  string ToString() const override;
23315
23273
 
23316
- static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
23317
- hash_t Hash() const override;
23274
+ static bool Equals(const StarExpression *a, const StarExpression *b);
23318
23275
 
23319
23276
  unique_ptr<ParsedExpression> Copy() const override;
23320
23277
 
23321
23278
  void Serialize(FieldWriter &writer) const override;
23322
23279
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23323
23280
  };
23324
-
23325
23281
  } // namespace duckdb
23326
23282
 
23283
+ //===----------------------------------------------------------------------===//
23284
+ // DuckDB
23285
+ //
23286
+ // duckdb/parser/expression/subquery_expression.hpp
23287
+ //
23288
+ //
23289
+ //===----------------------------------------------------------------------===//
23290
+
23291
+
23292
+
23293
+
23294
+
23295
+
23296
+
23297
+ namespace duckdb {
23298
+
23299
+ //! Represents a subquery
23300
+ class SubqueryExpression : public ParsedExpression {
23301
+ public:
23302
+ SubqueryExpression();
23303
+
23304
+ //! The actual subquery
23305
+ unique_ptr<SelectStatement> subquery;
23306
+ //! The subquery type
23307
+ SubqueryType subquery_type;
23308
+ //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
23309
+ //! subquery)
23310
+ unique_ptr<ParsedExpression> child;
23311
+ //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
23312
+ ExpressionType comparison_type;
23327
23313
 
23314
+ public:
23315
+ bool HasSubquery() const override {
23316
+ return true;
23317
+ }
23318
+ bool IsScalar() const override {
23319
+ return false;
23320
+ }
23328
23321
 
23322
+ string ToString() const override;
23329
23323
 
23324
+ static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
23330
23325
 
23326
+ unique_ptr<ParsedExpression> Copy() const override;
23327
+
23328
+ void Serialize(FieldWriter &writer) const override;
23329
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23330
+ };
23331
+ } // namespace duckdb
23331
23332
 
23332
23333
 
23333
23334
  //===----------------------------------------------------------------------===//
23334
23335
  // DuckDB
23335
23336
  //
23336
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23337
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23337
23338
  //
23338
23339
  //
23339
23340
  //===----------------------------------------------------------------------===//
@@ -23342,31 +23343,20 @@ public:
23342
23343
 
23343
23344
 
23344
23345
 
23345
-
23346
23346
  namespace duckdb {
23347
23347
 
23348
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23349
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
23350
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23351
- this->name = function.name;
23352
- functions.AddFunction(move(function));
23353
- }
23354
-
23355
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23356
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23357
- this->name = functions.name;
23358
- for (auto &func : functions.functions) {
23359
- func.name = functions.name;
23360
- }
23361
- }
23348
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23362
23349
 
23363
- AggregateFunctionSet functions;
23350
+ struct LoadInfo : public ParseInfo {
23351
+ std::string filename;
23352
+ LoadType load_type;
23364
23353
 
23365
23354
  public:
23366
- unique_ptr<CreateInfo> Copy() const override {
23367
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23368
- CopyProperties(*result);
23369
- return move(result);
23355
+ unique_ptr<LoadInfo> Copy() const {
23356
+ auto result = make_unique<LoadInfo>();
23357
+ result->filename = filename;
23358
+ result->load_type = load_type;
23359
+ return result;
23370
23360
  }
23371
23361
  };
23372
23362
 
@@ -23374,7 +23364,7 @@ public:
23374
23364
  //===----------------------------------------------------------------------===//
23375
23365
  // DuckDB
23376
23366
  //
23377
- // duckdb/parser/parsed_data/drop_info.hpp
23367
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23378
23368
  //
23379
23369
  //
23380
23370
  //===----------------------------------------------------------------------===//
@@ -23383,42 +23373,30 @@ public:
23383
23373
 
23384
23374
 
23385
23375
 
23386
-
23387
23376
  namespace duckdb {
23388
23377
 
23389
- struct DropInfo : public ParseInfo {
23390
- DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23391
- }
23392
-
23393
- //! The catalog type to drop
23394
- CatalogType type;
23395
- //! Schema name to drop from, if any
23396
- string schema;
23397
- //! Element name to drop
23398
- string name;
23399
- //! Ignore if the entry does not exist instead of failing
23400
- bool if_exists = false;
23401
- //! Cascade drop (drop all dependents instead of throwing an error if there
23402
- //! are any)
23403
- bool cascade = false;
23404
-
23405
- public:
23406
- unique_ptr<DropInfo> Copy() const {
23407
- auto result = make_unique<DropInfo>();
23408
- result->type = type;
23409
- result->schema = schema;
23410
- result->name = name;
23411
- result->if_exists = if_exists;
23412
- result->cascade = cascade;
23413
- return result;
23414
- }
23378
+ struct VacuumInfo : public ParseInfo {
23379
+ // nothing for now
23415
23380
  };
23416
23381
 
23417
23382
  } // namespace duckdb
23418
23383
  //===----------------------------------------------------------------------===//
23419
23384
  // DuckDB
23420
23385
  //
23421
- // duckdb/parser/parsed_data/create_collation_info.hpp
23386
+ // duckdb/parser/parsed_data/create_index_info.hpp
23387
+ //
23388
+ //
23389
+ //===----------------------------------------------------------------------===//
23390
+
23391
+
23392
+
23393
+
23394
+
23395
+
23396
+ //===----------------------------------------------------------------------===//
23397
+ // DuckDB
23398
+ //
23399
+ // duckdb/parser/tableref/basetableref.hpp
23422
23400
  //
23423
23401
  //
23424
23402
  //===----------------------------------------------------------------------===//
@@ -23429,29 +23407,62 @@ public:
23429
23407
 
23430
23408
 
23431
23409
  namespace duckdb {
23410
+ //! Represents a TableReference to a base table in the schema
23411
+ class BaseTableRef : public TableRef {
23412
+ public:
23413
+ BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
23414
+ }
23432
23415
 
23433
- struct CreateCollationInfo : public CreateInfo {
23434
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23435
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23436
- not_required_for_equality(not_required_for_equality_p) {
23437
- this->name = move(name_p);
23416
+ //! Schema name
23417
+ string schema_name;
23418
+ //! Table name
23419
+ string table_name;
23420
+ //! Aliases for the column names
23421
+ vector<string> column_name_alias;
23422
+
23423
+ public:
23424
+ string ToString() const override;
23425
+ bool Equals(const TableRef *other_p) const override;
23426
+
23427
+ unique_ptr<TableRef> Copy() override;
23428
+
23429
+ //! Serializes a blob into a BaseTableRef
23430
+ void Serialize(FieldWriter &serializer) const override;
23431
+ //! Deserializes a blob back into a BaseTableRef
23432
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
23433
+ };
23434
+ } // namespace duckdb
23435
+
23436
+
23437
+
23438
+ namespace duckdb {
23439
+
23440
+ struct CreateIndexInfo : public CreateInfo {
23441
+ CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
23438
23442
  }
23439
23443
 
23440
- //! The name of the collation
23441
- string name;
23442
- //! The collation function to push in case collation is required
23443
- ScalarFunction function;
23444
- //! Whether or not the collation can be combined with other collations.
23445
- bool combinable;
23446
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23447
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23448
- //! speeds up processing.
23449
- bool not_required_for_equality;
23444
+ //! Index Type (e.g., B+-tree, Skip-List, ...)
23445
+ IndexType index_type;
23446
+ //! Name of the Index
23447
+ string index_name;
23448
+ //! If it is an unique index
23449
+ bool unique = false;
23450
+ //! The table to create the index on
23451
+ unique_ptr<BaseTableRef> table;
23452
+ //! Set of expressions to index by
23453
+ vector<unique_ptr<ParsedExpression>> expressions;
23450
23454
 
23451
23455
  public:
23452
23456
  unique_ptr<CreateInfo> Copy() const override {
23453
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23457
+ auto result = make_unique<CreateIndexInfo>();
23454
23458
  CopyProperties(*result);
23459
+ result->index_type = index_type;
23460
+ result->index_name = index_name;
23461
+ result->unique = unique;
23462
+ result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
23463
+ for (auto &expr : expressions) {
23464
+ result->expressions.push_back(expr->Copy());
23465
+ }
23455
23466
  return move(result);
23456
23467
  }
23457
23468
  };
@@ -23521,7 +23532,7 @@ struct TransactionInfo : public ParseInfo {
23521
23532
  //===----------------------------------------------------------------------===//
23522
23533
  // DuckDB
23523
23534
  //
23524
- // duckdb/parser/parsed_data/vacuum_info.hpp
23535
+ // duckdb/parser/parsed_data/create_schema_info.hpp
23525
23536
  //
23526
23537
  //
23527
23538
  //===----------------------------------------------------------------------===//
@@ -23532,18 +23543,15 @@ struct TransactionInfo : public ParseInfo {
23532
23543
 
23533
23544
  namespace duckdb {
23534
23545
 
23535
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23536
-
23537
- struct LoadInfo : public ParseInfo {
23538
- std::string filename;
23539
- LoadType load_type;
23546
+ struct CreateSchemaInfo : public CreateInfo {
23547
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23548
+ }
23540
23549
 
23541
23550
  public:
23542
- unique_ptr<LoadInfo> Copy() const {
23543
- auto result = make_unique<LoadInfo>();
23544
- result->filename = filename;
23545
- result->load_type = load_type;
23546
- return result;
23551
+ unique_ptr<CreateInfo> Copy() const override {
23552
+ auto result = make_unique<CreateSchemaInfo>();
23553
+ CopyProperties(*result);
23554
+ return move(result);
23547
23555
  }
23548
23556
  };
23549
23557
 
@@ -23551,7 +23559,7 @@ public:
23551
23559
  //===----------------------------------------------------------------------===//
23552
23560
  // DuckDB
23553
23561
  //
23554
- // duckdb/parser/parsed_data/create_type_info.hpp
23562
+ // duckdb/parser/parsed_data/export_table_data.hpp
23555
23563
  //
23556
23564
  //
23557
23565
  //===----------------------------------------------------------------------===//
@@ -23561,35 +23569,33 @@ public:
23561
23569
 
23562
23570
 
23563
23571
 
23564
-
23565
-
23566
23572
  namespace duckdb {
23567
23573
 
23568
- struct CreateTypeInfo : public CreateInfo {
23574
+ struct ExportedTableData {
23575
+ //! Name of the exported table
23576
+ string table_name;
23569
23577
 
23570
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23571
- }
23578
+ //! Name of the schema
23579
+ string schema_name;
23572
23580
 
23573
- //! Name of the Type
23574
- string name;
23575
- //! Logical Type
23576
- LogicalType type;
23581
+ //! Path to be exported
23582
+ string file_path;
23583
+ };
23577
23584
 
23578
- public:
23579
- unique_ptr<CreateInfo> Copy() const override {
23580
- auto result = make_unique<CreateTypeInfo>();
23581
- CopyProperties(*result);
23582
- result->name = name;
23583
- result->type = type;
23584
- return move(result);
23585
- }
23585
+ struct ExportedTableInfo {
23586
+ TableCatalogEntry *entry;
23587
+ ExportedTableData table_data;
23588
+ };
23589
+
23590
+ struct BoundExportData : public ParseInfo {
23591
+ std::vector<ExportedTableInfo> data;
23586
23592
  };
23587
23593
 
23588
23594
  } // namespace duckdb
23589
23595
  //===----------------------------------------------------------------------===//
23590
23596
  // DuckDB
23591
23597
  //
23592
- // duckdb/parser/parsed_data/create_schema_info.hpp
23598
+ // duckdb/parser/parsed_data/drop_info.hpp
23593
23599
  //
23594
23600
  //
23595
23601
  //===----------------------------------------------------------------------===//
@@ -23598,17 +23604,34 @@ public:
23598
23604
 
23599
23605
 
23600
23606
 
23607
+
23601
23608
  namespace duckdb {
23602
23609
 
23603
- struct CreateSchemaInfo : public CreateInfo {
23604
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23610
+ struct DropInfo : public ParseInfo {
23611
+ DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23605
23612
  }
23606
23613
 
23614
+ //! The catalog type to drop
23615
+ CatalogType type;
23616
+ //! Schema name to drop from, if any
23617
+ string schema;
23618
+ //! Element name to drop
23619
+ string name;
23620
+ //! Ignore if the entry does not exist instead of failing
23621
+ bool if_exists = false;
23622
+ //! Cascade drop (drop all dependents instead of throwing an error if there
23623
+ //! are any)
23624
+ bool cascade = false;
23625
+
23607
23626
  public:
23608
- unique_ptr<CreateInfo> Copy() const override {
23609
- auto result = make_unique<CreateSchemaInfo>();
23610
- CopyProperties(*result);
23611
- return move(result);
23627
+ unique_ptr<DropInfo> Copy() const {
23628
+ auto result = make_unique<DropInfo>();
23629
+ result->type = type;
23630
+ result->schema = schema;
23631
+ result->name = name;
23632
+ result->if_exists = if_exists;
23633
+ result->cascade = cascade;
23634
+ return result;
23612
23635
  }
23613
23636
  };
23614
23637
 
@@ -23616,7 +23639,7 @@ public:
23616
23639
  //===----------------------------------------------------------------------===//
23617
23640
  // DuckDB
23618
23641
  //
23619
- // duckdb/parser/parsed_data/create_index_info.hpp
23642
+ // duckdb/parser/parsed_data/create_macro_info.hpp
23620
23643
  //
23621
23644
  //
23622
23645
  //===----------------------------------------------------------------------===//
@@ -23624,78 +23647,115 @@ public:
23624
23647
 
23625
23648
 
23626
23649
 
23627
-
23628
-
23629
23650
  //===----------------------------------------------------------------------===//
23630
23651
  // DuckDB
23631
23652
  //
23632
- // duckdb/parser/tableref/basetableref.hpp
23653
+ // duckdb/function/macro_function.hpp
23633
23654
  //
23634
23655
  //
23635
23656
  //===----------------------------------------------------------------------===//
23636
23657
 
23637
23658
 
23659
+ //! The SelectStatement of the view
23660
+
23661
+
23662
+
23638
23663
 
23639
23664
 
23640
23665
 
23641
23666
 
23642
23667
  namespace duckdb {
23643
- //! Represents a TableReference to a base table in the schema
23644
- class BaseTableRef : public TableRef {
23668
+
23669
+ enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
23670
+
23671
+ class MacroFunction {
23645
23672
  public:
23646
- BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
23647
- }
23673
+ // explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23674
+ MacroFunction(MacroType type);
23648
23675
 
23649
- //! Schema name
23650
- string schema_name;
23651
- //! Table name
23652
- string table_name;
23653
- //! Aliases for the column names
23654
- vector<string> column_name_alias;
23676
+ // MacroFunction(void);
23677
+ // The type
23678
+ MacroType type;
23679
+ //! The positional parameters
23680
+ vector<unique_ptr<ParsedExpression>> parameters;
23681
+ //! The default parameters and their associated values
23682
+ unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
23655
23683
 
23656
23684
  public:
23657
- string ToString() const override;
23658
- bool Equals(const TableRef *other_p) const override;
23685
+ virtual ~MacroFunction() {
23686
+ }
23659
23687
 
23660
- unique_ptr<TableRef> Copy() override;
23688
+ void CopyProperties(MacroFunction &other);
23661
23689
 
23662
- //! Serializes a blob into a BaseTableRef
23663
- void Serialize(FieldWriter &serializer) const override;
23664
- //! Deserializes a blob back into a BaseTableRef
23665
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
23690
+ virtual unique_ptr<MacroFunction> Copy() = 0;
23691
+
23692
+ static string ValidateArguments(MacroFunction &macro_function, const string &name,
23693
+ FunctionExpression &function_expr,
23694
+ vector<unique_ptr<ParsedExpression>> &positionals,
23695
+ unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
23696
+ };
23697
+
23698
+ } // namespace duckdb
23699
+
23700
+
23701
+ namespace duckdb {
23702
+
23703
+ struct CreateMacroInfo : public CreateFunctionInfo {
23704
+ CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
23705
+ }
23706
+
23707
+ CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
23708
+ }
23709
+
23710
+ unique_ptr<MacroFunction> function;
23711
+
23712
+ public:
23713
+ unique_ptr<CreateInfo> Copy() const override {
23714
+ auto result = make_unique<CreateMacroInfo>();
23715
+ result->function = function->Copy();
23716
+ result->name = name;
23717
+ CopyProperties(*result);
23718
+ return move(result);
23719
+ }
23666
23720
  };
23721
+
23667
23722
  } // namespace duckdb
23723
+ //===----------------------------------------------------------------------===//
23724
+ // DuckDB
23725
+ //
23726
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23727
+ //
23728
+ //
23729
+ //===----------------------------------------------------------------------===//
23730
+
23731
+
23732
+
23668
23733
 
23669
23734
 
23670
23735
 
23671
23736
  namespace duckdb {
23672
23737
 
23673
- struct CreateIndexInfo : public CreateInfo {
23674
- CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
23738
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23739
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
23740
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23741
+ this->name = function.name;
23742
+ functions.AddFunction(move(function));
23675
23743
  }
23676
23744
 
23677
- //! Index Type (e.g., B+-tree, Skip-List, ...)
23678
- IndexType index_type;
23679
- //! Name of the Index
23680
- string index_name;
23681
- //! If it is an unique index
23682
- bool unique = false;
23683
- //! The table to create the index on
23684
- unique_ptr<BaseTableRef> table;
23685
- //! Set of expressions to index by
23686
- vector<unique_ptr<ParsedExpression>> expressions;
23745
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23746
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23747
+ this->name = functions.name;
23748
+ for (auto &func : functions.functions) {
23749
+ func.name = functions.name;
23750
+ }
23751
+ }
23752
+
23753
+ AggregateFunctionSet functions;
23687
23754
 
23688
23755
  public:
23689
23756
  unique_ptr<CreateInfo> Copy() const override {
23690
- auto result = make_unique<CreateIndexInfo>();
23757
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23691
23758
  CopyProperties(*result);
23692
- result->index_type = index_type;
23693
- result->index_name = index_name;
23694
- result->unique = unique;
23695
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
23696
- for (auto &expr : expressions) {
23697
- result->expressions.push_back(expr->Copy());
23698
- }
23699
23759
  return move(result);
23700
23760
  }
23701
23761
  };
@@ -23704,7 +23764,7 @@ public:
23704
23764
  //===----------------------------------------------------------------------===//
23705
23765
  // DuckDB
23706
23766
  //
23707
- // duckdb/parser/parsed_data/export_table_data.hpp
23767
+ // duckdb/parser/parsed_data/create_collation_info.hpp
23708
23768
  //
23709
23769
  //
23710
23770
  //===----------------------------------------------------------------------===//
@@ -23716,106 +23776,66 @@ public:
23716
23776
 
23717
23777
  namespace duckdb {
23718
23778
 
23719
- struct ExportedTableData {
23720
- //! Name of the exported table
23721
- string table_name;
23722
-
23723
- //! Name of the schema
23724
- string schema_name;
23725
-
23726
- //! Path to be exported
23727
- string file_path;
23728
- };
23779
+ struct CreateCollationInfo : public CreateInfo {
23780
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23781
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23782
+ not_required_for_equality(not_required_for_equality_p) {
23783
+ this->name = move(name_p);
23784
+ }
23729
23785
 
23730
- struct ExportedTableInfo {
23731
- TableCatalogEntry *entry;
23732
- ExportedTableData table_data;
23733
- };
23786
+ //! The name of the collation
23787
+ string name;
23788
+ //! The collation function to push in case collation is required
23789
+ ScalarFunction function;
23790
+ //! Whether or not the collation can be combined with other collations.
23791
+ bool combinable;
23792
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23793
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23794
+ //! speeds up processing.
23795
+ bool not_required_for_equality;
23734
23796
 
23735
- struct BoundExportData : public ParseInfo {
23736
- std::vector<ExportedTableInfo> data;
23797
+ public:
23798
+ unique_ptr<CreateInfo> Copy() const override {
23799
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23800
+ CopyProperties(*result);
23801
+ return move(result);
23802
+ }
23737
23803
  };
23738
23804
 
23739
23805
  } // namespace duckdb
23740
23806
  //===----------------------------------------------------------------------===//
23741
23807
  // DuckDB
23742
23808
  //
23743
- // duckdb/parser/parsed_data/create_macro_info.hpp
23744
- //
23745
- //
23746
- //===----------------------------------------------------------------------===//
23747
-
23748
-
23749
-
23750
-
23751
- //===----------------------------------------------------------------------===//
23752
- // DuckDB
23753
- //
23754
- // duckdb/function/macro_function.hpp
23809
+ // duckdb/parser/parsed_data/create_type_info.hpp
23755
23810
  //
23756
23811
  //
23757
23812
  //===----------------------------------------------------------------------===//
23758
23813
 
23759
23814
 
23760
- //! The SelectStatement of the view
23761
-
23762
-
23763
-
23764
-
23765
-
23766
-
23767
-
23768
- namespace duckdb {
23769
-
23770
- enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
23771
-
23772
- class MacroFunction {
23773
- public:
23774
- // explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23775
- MacroFunction(MacroType type);
23776
-
23777
- // MacroFunction(void);
23778
- // The type
23779
- MacroType type;
23780
- //! The positional parameters
23781
- vector<unique_ptr<ParsedExpression>> parameters;
23782
- //! The default parameters and their associated values
23783
- unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
23784
-
23785
- public:
23786
- virtual ~MacroFunction() {
23787
- }
23788
23815
 
23789
- void CopyProperties(MacroFunction &other);
23790
23816
 
23791
- virtual unique_ptr<MacroFunction> Copy() = 0;
23792
23817
 
23793
- static string ValidateArguments(MacroFunction &macro_function, const string &name,
23794
- FunctionExpression &function_expr,
23795
- vector<unique_ptr<ParsedExpression>> &positionals,
23796
- unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
23797
- };
23798
23818
 
23799
- } // namespace duckdb
23800
23819
 
23801
23820
 
23802
23821
  namespace duckdb {
23803
23822
 
23804
- struct CreateMacroInfo : public CreateFunctionInfo {
23805
- CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
23806
- }
23823
+ struct CreateTypeInfo : public CreateInfo {
23807
23824
 
23808
- CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
23825
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23809
23826
  }
23810
23827
 
23811
- unique_ptr<MacroFunction> function;
23828
+ //! Name of the Type
23829
+ string name;
23830
+ //! Logical Type
23831
+ LogicalType type;
23812
23832
 
23813
23833
  public:
23814
23834
  unique_ptr<CreateInfo> Copy() const override {
23815
- auto result = make_unique<CreateMacroInfo>();
23816
- result->function = function->Copy();
23817
- result->name = name;
23835
+ auto result = make_unique<CreateTypeInfo>();
23818
23836
  CopyProperties(*result);
23837
+ result->name = name;
23838
+ result->type = type;
23819
23839
  return move(result);
23820
23840
  }
23821
23841
  };
@@ -23907,7 +23927,7 @@ public:
23907
23927
  //===----------------------------------------------------------------------===//
23908
23928
  // DuckDB
23909
23929
  //
23910
- // duckdb/parser/parsed_data/vacuum_info.hpp
23930
+ // duckdb/parser/tableref/joinref.hpp
23911
23931
  //
23912
23932
  //
23913
23933
  //===----------------------------------------------------------------------===//
@@ -23916,12 +23936,41 @@ public:
23916
23936
 
23917
23937
 
23918
23938
 
23939
+
23940
+
23941
+
23942
+
23919
23943
  namespace duckdb {
23944
+ //! Represents a JOIN between two expressions
23945
+ class JoinRef : public TableRef {
23946
+ public:
23947
+ JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
23948
+ }
23920
23949
 
23921
- struct VacuumInfo : public ParseInfo {
23922
- // nothing for now
23923
- };
23950
+ //! The left hand side of the join
23951
+ unique_ptr<TableRef> left;
23952
+ //! The right hand side of the join
23953
+ unique_ptr<TableRef> right;
23954
+ //! The join condition
23955
+ unique_ptr<ParsedExpression> condition;
23956
+ //! The join type
23957
+ JoinType type;
23958
+ //! Natural join
23959
+ bool is_natural;
23960
+ //! The set of USING columns (if any)
23961
+ vector<string> using_columns;
23962
+
23963
+ public:
23964
+ string ToString() const override;
23965
+ bool Equals(const TableRef *other_p) const override;
23966
+
23967
+ unique_ptr<TableRef> Copy() override;
23924
23968
 
23969
+ //! Serializes a blob into a JoinRef
23970
+ void Serialize(FieldWriter &serializer) const override;
23971
+ //! Deserializes a blob back into a JoinRef
23972
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
23973
+ };
23925
23974
  } // namespace duckdb
23926
23975
  //===----------------------------------------------------------------------===//
23927
23976
  // DuckDB
@@ -23954,10 +24003,11 @@ public:
23954
24003
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23955
24004
  };
23956
24005
  } // namespace duckdb
24006
+
23957
24007
  //===----------------------------------------------------------------------===//
23958
24008
  // DuckDB
23959
24009
  //
23960
- // duckdb/parser/tableref/table_function_ref.hpp
24010
+ // duckdb/parser/tableref/crossproductref.hpp
23961
24011
  //
23962
24012
  //
23963
24013
  //===----------------------------------------------------------------------===//
@@ -23966,34 +24016,32 @@ public:
23966
24016
 
23967
24017
 
23968
24018
 
23969
-
23970
-
23971
-
23972
24019
  namespace duckdb {
23973
- //! Represents a Table producing function
23974
- class TableFunctionRef : public TableRef {
24020
+ //! Represents a cross product
24021
+ class CrossProductRef : public TableRef {
23975
24022
  public:
23976
- DUCKDB_API TableFunctionRef();
23977
-
23978
- unique_ptr<ParsedExpression> function;
23979
- vector<string> column_name_alias;
24023
+ CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
24024
+ }
23980
24025
 
23981
- // if the function takes a subquery as argument its in here
23982
- unique_ptr<SelectStatement> subquery;
24026
+ //! The left hand side of the cross product
24027
+ unique_ptr<TableRef> left;
24028
+ //! The right hand side of the cross product
24029
+ unique_ptr<TableRef> right;
23983
24030
 
23984
24031
  public:
23985
24032
  string ToString() const override;
23986
-
23987
24033
  bool Equals(const TableRef *other_p) const override;
23988
24034
 
23989
24035
  unique_ptr<TableRef> Copy() override;
23990
24036
 
23991
- //! Serializes a blob into a BaseTableRef
24037
+ //! Serializes a blob into a CrossProductRef
23992
24038
  void Serialize(FieldWriter &serializer) const override;
23993
- //! Deserializes a blob back into a BaseTableRef
24039
+ //! Deserializes a blob back into a CrossProductRef
23994
24040
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23995
24041
  };
23996
24042
  } // namespace duckdb
24043
+
24044
+
23997
24045
  //===----------------------------------------------------------------------===//
23998
24046
  // DuckDB
23999
24047
  //
@@ -24035,6 +24083,8 @@ public:
24035
24083
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24036
24084
  };
24037
24085
  } // namespace duckdb
24086
+
24087
+
24038
24088
  //===----------------------------------------------------------------------===//
24039
24089
  // DuckDB
24040
24090
  //
@@ -24075,46 +24125,7 @@ public:
24075
24125
  //===----------------------------------------------------------------------===//
24076
24126
  // DuckDB
24077
24127
  //
24078
- // duckdb/parser/tableref/crossproductref.hpp
24079
- //
24080
- //
24081
- //===----------------------------------------------------------------------===//
24082
-
24083
-
24084
-
24085
-
24086
-
24087
- namespace duckdb {
24088
- //! Represents a cross product
24089
- class CrossProductRef : public TableRef {
24090
- public:
24091
- CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
24092
- }
24093
-
24094
- //! The left hand side of the cross product
24095
- unique_ptr<TableRef> left;
24096
- //! The right hand side of the cross product
24097
- unique_ptr<TableRef> right;
24098
-
24099
- public:
24100
- string ToString() const override;
24101
- bool Equals(const TableRef *other_p) const override;
24102
-
24103
- unique_ptr<TableRef> Copy() override;
24104
-
24105
- //! Serializes a blob into a CrossProductRef
24106
- void Serialize(FieldWriter &serializer) const override;
24107
- //! Deserializes a blob back into a CrossProductRef
24108
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
24109
- };
24110
- } // namespace duckdb
24111
-
24112
-
24113
-
24114
- //===----------------------------------------------------------------------===//
24115
- // DuckDB
24116
- //
24117
- // duckdb/parser/tableref/joinref.hpp
24128
+ // duckdb/parser/tableref/table_function_ref.hpp
24118
24129
  //
24119
24130
  //
24120
24131
  //===----------------------------------------------------------------------===//
@@ -24126,39 +24137,29 @@ public:
24126
24137
 
24127
24138
 
24128
24139
 
24129
-
24130
24140
  namespace duckdb {
24131
- //! Represents a JOIN between two expressions
24132
- class JoinRef : public TableRef {
24141
+ //! Represents a Table producing function
24142
+ class TableFunctionRef : public TableRef {
24133
24143
  public:
24134
- JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
24135
- }
24144
+ DUCKDB_API TableFunctionRef();
24136
24145
 
24137
- //! The left hand side of the join
24138
- unique_ptr<TableRef> left;
24139
- //! The right hand side of the join
24140
- unique_ptr<TableRef> right;
24141
- //! The join condition
24142
- unique_ptr<ParsedExpression> condition;
24143
- //! The join type
24144
- JoinType type;
24145
- //! Natural join
24146
- bool is_natural;
24147
- //! The set of USING columns (if any)
24148
- vector<string> using_columns;
24146
+ unique_ptr<ParsedExpression> function;
24147
+ vector<string> column_name_alias;
24148
+
24149
+ // if the function takes a subquery as argument its in here
24150
+ unique_ptr<SelectStatement> subquery;
24149
24151
 
24150
24152
  public:
24151
24153
  string ToString() const override;
24154
+
24152
24155
  bool Equals(const TableRef *other_p) const override;
24153
24156
 
24154
24157
  unique_ptr<TableRef> Copy() override;
24155
24158
 
24156
- //! Serializes a blob into a JoinRef
24159
+ //! Serializes a blob into a BaseTableRef
24157
24160
  void Serialize(FieldWriter &serializer) const override;
24158
- //! Deserializes a blob back into a JoinRef
24161
+ //! Deserializes a blob back into a BaseTableRef
24159
24162
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24160
24163
  };
24161
24164
  } // namespace duckdb
24162
24165
 
24163
-
24164
-