duckdb 0.3.2-dev1316.0 → 0.3.2-dev1325.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 "9a485b0fd"
15
- #define DUCKDB_VERSION "v0.3.2-dev1316"
14
+ #define DUCKDB_SOURCE_ID "86af59255"
15
+ #define DUCKDB_VERSION "v0.3.2-dev1325"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -15924,6 +15924,9 @@ public:
15924
15924
 
15925
15925
  bool CTEIsAlreadyBound(CommonTableExpressionInfo *cte);
15926
15926
 
15927
+ //! Add the view to the set of currently bound views - used for detecting recursive view definitions
15928
+ void AddBoundView(ViewCatalogEntry *view);
15929
+
15927
15930
  void PushExpressionBinder(ExpressionBinder *binder);
15928
15931
  void PopExpressionBinder();
15929
15932
  void SetActiveBinder(ExpressionBinder *binder);
@@ -15985,6 +15988,8 @@ private:
15985
15988
  BindingMode mode = BindingMode::STANDARD_BINDING;
15986
15989
  //! Table names extracted for BindingMode::EXTRACT_NAMES
15987
15990
  unordered_set<string> table_names;
15991
+ //! The set of bound views
15992
+ unordered_set<ViewCatalogEntry *> bound_views;
15988
15993
 
15989
15994
  private:
15990
15995
  //! Bind the default values of the columns of a table
@@ -21019,7 +21024,7 @@ private:
21019
21024
  //===----------------------------------------------------------------------===//
21020
21025
  // DuckDB
21021
21026
  //
21022
- // duckdb/parser/expression/comparison_expression.hpp
21027
+ // duckdb/parser/expression/lambda_expression.hpp
21023
21028
  //
21024
21029
  //
21025
21030
  //===----------------------------------------------------------------------===//
@@ -21028,31 +21033,35 @@ private:
21028
21033
 
21029
21034
 
21030
21035
 
21036
+
21031
21037
  namespace duckdb {
21032
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
21033
- //! and has two children.
21034
- class ComparisonExpression : public ParsedExpression {
21038
+
21039
+ //! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
21040
+ //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
21041
+ class LambdaExpression : public ParsedExpression {
21035
21042
  public:
21036
- ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21043
+ LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21037
21044
 
21038
- unique_ptr<ParsedExpression> left;
21039
- unique_ptr<ParsedExpression> right;
21045
+ vector<string> parameters;
21046
+ unique_ptr<ParsedExpression> expression;
21040
21047
 
21041
21048
  public:
21042
21049
  string ToString() const override;
21043
21050
 
21044
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
21051
+ static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
21052
+ hash_t Hash() const override;
21045
21053
 
21046
21054
  unique_ptr<ParsedExpression> Copy() const override;
21047
21055
 
21048
21056
  void Serialize(FieldWriter &writer) const override;
21049
21057
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21050
21058
  };
21059
+
21051
21060
  } // namespace duckdb
21052
21061
  //===----------------------------------------------------------------------===//
21053
21062
  // DuckDB
21054
21063
  //
21055
- // duckdb/parser/expression/constant_expression.hpp
21064
+ // duckdb/parser/expression/case_expression.hpp
21056
21065
  //
21057
21066
  //
21058
21067
  //===----------------------------------------------------------------------===//
@@ -21064,31 +21073,34 @@ public:
21064
21073
 
21065
21074
  namespace duckdb {
21066
21075
 
21067
- //! ConstantExpression represents a constant value in the query
21068
- class ConstantExpression : public ParsedExpression {
21076
+ struct CaseCheck {
21077
+ unique_ptr<ParsedExpression> when_expr;
21078
+ unique_ptr<ParsedExpression> then_expr;
21079
+ };
21080
+
21081
+ //! The CaseExpression represents a CASE expression in the query
21082
+ class CaseExpression : public ParsedExpression {
21069
21083
  public:
21070
- explicit ConstantExpression(Value val);
21084
+ CaseExpression();
21071
21085
 
21072
- //! The constant value referenced
21073
- Value value;
21086
+ vector<CaseCheck> case_checks;
21087
+ unique_ptr<ParsedExpression> else_expr;
21074
21088
 
21075
21089
  public:
21076
21090
  string ToString() const override;
21077
21091
 
21078
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
21079
- hash_t Hash() const override;
21092
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
21080
21093
 
21081
21094
  unique_ptr<ParsedExpression> Copy() const override;
21082
21095
 
21083
21096
  void Serialize(FieldWriter &writer) const override;
21084
21097
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21085
21098
  };
21086
-
21087
21099
  } // namespace duckdb
21088
21100
  //===----------------------------------------------------------------------===//
21089
21101
  // DuckDB
21090
21102
  //
21091
- // duckdb/parser/expression/operator_expression.hpp
21103
+ // duckdb/parser/expression/conjunction_expression.hpp
21092
21104
  //
21093
21105
  //
21094
21106
  //===----------------------------------------------------------------------===//
@@ -21099,19 +21111,22 @@ public:
21099
21111
 
21100
21112
 
21101
21113
  namespace duckdb {
21102
- //! Represents a built-in operator expression
21103
- class OperatorExpression : public ParsedExpression {
21114
+
21115
+ //! Represents a conjunction (AND/OR)
21116
+ class ConjunctionExpression : public ParsedExpression {
21104
21117
  public:
21105
- explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
21106
- unique_ptr<ParsedExpression> right = nullptr);
21107
- OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21118
+ explicit ConjunctionExpression(ExpressionType type);
21119
+ ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21120
+ ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21108
21121
 
21109
21122
  vector<unique_ptr<ParsedExpression>> children;
21110
21123
 
21111
21124
  public:
21125
+ void AddExpression(unique_ptr<ParsedExpression> expr);
21126
+
21112
21127
  string ToString() const override;
21113
21128
 
21114
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
21129
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
21115
21130
 
21116
21131
  unique_ptr<ParsedExpression> Copy() const override;
21117
21132
 
@@ -21122,7 +21137,7 @@ public:
21122
21137
  //===----------------------------------------------------------------------===//
21123
21138
  // DuckDB
21124
21139
  //
21125
- // duckdb/parser/expression/subquery_expression.hpp
21140
+ // duckdb/parser/expression/function_expression.hpp
21126
21141
  //
21127
21142
  //
21128
21143
  //===----------------------------------------------------------------------===//
@@ -21134,34 +21149,68 @@ public:
21134
21149
 
21135
21150
 
21136
21151
  namespace duckdb {
21152
+ //! Represents a function call
21153
+ class FunctionExpression : public ParsedExpression {
21154
+ public:
21155
+ FunctionExpression(string schema_name, const string &function_name, vector<unique_ptr<ParsedExpression>> children,
21156
+ unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
21157
+ bool distinct = false, bool is_operator = false);
21158
+ FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
21159
+ unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
21160
+ bool distinct = false, bool is_operator = false);
21161
+
21162
+ //! Schema of the function
21163
+ string schema;
21164
+ //! Function name
21165
+ string function_name;
21166
+ //! Whether or not the function is an operator, only used for rendering
21167
+ bool is_operator;
21168
+ //! List of arguments to the function
21169
+ vector<unique_ptr<ParsedExpression>> children;
21170
+ //! Whether or not the aggregate function is distinct, only used for aggregates
21171
+ bool distinct;
21172
+ //! Expression representing a filter, only used for aggregates
21173
+ unique_ptr<ParsedExpression> filter;
21174
+ //! Modifier representing an ORDER BY, only used for aggregates
21175
+ unique_ptr<OrderModifier> order_bys;
21137
21176
 
21138
- //! Represents a subquery
21139
- class SubqueryExpression : public ParsedExpression {
21140
21177
  public:
21141
- SubqueryExpression();
21178
+ string ToString() const override;
21142
21179
 
21143
- //! The actual subquery
21144
- unique_ptr<SelectStatement> subquery;
21145
- //! The subquery type
21146
- SubqueryType subquery_type;
21147
- //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
21148
- //! subquery)
21149
- unique_ptr<ParsedExpression> child;
21150
- //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
21151
- ExpressionType comparison_type;
21180
+ unique_ptr<ParsedExpression> Copy() const override;
21181
+
21182
+ static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
21183
+ hash_t Hash() const override;
21184
+
21185
+ void Serialize(FieldWriter &writer) const override;
21186
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21187
+ };
21188
+ } // namespace duckdb
21189
+ //===----------------------------------------------------------------------===//
21190
+ // DuckDB
21191
+ //
21192
+ // duckdb/parser/expression/default_expression.hpp
21193
+ //
21194
+ //
21195
+ //===----------------------------------------------------------------------===//
21196
+
21197
+
21198
+
21199
+
21200
+
21201
+ namespace duckdb {
21202
+ //! Represents the default value of a column
21203
+ class DefaultExpression : public ParsedExpression {
21204
+ public:
21205
+ DefaultExpression();
21152
21206
 
21153
21207
  public:
21154
- bool HasSubquery() const override {
21155
- return true;
21156
- }
21157
21208
  bool IsScalar() const override {
21158
21209
  return false;
21159
21210
  }
21160
21211
 
21161
21212
  string ToString() const override;
21162
21213
 
21163
- static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
21164
-
21165
21214
  unique_ptr<ParsedExpression> Copy() const override;
21166
21215
 
21167
21216
  void Serialize(FieldWriter &writer) const override;
@@ -21171,7 +21220,7 @@ public:
21171
21220
  //===----------------------------------------------------------------------===//
21172
21221
  // DuckDB
21173
21222
  //
21174
- // duckdb/parser/expression/conjunction_expression.hpp
21223
+ // duckdb/parser/expression/comparison_expression.hpp
21175
21224
  //
21176
21225
  //
21177
21226
  //===----------------------------------------------------------------------===//
@@ -21180,24 +21229,20 @@ public:
21180
21229
 
21181
21230
 
21182
21231
 
21183
-
21184
21232
  namespace duckdb {
21185
-
21186
- //! Represents a conjunction (AND/OR)
21187
- class ConjunctionExpression : public ParsedExpression {
21233
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
21234
+ //! and has two children.
21235
+ class ComparisonExpression : public ParsedExpression {
21188
21236
  public:
21189
- explicit ConjunctionExpression(ExpressionType type);
21190
- ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21191
- ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21237
+ ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
21192
21238
 
21193
- vector<unique_ptr<ParsedExpression>> children;
21239
+ unique_ptr<ParsedExpression> left;
21240
+ unique_ptr<ParsedExpression> right;
21194
21241
 
21195
21242
  public:
21196
- void AddExpression(unique_ptr<ParsedExpression> expr);
21197
-
21198
21243
  string ToString() const override;
21199
21244
 
21200
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
21245
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
21201
21246
 
21202
21247
  unique_ptr<ParsedExpression> Copy() const override;
21203
21248
 
@@ -21208,7 +21253,7 @@ public:
21208
21253
  //===----------------------------------------------------------------------===//
21209
21254
  // DuckDB
21210
21255
  //
21211
- // duckdb/parser/expression/between_expression.hpp
21256
+ // duckdb/parser/expression/constant_expression.hpp
21212
21257
  //
21213
21258
  //
21214
21259
  //===----------------------------------------------------------------------===//
@@ -21217,32 +21262,34 @@ public:
21217
21262
 
21218
21263
 
21219
21264
 
21265
+
21220
21266
  namespace duckdb {
21221
21267
 
21222
- class BetweenExpression : public ParsedExpression {
21268
+ //! ConstantExpression represents a constant value in the query
21269
+ class ConstantExpression : public ParsedExpression {
21223
21270
  public:
21224
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
21225
- unique_ptr<ParsedExpression> upper);
21271
+ explicit ConstantExpression(Value val);
21226
21272
 
21227
- unique_ptr<ParsedExpression> input;
21228
- unique_ptr<ParsedExpression> lower;
21229
- unique_ptr<ParsedExpression> upper;
21273
+ //! The constant value referenced
21274
+ Value value;
21230
21275
 
21231
21276
  public:
21232
21277
  string ToString() const override;
21233
21278
 
21234
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
21279
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
21280
+ hash_t Hash() const override;
21235
21281
 
21236
21282
  unique_ptr<ParsedExpression> Copy() const override;
21237
21283
 
21238
21284
  void Serialize(FieldWriter &writer) const override;
21239
21285
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21240
21286
  };
21287
+
21241
21288
  } // namespace duckdb
21242
21289
  //===----------------------------------------------------------------------===//
21243
21290
  // DuckDB
21244
21291
  //
21245
- // duckdb/parser/expression/parameter_expression.hpp
21292
+ // duckdb/parser/expression/operator_expression.hpp
21246
21293
  //
21247
21294
  //
21248
21295
  //===----------------------------------------------------------------------===//
@@ -21251,25 +21298,23 @@ public:
21251
21298
 
21252
21299
 
21253
21300
 
21301
+
21254
21302
  namespace duckdb {
21255
- class ParameterExpression : public ParsedExpression {
21303
+ //! Represents a built-in operator expression
21304
+ class OperatorExpression : public ParsedExpression {
21256
21305
  public:
21257
- ParameterExpression();
21306
+ explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
21307
+ unique_ptr<ParsedExpression> right = nullptr);
21308
+ OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
21258
21309
 
21259
- idx_t parameter_nr;
21310
+ vector<unique_ptr<ParsedExpression>> children;
21260
21311
 
21261
21312
  public:
21262
- bool IsScalar() const override {
21263
- return true;
21264
- }
21265
- bool HasParameter() const override {
21266
- return true;
21267
- }
21268
-
21269
21313
  string ToString() const override;
21270
21314
 
21315
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
21316
+
21271
21317
  unique_ptr<ParsedExpression> Copy() const override;
21272
- hash_t Hash() const override;
21273
21318
 
21274
21319
  void Serialize(FieldWriter &writer) const override;
21275
21320
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
@@ -21278,7 +21323,7 @@ public:
21278
21323
  //===----------------------------------------------------------------------===//
21279
21324
  // DuckDB
21280
21325
  //
21281
- // duckdb/parser/expression/star_expression.hpp
21326
+ // duckdb/parser/expression/between_expression.hpp
21282
21327
  //
21283
21328
  //
21284
21329
  //===----------------------------------------------------------------------===//
@@ -21287,25 +21332,21 @@ public:
21287
21332
 
21288
21333
 
21289
21334
 
21290
-
21291
21335
  namespace duckdb {
21292
21336
 
21293
- //! Represents a * expression in the SELECT clause
21294
- class StarExpression : public ParsedExpression {
21337
+ class BetweenExpression : public ParsedExpression {
21295
21338
  public:
21296
- StarExpression(string relation_name = string());
21339
+ BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
21340
+ unique_ptr<ParsedExpression> upper);
21297
21341
 
21298
- //! The relation name in case of tbl.*, or empty if this is a normal *
21299
- string relation_name;
21300
- //! List of columns to exclude from the STAR expression
21301
- case_insensitive_set_t exclude_list;
21302
- //! List of columns to replace with another expression
21303
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
21342
+ unique_ptr<ParsedExpression> input;
21343
+ unique_ptr<ParsedExpression> lower;
21344
+ unique_ptr<ParsedExpression> upper;
21304
21345
 
21305
21346
  public:
21306
21347
  string ToString() const override;
21307
21348
 
21308
- static bool Equals(const StarExpression *a, const StarExpression *b);
21349
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
21309
21350
 
21310
21351
  unique_ptr<ParsedExpression> Copy() const override;
21311
21352
 
@@ -21316,7 +21357,7 @@ public:
21316
21357
  //===----------------------------------------------------------------------===//
21317
21358
  // DuckDB
21318
21359
  //
21319
- // duckdb/parser/expression/case_expression.hpp
21360
+ // duckdb/parser/expression/positional_reference_expression.hpp
21320
21361
  //
21321
21362
  //
21322
21363
  //===----------------------------------------------------------------------===//
@@ -21325,33 +21366,31 @@ public:
21325
21366
 
21326
21367
 
21327
21368
 
21328
-
21329
21369
  namespace duckdb {
21330
-
21331
- struct CaseCheck {
21332
- unique_ptr<ParsedExpression> when_expr;
21333
- unique_ptr<ParsedExpression> then_expr;
21334
- };
21335
-
21336
- //! The CaseExpression represents a CASE expression in the query
21337
- class CaseExpression : public ParsedExpression {
21370
+ class PositionalReferenceExpression : public ParsedExpression {
21338
21371
  public:
21339
- CaseExpression();
21372
+ PositionalReferenceExpression(idx_t index);
21340
21373
 
21341
- vector<CaseCheck> case_checks;
21342
- unique_ptr<ParsedExpression> else_expr;
21374
+ idx_t index;
21343
21375
 
21344
21376
  public:
21345
- string ToString() const override;
21377
+ bool IsScalar() const override {
21378
+ return false;
21379
+ }
21346
21380
 
21347
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
21381
+ string ToString() const override;
21348
21382
 
21383
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
21349
21384
  unique_ptr<ParsedExpression> Copy() const override;
21385
+ hash_t Hash() const override;
21350
21386
 
21351
21387
  void Serialize(FieldWriter &writer) const override;
21352
21388
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21353
21389
  };
21354
21390
  } // namespace duckdb
21391
+
21392
+
21393
+
21355
21394
  //===----------------------------------------------------------------------===//
21356
21395
  // DuckDB
21357
21396
  //
@@ -21390,10 +21429,11 @@ public:
21390
21429
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21391
21430
  };
21392
21431
  } // namespace duckdb
21432
+
21393
21433
  //===----------------------------------------------------------------------===//
21394
21434
  // DuckDB
21395
21435
  //
21396
- // duckdb/parser/expression/positional_reference_expression.hpp
21436
+ // duckdb/parser/expression/collate_expression.hpp
21397
21437
  //
21398
21438
  //
21399
21439
  //===----------------------------------------------------------------------===//
@@ -21403,31 +21443,41 @@ public:
21403
21443
 
21404
21444
 
21405
21445
  namespace duckdb {
21406
- class PositionalReferenceExpression : public ParsedExpression {
21446
+
21447
+ //! CollateExpression represents a COLLATE statement
21448
+ class CollateExpression : public ParsedExpression {
21407
21449
  public:
21408
- PositionalReferenceExpression(idx_t index);
21450
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
21409
21451
 
21410
- idx_t index;
21452
+ //! The child of the cast expression
21453
+ unique_ptr<ParsedExpression> child;
21454
+ //! The collation clause
21455
+ string collation;
21411
21456
 
21412
21457
  public:
21413
- bool IsScalar() const override {
21414
- return false;
21415
- }
21416
-
21417
21458
  string ToString() const override;
21418
21459
 
21419
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
21460
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
21461
+
21420
21462
  unique_ptr<ParsedExpression> Copy() const override;
21421
- hash_t Hash() const override;
21422
21463
 
21423
21464
  void Serialize(FieldWriter &writer) const override;
21424
21465
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21425
21466
  };
21426
21467
  } // namespace duckdb
21468
+
21469
+
21470
+
21471
+
21472
+
21473
+
21474
+
21475
+
21476
+
21427
21477
  //===----------------------------------------------------------------------===//
21428
21478
  // DuckDB
21429
21479
  //
21430
- // duckdb/parser/expression/lambda_expression.hpp
21480
+ // duckdb/parser/expression/parameter_expression.hpp
21431
21481
  //
21432
21482
  //
21433
21483
  //===----------------------------------------------------------------------===//
@@ -21436,39 +21486,36 @@ public:
21436
21486
 
21437
21487
 
21438
21488
 
21439
-
21440
21489
  namespace duckdb {
21441
-
21442
- //! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
21443
- //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
21444
- class LambdaExpression : public ParsedExpression {
21490
+ class ParameterExpression : public ParsedExpression {
21445
21491
  public:
21446
- LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21492
+ ParameterExpression();
21447
21493
 
21448
- vector<string> parameters;
21449
- unique_ptr<ParsedExpression> expression;
21494
+ idx_t parameter_nr;
21450
21495
 
21451
21496
  public:
21452
- string ToString() const override;
21497
+ bool IsScalar() const override {
21498
+ return true;
21499
+ }
21500
+ bool HasParameter() const override {
21501
+ return true;
21502
+ }
21453
21503
 
21454
- static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
21455
- hash_t Hash() const override;
21504
+ string ToString() const override;
21456
21505
 
21457
21506
  unique_ptr<ParsedExpression> Copy() const override;
21507
+ hash_t Hash() const override;
21458
21508
 
21459
21509
  void Serialize(FieldWriter &writer) const override;
21460
21510
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21461
21511
  };
21462
-
21463
21512
  } // namespace duckdb
21464
21513
 
21465
21514
 
21466
-
21467
-
21468
21515
  //===----------------------------------------------------------------------===//
21469
21516
  // DuckDB
21470
21517
  //
21471
- // duckdb/parser/expression/collate_expression.hpp
21518
+ // duckdb/parser/expression/star_expression.hpp
21472
21519
  //
21473
21520
  //
21474
21521
  //===----------------------------------------------------------------------===//
@@ -21477,22 +21524,25 @@ public:
21477
21524
 
21478
21525
 
21479
21526
 
21527
+
21480
21528
  namespace duckdb {
21481
21529
 
21482
- //! CollateExpression represents a COLLATE statement
21483
- class CollateExpression : public ParsedExpression {
21530
+ //! Represents a * expression in the SELECT clause
21531
+ class StarExpression : public ParsedExpression {
21484
21532
  public:
21485
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
21533
+ StarExpression(string relation_name = string());
21486
21534
 
21487
- //! The child of the cast expression
21488
- unique_ptr<ParsedExpression> child;
21489
- //! The collation clause
21490
- string collation;
21535
+ //! The relation name in case of tbl.*, or empty if this is a normal *
21536
+ string relation_name;
21537
+ //! List of columns to exclude from the STAR expression
21538
+ case_insensitive_set_t exclude_list;
21539
+ //! List of columns to replace with another expression
21540
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
21491
21541
 
21492
21542
  public:
21493
21543
  string ToString() const override;
21494
21544
 
21495
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
21545
+ static bool Equals(const StarExpression *a, const StarExpression *b);
21496
21546
 
21497
21547
  unique_ptr<ParsedExpression> Copy() const override;
21498
21548
 
@@ -21501,14 +21551,10 @@ public:
21501
21551
  };
21502
21552
  } // namespace duckdb
21503
21553
 
21504
-
21505
-
21506
-
21507
-
21508
21554
  //===----------------------------------------------------------------------===//
21509
21555
  // DuckDB
21510
21556
  //
21511
- // duckdb/parser/expression/default_expression.hpp
21557
+ // duckdb/parser/expression/subquery_expression.hpp
21512
21558
  //
21513
21559
  //
21514
21560
  //===----------------------------------------------------------------------===//
@@ -21517,19 +21563,37 @@ public:
21517
21563
 
21518
21564
 
21519
21565
 
21566
+
21567
+
21520
21568
  namespace duckdb {
21521
- //! Represents the default value of a column
21522
- class DefaultExpression : public ParsedExpression {
21569
+
21570
+ //! Represents a subquery
21571
+ class SubqueryExpression : public ParsedExpression {
21523
21572
  public:
21524
- DefaultExpression();
21573
+ SubqueryExpression();
21574
+
21575
+ //! The actual subquery
21576
+ unique_ptr<SelectStatement> subquery;
21577
+ //! The subquery type
21578
+ SubqueryType subquery_type;
21579
+ //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
21580
+ //! subquery)
21581
+ unique_ptr<ParsedExpression> child;
21582
+ //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
21583
+ ExpressionType comparison_type;
21525
21584
 
21526
21585
  public:
21586
+ bool HasSubquery() const override {
21587
+ return true;
21588
+ }
21527
21589
  bool IsScalar() const override {
21528
21590
  return false;
21529
21591
  }
21530
21592
 
21531
21593
  string ToString() const override;
21532
21594
 
21595
+ static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
21596
+
21533
21597
  unique_ptr<ParsedExpression> Copy() const override;
21534
21598
 
21535
21599
  void Serialize(FieldWriter &writer) const override;
@@ -21537,10 +21601,11 @@ public:
21537
21601
  };
21538
21602
  } // namespace duckdb
21539
21603
 
21604
+
21540
21605
  //===----------------------------------------------------------------------===//
21541
21606
  // DuckDB
21542
21607
  //
21543
- // duckdb/parser/expression/function_expression.hpp
21608
+ // duckdb/parser/parsed_data/create_collation_info.hpp
21544
21609
  //
21545
21610
  //
21546
21611
  //===----------------------------------------------------------------------===//
@@ -21550,57 +21615,105 @@ public:
21550
21615
 
21551
21616
 
21552
21617
 
21553
-
21554
21618
  namespace duckdb {
21555
- //! Represents a function call
21556
- class FunctionExpression : public ParsedExpression {
21557
- public:
21558
- FunctionExpression(string schema_name, const string &function_name, vector<unique_ptr<ParsedExpression>> children,
21559
- unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
21560
- bool distinct = false, bool is_operator = false);
21561
- FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
21562
- unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
21563
- bool distinct = false, bool is_operator = false);
21564
21619
 
21565
- //! Schema of the function
21566
- string schema;
21567
- //! Function name
21568
- string function_name;
21569
- //! Whether or not the function is an operator, only used for rendering
21570
- bool is_operator;
21571
- //! List of arguments to the function
21572
- vector<unique_ptr<ParsedExpression>> children;
21573
- //! Whether or not the aggregate function is distinct, only used for aggregates
21574
- bool distinct;
21575
- //! Expression representing a filter, only used for aggregates
21576
- unique_ptr<ParsedExpression> filter;
21577
- //! Modifier representing an ORDER BY, only used for aggregates
21578
- unique_ptr<OrderModifier> order_bys;
21620
+ struct CreateCollationInfo : public CreateInfo {
21621
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
21622
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
21623
+ not_required_for_equality(not_required_for_equality_p) {
21624
+ this->name = move(name_p);
21625
+ }
21626
+
21627
+ //! The name of the collation
21628
+ string name;
21629
+ //! The collation function to push in case collation is required
21630
+ ScalarFunction function;
21631
+ //! Whether or not the collation can be combined with other collations.
21632
+ bool combinable;
21633
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
21634
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
21635
+ //! speeds up processing.
21636
+ bool not_required_for_equality;
21579
21637
 
21580
21638
  public:
21581
- string ToString() const override;
21639
+ unique_ptr<CreateInfo> Copy() const override {
21640
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
21641
+ CopyProperties(*result);
21642
+ return move(result);
21643
+ }
21644
+ };
21582
21645
 
21583
- unique_ptr<ParsedExpression> Copy() const override;
21646
+ } // namespace duckdb
21647
+ //===----------------------------------------------------------------------===//
21648
+ // DuckDB
21649
+ //
21650
+ // duckdb/parser/parsed_data/vacuum_info.hpp
21651
+ //
21652
+ //
21653
+ //===----------------------------------------------------------------------===//
21584
21654
 
21585
- static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
21586
- hash_t Hash() const override;
21587
21655
 
21588
- void Serialize(FieldWriter &writer) const override;
21589
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
21656
+
21657
+
21658
+
21659
+ namespace duckdb {
21660
+
21661
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
21662
+
21663
+ struct LoadInfo : public ParseInfo {
21664
+ std::string filename;
21665
+ LoadType load_type;
21666
+
21667
+ public:
21668
+ unique_ptr<LoadInfo> Copy() const {
21669
+ auto result = make_unique<LoadInfo>();
21670
+ result->filename = filename;
21671
+ result->load_type = load_type;
21672
+ return result;
21673
+ }
21590
21674
  };
21675
+
21591
21676
  } // namespace duckdb
21677
+ //===----------------------------------------------------------------------===//
21678
+ // DuckDB
21679
+ //
21680
+ // duckdb/parser/parsed_data/show_select_info.hpp
21681
+ //
21682
+ //
21683
+ //===----------------------------------------------------------------------===//
21592
21684
 
21593
21685
 
21594
21686
 
21595
21687
 
21596
21688
 
21597
21689
 
21690
+ namespace duckdb {
21598
21691
 
21692
+ struct ShowSelectInfo : public ParseInfo {
21693
+ //! Types of projected columns
21694
+ vector<LogicalType> types;
21695
+ //! The QueryNode of select query
21696
+ unique_ptr<QueryNode> query;
21697
+ //! Aliases of projected columns
21698
+ vector<string> aliases;
21699
+ //! Whether or not we are requesting a summary or a describe
21700
+ bool is_summary;
21599
21701
 
21702
+ unique_ptr<ShowSelectInfo> Copy() {
21703
+ auto result = make_unique<ShowSelectInfo>();
21704
+ result->types = types;
21705
+ result->query = query->Copy();
21706
+ result->aliases = aliases;
21707
+ result->is_summary = is_summary;
21708
+ return result;
21709
+ }
21710
+ };
21711
+
21712
+ } // namespace duckdb
21600
21713
  //===----------------------------------------------------------------------===//
21601
21714
  // DuckDB
21602
21715
  //
21603
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
21716
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
21604
21717
  //
21605
21718
  //
21606
21719
  //===----------------------------------------------------------------------===//
@@ -21612,25 +21725,26 @@ public:
21612
21725
 
21613
21726
  namespace duckdb {
21614
21727
 
21615
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
21616
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
21617
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
21618
- functions.push_back(move(function));
21728
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
21729
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
21730
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
21619
21731
  this->name = function.name;
21732
+ functions.AddFunction(move(function));
21620
21733
  }
21621
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
21622
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
21623
- this->name = name;
21624
- for (auto &function : functions) {
21625
- function.name = name;
21734
+
21735
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
21736
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
21737
+ this->name = functions.name;
21738
+ for (auto &func : functions.functions) {
21739
+ func.name = functions.name;
21626
21740
  }
21627
21741
  }
21628
21742
 
21629
- vector<PragmaFunction> functions;
21743
+ AggregateFunctionSet functions;
21630
21744
 
21631
21745
  public:
21632
21746
  unique_ptr<CreateInfo> Copy() const override {
21633
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
21747
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
21634
21748
  CopyProperties(*result);
21635
21749
  return move(result);
21636
21750
  }
@@ -21640,7 +21754,7 @@ public:
21640
21754
  //===----------------------------------------------------------------------===//
21641
21755
  // DuckDB
21642
21756
  //
21643
- // duckdb/parser/parsed_data/create_collation_info.hpp
21757
+ // duckdb/parser/parsed_data/create_type_info.hpp
21644
21758
  //
21645
21759
  //
21646
21760
  //===----------------------------------------------------------------------===//
@@ -21650,30 +21764,26 @@ public:
21650
21764
 
21651
21765
 
21652
21766
 
21767
+
21768
+
21653
21769
  namespace duckdb {
21654
21770
 
21655
- struct CreateCollationInfo : public CreateInfo {
21656
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
21657
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
21658
- not_required_for_equality(not_required_for_equality_p) {
21659
- this->name = move(name_p);
21771
+ struct CreateTypeInfo : public CreateInfo {
21772
+
21773
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
21660
21774
  }
21661
21775
 
21662
- //! The name of the collation
21776
+ //! Name of the Type
21663
21777
  string name;
21664
- //! The collation function to push in case collation is required
21665
- ScalarFunction function;
21666
- //! Whether or not the collation can be combined with other collations.
21667
- bool combinable;
21668
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
21669
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
21670
- //! speeds up processing.
21671
- bool not_required_for_equality;
21778
+ //! Logical Type
21779
+ LogicalType type;
21672
21780
 
21673
21781
  public:
21674
21782
  unique_ptr<CreateInfo> Copy() const override {
21675
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
21783
+ auto result = make_unique<CreateTypeInfo>();
21676
21784
  CopyProperties(*result);
21785
+ result->name = name;
21786
+ result->type = type;
21677
21787
  return move(result);
21678
21788
  }
21679
21789
  };
@@ -21682,7 +21792,7 @@ public:
21682
21792
  //===----------------------------------------------------------------------===//
21683
21793
  // DuckDB
21684
21794
  //
21685
- // duckdb/parser/parsed_data/create_schema_info.hpp
21795
+ // duckdb/parser/parsed_data/vacuum_info.hpp
21686
21796
  //
21687
21797
  //
21688
21798
  //===----------------------------------------------------------------------===//
@@ -21693,16 +21803,8 @@ public:
21693
21803
 
21694
21804
  namespace duckdb {
21695
21805
 
21696
- struct CreateSchemaInfo : public CreateInfo {
21697
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
21698
- }
21699
-
21700
- public:
21701
- unique_ptr<CreateInfo> Copy() const override {
21702
- auto result = make_unique<CreateSchemaInfo>();
21703
- CopyProperties(*result);
21704
- return move(result);
21705
- }
21806
+ struct VacuumInfo : public ParseInfo {
21807
+ // nothing for now
21706
21808
  };
21707
21809
 
21708
21810
  } // namespace duckdb
@@ -21778,7 +21880,18 @@ struct TransactionInfo : public ParseInfo {
21778
21880
  //===----------------------------------------------------------------------===//
21779
21881
  // DuckDB
21780
21882
  //
21781
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
21883
+ // duckdb/parser/parsed_data/create_macro_info.hpp
21884
+ //
21885
+ //
21886
+ //===----------------------------------------------------------------------===//
21887
+
21888
+
21889
+
21890
+
21891
+ //===----------------------------------------------------------------------===//
21892
+ // DuckDB
21893
+ //
21894
+ // duckdb/function/macro_function.hpp
21782
21895
  //
21783
21896
  //
21784
21897
  //===----------------------------------------------------------------------===//
@@ -21788,28 +21901,74 @@ struct TransactionInfo : public ParseInfo {
21788
21901
 
21789
21902
 
21790
21903
 
21904
+
21905
+
21791
21906
  namespace duckdb {
21792
21907
 
21793
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
21794
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
21795
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
21796
- this->name = function.name;
21797
- functions.AddFunction(move(function));
21908
+ class MacroCatalogEntry;
21909
+
21910
+ class MacroFunction {
21911
+ public:
21912
+ explicit MacroFunction(unique_ptr<ParsedExpression> expression);
21913
+
21914
+ //! Check whether the supplied arguments are valid
21915
+ static string ValidateArguments(MacroCatalogEntry &macro_func, FunctionExpression &function_expr,
21916
+ vector<unique_ptr<ParsedExpression>> &positionals,
21917
+ unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
21918
+ //! The macro expression
21919
+ unique_ptr<ParsedExpression> expression;
21920
+ //! The positional parameters
21921
+ vector<unique_ptr<ParsedExpression>> parameters;
21922
+ //! The default parameters and their associated values
21923
+ unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
21924
+
21925
+ public:
21926
+ unique_ptr<MacroFunction> Copy();
21927
+ };
21928
+
21929
+ } // namespace duckdb
21930
+
21931
+
21932
+ namespace duckdb {
21933
+
21934
+ struct CreateMacroInfo : public CreateFunctionInfo {
21935
+ CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
21798
21936
  }
21799
21937
 
21800
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
21801
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
21802
- this->name = functions.name;
21803
- for (auto &func : functions.functions) {
21804
- func.name = functions.name;
21805
- }
21938
+ unique_ptr<MacroFunction> function;
21939
+
21940
+ public:
21941
+ unique_ptr<CreateInfo> Copy() const override {
21942
+ auto result = make_unique<CreateMacroInfo>();
21943
+ result->function = function->Copy();
21944
+ result->name = name;
21945
+ CopyProperties(*result);
21946
+ return move(result);
21806
21947
  }
21948
+ };
21949
+
21950
+ } // namespace duckdb
21951
+ //===----------------------------------------------------------------------===//
21952
+ // DuckDB
21953
+ //
21954
+ // duckdb/parser/parsed_data/create_schema_info.hpp
21955
+ //
21956
+ //
21957
+ //===----------------------------------------------------------------------===//
21958
+
21959
+
21807
21960
 
21808
- AggregateFunctionSet functions;
21961
+
21962
+
21963
+ namespace duckdb {
21964
+
21965
+ struct CreateSchemaInfo : public CreateInfo {
21966
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
21967
+ }
21809
21968
 
21810
21969
  public:
21811
21970
  unique_ptr<CreateInfo> Copy() const override {
21812
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
21971
+ auto result = make_unique<CreateSchemaInfo>();
21813
21972
  CopyProperties(*result);
21814
21973
  return move(result);
21815
21974
  }
@@ -21880,99 +22039,25 @@ struct CreateIndexInfo : public CreateInfo {
21880
22039
  //! Index Type (e.g., B+-tree, Skip-List, ...)
21881
22040
  IndexType index_type;
21882
22041
  //! Name of the Index
21883
- string index_name;
21884
- //! If it is an unique index
21885
- bool unique = false;
21886
- //! The table to create the index on
21887
- unique_ptr<BaseTableRef> table;
21888
- //! Set of expressions to index by
21889
- vector<unique_ptr<ParsedExpression>> expressions;
21890
-
21891
- public:
21892
- unique_ptr<CreateInfo> Copy() const override {
21893
- auto result = make_unique<CreateIndexInfo>();
21894
- CopyProperties(*result);
21895
- result->index_type = index_type;
21896
- result->index_name = index_name;
21897
- result->unique = unique;
21898
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
21899
- for (auto &expr : expressions) {
21900
- result->expressions.push_back(expr->Copy());
21901
- }
21902
- return move(result);
21903
- }
21904
- };
21905
-
21906
- } // namespace duckdb
21907
- //===----------------------------------------------------------------------===//
21908
- // DuckDB
21909
- //
21910
- // duckdb/parser/parsed_data/show_select_info.hpp
21911
- //
21912
- //
21913
- //===----------------------------------------------------------------------===//
21914
-
21915
-
21916
-
21917
-
21918
-
21919
-
21920
- namespace duckdb {
21921
-
21922
- struct ShowSelectInfo : public ParseInfo {
21923
- //! Types of projected columns
21924
- vector<LogicalType> types;
21925
- //! The QueryNode of select query
21926
- unique_ptr<QueryNode> query;
21927
- //! Aliases of projected columns
21928
- vector<string> aliases;
21929
- //! Whether or not we are requesting a summary or a describe
21930
- bool is_summary;
21931
-
21932
- unique_ptr<ShowSelectInfo> Copy() {
21933
- auto result = make_unique<ShowSelectInfo>();
21934
- result->types = types;
21935
- result->query = query->Copy();
21936
- result->aliases = aliases;
21937
- result->is_summary = is_summary;
21938
- return result;
21939
- }
21940
- };
21941
-
21942
- } // namespace duckdb
21943
- //===----------------------------------------------------------------------===//
21944
- // DuckDB
21945
- //
21946
- // duckdb/parser/parsed_data/create_type_info.hpp
21947
- //
21948
- //
21949
- //===----------------------------------------------------------------------===//
21950
-
21951
-
21952
-
21953
-
21954
-
21955
-
21956
-
21957
-
21958
- namespace duckdb {
21959
-
21960
- struct CreateTypeInfo : public CreateInfo {
21961
-
21962
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
21963
- }
21964
-
21965
- //! Name of the Type
21966
- string name;
21967
- //! Logical Type
21968
- LogicalType type;
22042
+ string index_name;
22043
+ //! If it is an unique index
22044
+ bool unique = false;
22045
+ //! The table to create the index on
22046
+ unique_ptr<BaseTableRef> table;
22047
+ //! Set of expressions to index by
22048
+ vector<unique_ptr<ParsedExpression>> expressions;
21969
22049
 
21970
22050
  public:
21971
22051
  unique_ptr<CreateInfo> Copy() const override {
21972
- auto result = make_unique<CreateTypeInfo>();
22052
+ auto result = make_unique<CreateIndexInfo>();
21973
22053
  CopyProperties(*result);
21974
- result->name = name;
21975
- result->type = type;
22054
+ result->index_type = index_type;
22055
+ result->index_name = index_name;
22056
+ result->unique = unique;
22057
+ result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
22058
+ for (auto &expr : expressions) {
22059
+ result->expressions.push_back(expr->Copy());
22060
+ }
21976
22061
  return move(result);
21977
22062
  }
21978
22063
  };
@@ -21981,18 +22066,7 @@ public:
21981
22066
  //===----------------------------------------------------------------------===//
21982
22067
  // DuckDB
21983
22068
  //
21984
- // duckdb/parser/parsed_data/create_macro_info.hpp
21985
- //
21986
- //
21987
- //===----------------------------------------------------------------------===//
21988
-
21989
-
21990
-
21991
-
21992
- //===----------------------------------------------------------------------===//
21993
- // DuckDB
21994
- //
21995
- // duckdb/function/macro_function.hpp
22069
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
21996
22070
  //
21997
22071
  //
21998
22072
  //===----------------------------------------------------------------------===//
@@ -22002,47 +22076,27 @@ public:
22002
22076
 
22003
22077
 
22004
22078
 
22005
-
22006
-
22007
- namespace duckdb {
22008
-
22009
- class MacroCatalogEntry;
22010
-
22011
- class MacroFunction {
22012
- public:
22013
- explicit MacroFunction(unique_ptr<ParsedExpression> expression);
22014
-
22015
- //! Check whether the supplied arguments are valid
22016
- static string ValidateArguments(MacroCatalogEntry &macro_func, FunctionExpression &function_expr,
22017
- vector<unique_ptr<ParsedExpression>> &positionals,
22018
- unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
22019
- //! The macro expression
22020
- unique_ptr<ParsedExpression> expression;
22021
- //! The positional parameters
22022
- vector<unique_ptr<ParsedExpression>> parameters;
22023
- //! The default parameters and their associated values
22024
- unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
22025
-
22026
- public:
22027
- unique_ptr<MacroFunction> Copy();
22028
- };
22029
-
22030
- } // namespace duckdb
22031
-
22032
-
22033
22079
  namespace duckdb {
22034
22080
 
22035
- struct CreateMacroInfo : public CreateFunctionInfo {
22036
- CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
22081
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
22082
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
22083
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
22084
+ functions.push_back(move(function));
22085
+ this->name = function.name;
22086
+ }
22087
+ CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
22088
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
22089
+ this->name = name;
22090
+ for (auto &function : functions) {
22091
+ function.name = name;
22092
+ }
22037
22093
  }
22038
22094
 
22039
- unique_ptr<MacroFunction> function;
22095
+ vector<PragmaFunction> functions;
22040
22096
 
22041
22097
  public:
22042
22098
  unique_ptr<CreateInfo> Copy() const override {
22043
- auto result = make_unique<CreateMacroInfo>();
22044
- result->function = function->Copy();
22045
- result->name = name;
22099
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
22046
22100
  CopyProperties(*result);
22047
22101
  return move(result);
22048
22102
  }
@@ -22079,25 +22133,6 @@ struct BoundExportData : public ParseInfo {
22079
22133
  unordered_map<TableCatalogEntry *, ExportedTableData> data;
22080
22134
  };
22081
22135
 
22082
- } // namespace duckdb
22083
- //===----------------------------------------------------------------------===//
22084
- // DuckDB
22085
- //
22086
- // duckdb/parser/parsed_data/vacuum_info.hpp
22087
- //
22088
- //
22089
- //===----------------------------------------------------------------------===//
22090
-
22091
-
22092
-
22093
-
22094
-
22095
- namespace duckdb {
22096
-
22097
- struct VacuumInfo : public ParseInfo {
22098
- // nothing for now
22099
- };
22100
-
22101
22136
  } // namespace duckdb
22102
22137
  //===----------------------------------------------------------------------===//
22103
22138
  // DuckDB
@@ -22145,7 +22180,7 @@ public:
22145
22180
  //===----------------------------------------------------------------------===//
22146
22181
  // DuckDB
22147
22182
  //
22148
- // duckdb/parser/parsed_data/vacuum_info.hpp
22183
+ // duckdb/parser/tableref/table_function_ref.hpp
22149
22184
  //
22150
22185
  //
22151
22186
  //===----------------------------------------------------------------------===//
@@ -22154,56 +22189,32 @@ public:
22154
22189
 
22155
22190
 
22156
22191
 
22157
- namespace duckdb {
22158
22192
 
22159
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
22160
22193
 
22161
- struct LoadInfo : public ParseInfo {
22162
- std::string filename;
22163
- LoadType load_type;
22164
22194
 
22195
+ namespace duckdb {
22196
+ //! Represents a Table producing function
22197
+ class TableFunctionRef : public TableRef {
22165
22198
  public:
22166
- unique_ptr<LoadInfo> Copy() const {
22167
- auto result = make_unique<LoadInfo>();
22168
- result->filename = filename;
22169
- result->load_type = load_type;
22170
- return result;
22199
+ TableFunctionRef() : TableRef(TableReferenceType::TABLE_FUNCTION) {
22171
22200
  }
22172
- };
22173
-
22174
- } // namespace duckdb
22175
- //===----------------------------------------------------------------------===//
22176
- // DuckDB
22177
- //
22178
- // duckdb/parser/tableref/subqueryref.hpp
22179
- //
22180
- //
22181
- //===----------------------------------------------------------------------===//
22182
-
22183
-
22184
-
22185
-
22186
22201
 
22202
+ unique_ptr<ParsedExpression> function;
22203
+ vector<string> column_name_alias;
22187
22204
 
22188
- namespace duckdb {
22189
- //! Represents a subquery
22190
- class SubqueryRef : public TableRef {
22191
- public:
22192
- explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
22193
-
22194
- //! The subquery
22205
+ // if the function takes a subquery as argument its in here
22195
22206
  unique_ptr<SelectStatement> subquery;
22196
- //! Aliases for the column names
22197
- vector<string> column_name_alias;
22198
22207
 
22199
22208
  public:
22209
+ string ToString() const override;
22210
+
22200
22211
  bool Equals(const TableRef *other_p) const override;
22201
22212
 
22202
22213
  unique_ptr<TableRef> Copy() override;
22203
22214
 
22204
- //! Serializes a blob into a SubqueryRef
22215
+ //! Serializes a blob into a BaseTableRef
22205
22216
  void Serialize(FieldWriter &serializer) const override;
22206
- //! Deserializes a blob back into a SubqueryRef
22217
+ //! Deserializes a blob back into a BaseTableRef
22207
22218
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
22208
22219
  };
22209
22220
  } // namespace duckdb
@@ -22245,7 +22256,7 @@ public:
22245
22256
  //===----------------------------------------------------------------------===//
22246
22257
  // DuckDB
22247
22258
  //
22248
- // duckdb/parser/tableref/joinref.hpp
22259
+ // duckdb/parser/tableref/emptytableref.hpp
22249
22260
  //
22250
22261
  //
22251
22262
  //===----------------------------------------------------------------------===//
@@ -22254,47 +22265,31 @@ public:
22254
22265
 
22255
22266
 
22256
22267
 
22257
-
22258
-
22259
-
22260
-
22261
22268
  namespace duckdb {
22262
- //! Represents a JOIN between two expressions
22263
- class JoinRef : public TableRef {
22269
+ //! Represents a cross product
22270
+ class EmptyTableRef : public TableRef {
22264
22271
  public:
22265
- JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
22272
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
22266
22273
  }
22267
22274
 
22268
- //! The left hand side of the join
22269
- unique_ptr<TableRef> left;
22270
- //! The right hand side of the join
22271
- unique_ptr<TableRef> right;
22272
- //! The join condition
22273
- unique_ptr<ParsedExpression> condition;
22274
- //! The join type
22275
- JoinType type;
22276
- //! Natural join
22277
- bool is_natural;
22278
- //! The set of USING columns (if any)
22279
- vector<string> using_columns;
22280
-
22281
22275
  public:
22282
22276
  bool Equals(const TableRef *other_p) const override;
22283
22277
 
22284
22278
  unique_ptr<TableRef> Copy() override;
22285
22279
 
22286
- //! Serializes a blob into a JoinRef
22280
+ //! Serializes a blob into a DummyTableRef
22287
22281
  void Serialize(FieldWriter &serializer) const override;
22288
- //! Deserializes a blob back into a JoinRef
22282
+ //! Deserializes a blob back into a DummyTableRef
22289
22283
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
22290
22284
  };
22291
22285
  } // namespace duckdb
22292
22286
 
22293
22287
 
22288
+
22294
22289
  //===----------------------------------------------------------------------===//
22295
22290
  // DuckDB
22296
22291
  //
22297
- // duckdb/parser/tableref/emptytableref.hpp
22292
+ // duckdb/parser/tableref/expressionlistref.hpp
22298
22293
  //
22299
22294
  //
22300
22295
  //===----------------------------------------------------------------------===//
@@ -22303,21 +22298,31 @@ public:
22303
22298
 
22304
22299
 
22305
22300
 
22301
+
22302
+
22303
+
22306
22304
  namespace duckdb {
22307
- //! Represents a cross product
22308
- class EmptyTableRef : public TableRef {
22305
+ //! Represents an expression list as generated by a VALUES statement
22306
+ class ExpressionListRef : public TableRef {
22309
22307
  public:
22310
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
22308
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
22311
22309
  }
22312
22310
 
22311
+ //! Value list, only used for VALUES statement
22312
+ vector<vector<unique_ptr<ParsedExpression>>> values;
22313
+ //! Expected SQL types
22314
+ vector<LogicalType> expected_types;
22315
+ //! The set of expected names
22316
+ vector<string> expected_names;
22317
+
22313
22318
  public:
22314
22319
  bool Equals(const TableRef *other_p) const override;
22315
22320
 
22316
22321
  unique_ptr<TableRef> Copy() override;
22317
22322
 
22318
- //! Serializes a blob into a DummyTableRef
22323
+ //! Serializes a blob into a ExpressionListRef
22319
22324
  void Serialize(FieldWriter &serializer) const override;
22320
- //! Deserializes a blob back into a DummyTableRef
22325
+ //! Deserializes a blob back into a ExpressionListRef
22321
22326
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
22322
22327
  };
22323
22328
  } // namespace duckdb
@@ -22325,7 +22330,7 @@ public:
22325
22330
  //===----------------------------------------------------------------------===//
22326
22331
  // DuckDB
22327
22332
  //
22328
- // duckdb/parser/tableref/expressionlistref.hpp
22333
+ // duckdb/parser/tableref/joinref.hpp
22329
22334
  //
22330
22335
  //
22331
22336
  //===----------------------------------------------------------------------===//
@@ -22337,38 +22342,43 @@ public:
22337
22342
 
22338
22343
 
22339
22344
 
22345
+
22340
22346
  namespace duckdb {
22341
- //! Represents an expression list as generated by a VALUES statement
22342
- class ExpressionListRef : public TableRef {
22347
+ //! Represents a JOIN between two expressions
22348
+ class JoinRef : public TableRef {
22343
22349
  public:
22344
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
22350
+ JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
22345
22351
  }
22346
22352
 
22347
- //! Value list, only used for VALUES statement
22348
- vector<vector<unique_ptr<ParsedExpression>>> values;
22349
- //! Expected SQL types
22350
- vector<LogicalType> expected_types;
22351
- //! The set of expected names
22352
- vector<string> expected_names;
22353
+ //! The left hand side of the join
22354
+ unique_ptr<TableRef> left;
22355
+ //! The right hand side of the join
22356
+ unique_ptr<TableRef> right;
22357
+ //! The join condition
22358
+ unique_ptr<ParsedExpression> condition;
22359
+ //! The join type
22360
+ JoinType type;
22361
+ //! Natural join
22362
+ bool is_natural;
22363
+ //! The set of USING columns (if any)
22364
+ vector<string> using_columns;
22353
22365
 
22354
22366
  public:
22355
22367
  bool Equals(const TableRef *other_p) const override;
22356
22368
 
22357
22369
  unique_ptr<TableRef> Copy() override;
22358
22370
 
22359
- //! Serializes a blob into a ExpressionListRef
22371
+ //! Serializes a blob into a JoinRef
22360
22372
  void Serialize(FieldWriter &serializer) const override;
22361
- //! Deserializes a blob back into a ExpressionListRef
22373
+ //! Deserializes a blob back into a JoinRef
22362
22374
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
22363
22375
  };
22364
22376
  } // namespace duckdb
22365
22377
 
22366
-
22367
-
22368
22378
  //===----------------------------------------------------------------------===//
22369
22379
  // DuckDB
22370
22380
  //
22371
- // duckdb/parser/tableref/table_function_ref.hpp
22381
+ // duckdb/parser/tableref/subqueryref.hpp
22372
22382
  //
22373
22383
  //
22374
22384
  //===----------------------------------------------------------------------===//
@@ -22378,32 +22388,27 @@ public:
22378
22388
 
22379
22389
 
22380
22390
 
22381
-
22382
-
22383
22391
  namespace duckdb {
22384
- //! Represents a Table producing function
22385
- class TableFunctionRef : public TableRef {
22392
+ //! Represents a subquery
22393
+ class SubqueryRef : public TableRef {
22386
22394
  public:
22387
- TableFunctionRef() : TableRef(TableReferenceType::TABLE_FUNCTION) {
22388
- }
22389
-
22390
- unique_ptr<ParsedExpression> function;
22391
- vector<string> column_name_alias;
22395
+ explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
22392
22396
 
22393
- // if the function takes a subquery as argument its in here
22397
+ //! The subquery
22394
22398
  unique_ptr<SelectStatement> subquery;
22399
+ //! Aliases for the column names
22400
+ vector<string> column_name_alias;
22395
22401
 
22396
22402
  public:
22397
- string ToString() const override;
22398
-
22399
22403
  bool Equals(const TableRef *other_p) const override;
22400
22404
 
22401
22405
  unique_ptr<TableRef> Copy() override;
22402
22406
 
22403
- //! Serializes a blob into a BaseTableRef
22407
+ //! Serializes a blob into a SubqueryRef
22404
22408
  void Serialize(FieldWriter &serializer) const override;
22405
- //! Deserializes a blob back into a BaseTableRef
22409
+ //! Deserializes a blob back into a SubqueryRef
22406
22410
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
22407
22411
  };
22408
22412
  } // namespace duckdb
22409
22413
 
22414
+