duckdb 0.4.1-dev5.0 → 0.4.1-dev61.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 "cb66edf41"
15
- #define DUCKDB_VERSION "v0.4.1-dev5"
14
+ #define DUCKDB_SOURCE_ID "cdb786d7e"
15
+ #define DUCKDB_VERSION "v0.4.1-dev61"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -401,6 +401,7 @@ DUCKDB_API void DuckDBAssertInternal(bool condition, const char *condition_name,
401
401
 
402
402
  #endif
403
403
 
404
+
404
405
  //===----------------------------------------------------------------------===//
405
406
  // DuckDB
406
407
  //
@@ -982,7 +983,7 @@ enum class LogicalTypeId : uint8_t {
982
983
 
983
984
  HUGEINT = 50,
984
985
  POINTER = 51,
985
- HASH = 52,
986
+ // HASH = 52, // deprecated, uses UBIGINT instead
986
987
  VALIDITY = 53,
987
988
  UUID = 54,
988
989
 
@@ -1094,7 +1095,7 @@ public:
1094
1095
  static constexpr const LogicalTypeId INTERVAL = LogicalTypeId::INTERVAL;
1095
1096
  static constexpr const LogicalTypeId HUGEINT = LogicalTypeId::HUGEINT;
1096
1097
  static constexpr const LogicalTypeId UUID = LogicalTypeId::UUID;
1097
- static constexpr const LogicalTypeId HASH = LogicalTypeId::HASH;
1098
+ static constexpr const LogicalTypeId HASH = LogicalTypeId::UBIGINT;
1098
1099
  static constexpr const LogicalTypeId POINTER = LogicalTypeId::POINTER;
1099
1100
  static constexpr const LogicalTypeId TABLE = LogicalTypeId::TABLE;
1100
1101
  static constexpr const LogicalTypeId INVALID = LogicalTypeId::INVALID;
@@ -10086,6 +10087,7 @@ private:
10086
10087
 
10087
10088
  } // namespace duckdb
10088
10089
 
10090
+
10089
10091
  namespace duckdb {
10090
10092
 
10091
10093
  class ClientContext;
@@ -10124,6 +10126,7 @@ public:
10124
10126
  };
10125
10127
 
10126
10128
  } // namespace duckdb
10129
+
10127
10130
  //===----------------------------------------------------------------------===//
10128
10131
  // DuckDB
10129
10132
  //
@@ -11264,6 +11267,7 @@ private:
11264
11267
 
11265
11268
  } // namespace duckdb
11266
11269
 
11270
+
11267
11271
  //===----------------------------------------------------------------------===//
11268
11272
  // DuckDB
11269
11273
  //
@@ -15358,6 +15362,7 @@ namespace duckdb {
15358
15362
  using std::deque;
15359
15363
  }
15360
15364
 
15365
+
15361
15366
  //===----------------------------------------------------------------------===//
15362
15367
  // DuckDB
15363
15368
  //
@@ -17435,6 +17440,7 @@ private:
17435
17440
 
17436
17441
 
17437
17442
 
17443
+
17438
17444
  //===----------------------------------------------------------------------===//
17439
17445
  // DuckDB
17440
17446
  //
@@ -17489,6 +17495,7 @@ private:
17489
17495
  };
17490
17496
 
17491
17497
  } // namespace duckdb
17498
+
17492
17499
  //===----------------------------------------------------------------------===//
17493
17500
  // DuckDB
17494
17501
  //
@@ -17697,6 +17704,7 @@ public:
17697
17704
 
17698
17705
  } // namespace duckdb
17699
17706
 
17707
+
17700
17708
  namespace duckdb {
17701
17709
  class Appender;
17702
17710
  class Catalog;
@@ -18087,6 +18095,7 @@ protected:
18087
18095
 
18088
18096
 
18089
18097
 
18098
+
18090
18099
  namespace duckdb {
18091
18100
 
18092
18101
  class ChunkCollection;
@@ -18701,6 +18710,7 @@ public:
18701
18710
 
18702
18711
  } // namespace duckdb
18703
18712
 
18713
+
18704
18714
  namespace duckdb {
18705
18715
  class StorageManager;
18706
18716
  class Catalog;
@@ -18732,6 +18742,8 @@ public:
18732
18742
 
18733
18743
  DUCKDB_API static DatabaseInstance &GetDatabase(ClientContext &context);
18734
18744
 
18745
+ DUCKDB_API const unordered_set<std::string> &LoadedExtensions();
18746
+
18735
18747
  private:
18736
18748
  void Initialize(const char *path, DBConfig *config);
18737
18749
 
@@ -18843,6 +18855,7 @@ ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook;
18843
18855
  }
18844
18856
  #endif
18845
18857
  #endif
18858
+
18846
18859
  //===----------------------------------------------------------------------===//
18847
18860
  // DuckDB
18848
18861
  //
@@ -22453,7 +22466,7 @@ protected:
22453
22466
  //! Format is literals[0], specifiers[0], literals[1], ..., specifiers[n - 1], literals[n]
22454
22467
  vector<string> literals;
22455
22468
  //! The constant size that appears in the format string
22456
- idx_t constant_size;
22469
+ idx_t constant_size = 0;
22457
22470
  //! The max numeric width of the specifier (if it is parsed as a number), or -1 if it is not a number
22458
22471
  vector<int> numeric_width;
22459
22472
 
@@ -22952,7 +22965,7 @@ private:
22952
22965
  //===----------------------------------------------------------------------===//
22953
22966
  // DuckDB
22954
22967
  //
22955
- // duckdb/parser/expression/conjunction_expression.hpp
22968
+ // duckdb/parser/expression/between_expression.hpp
22956
22969
  //
22957
22970
  //
22958
22971
  //===----------------------------------------------------------------------===//
@@ -22961,25 +22974,21 @@ private:
22961
22974
 
22962
22975
 
22963
22976
 
22964
-
22965
22977
  namespace duckdb {
22966
22978
 
22967
- //! Represents a conjunction (AND/OR)
22968
- class ConjunctionExpression : public ParsedExpression {
22979
+ class BetweenExpression : public ParsedExpression {
22969
22980
  public:
22970
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22971
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22972
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22973
- unique_ptr<ParsedExpression> right);
22981
+ DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22982
+ unique_ptr<ParsedExpression> upper);
22974
22983
 
22975
- vector<unique_ptr<ParsedExpression>> children;
22984
+ unique_ptr<ParsedExpression> input;
22985
+ unique_ptr<ParsedExpression> lower;
22986
+ unique_ptr<ParsedExpression> upper;
22976
22987
 
22977
22988
  public:
22978
- void AddExpression(unique_ptr<ParsedExpression> expr);
22979
-
22980
22989
  string ToString() const override;
22981
22990
 
22982
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22991
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22983
22992
 
22984
22993
  unique_ptr<ParsedExpression> Copy() const override;
22985
22994
 
@@ -22989,18 +22998,16 @@ public:
22989
22998
  public:
22990
22999
  template <class T, class BASE>
22991
23000
  static string ToString(const T &entry) {
22992
- string result = "(" + entry.children[0]->ToString();
22993
- for (idx_t i = 1; i < entry.children.size(); i++) {
22994
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22995
- }
22996
- return result + ")";
23001
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22997
23002
  }
22998
23003
  };
22999
23004
  } // namespace duckdb
23005
+
23006
+
23000
23007
  //===----------------------------------------------------------------------===//
23001
23008
  // DuckDB
23002
23009
  //
23003
- // duckdb/parser/expression/positional_reference_expression.hpp
23010
+ // duckdb/parser/expression/case_expression.hpp
23004
23011
  //
23005
23012
  //
23006
23013
  //===----------------------------------------------------------------------===//
@@ -23009,32 +23016,51 @@ public:
23009
23016
 
23010
23017
 
23011
23018
 
23019
+
23012
23020
  namespace duckdb {
23013
- class PositionalReferenceExpression : public ParsedExpression {
23014
- public:
23015
- DUCKDB_API PositionalReferenceExpression(idx_t index);
23016
23021
 
23017
- idx_t index;
23022
+ struct CaseCheck {
23023
+ unique_ptr<ParsedExpression> when_expr;
23024
+ unique_ptr<ParsedExpression> then_expr;
23025
+ };
23018
23026
 
23027
+ //! The CaseExpression represents a CASE expression in the query
23028
+ class CaseExpression : public ParsedExpression {
23019
23029
  public:
23020
- bool IsScalar() const override {
23021
- return false;
23022
- }
23030
+ DUCKDB_API CaseExpression();
23031
+
23032
+ vector<CaseCheck> case_checks;
23033
+ unique_ptr<ParsedExpression> else_expr;
23023
23034
 
23035
+ public:
23024
23036
  string ToString() const override;
23025
23037
 
23026
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
23038
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
23039
+
23027
23040
  unique_ptr<ParsedExpression> Copy() const override;
23028
- hash_t Hash() const override;
23029
23041
 
23030
23042
  void Serialize(FieldWriter &writer) const override;
23031
23043
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23044
+
23045
+ public:
23046
+ template <class T, class BASE>
23047
+ static string ToString(const T &entry) {
23048
+ string case_str = "CASE ";
23049
+ for (auto &check : entry.case_checks) {
23050
+ case_str += " WHEN (" + check.when_expr->ToString() + ")";
23051
+ case_str += " THEN (" + check.then_expr->ToString() + ")";
23052
+ }
23053
+ case_str += " ELSE " + entry.else_expr->ToString();
23054
+ case_str += " END";
23055
+ return case_str;
23056
+ }
23032
23057
  };
23033
23058
  } // namespace duckdb
23059
+
23034
23060
  //===----------------------------------------------------------------------===//
23035
23061
  // DuckDB
23036
23062
  //
23037
- // duckdb/parser/expression/star_expression.hpp
23063
+ // duckdb/parser/expression/cast_expression.hpp
23038
23064
  //
23039
23065
  //
23040
23066
  //===----------------------------------------------------------------------===//
@@ -23046,33 +23072,41 @@ public:
23046
23072
 
23047
23073
  namespace duckdb {
23048
23074
 
23049
- //! Represents a * expression in the SELECT clause
23050
- class StarExpression : public ParsedExpression {
23075
+ //! CastExpression represents a type cast from one SQL type to another SQL type
23076
+ class CastExpression : public ParsedExpression {
23051
23077
  public:
23052
- StarExpression(string relation_name = string());
23078
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
23053
23079
 
23054
- //! The relation name in case of tbl.*, or empty if this is a normal *
23055
- string relation_name;
23056
- //! List of columns to exclude from the STAR expression
23057
- case_insensitive_set_t exclude_list;
23058
- //! List of columns to replace with another expression
23059
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
23080
+ //! The child of the cast expression
23081
+ unique_ptr<ParsedExpression> child;
23082
+ //! The type to cast to
23083
+ LogicalType cast_type;
23084
+ //! Whether or not this is a try_cast expression
23085
+ bool try_cast;
23060
23086
 
23061
23087
  public:
23062
23088
  string ToString() const override;
23063
23089
 
23064
- static bool Equals(const StarExpression *a, const StarExpression *b);
23090
+ static bool Equals(const CastExpression *a, const CastExpression *b);
23065
23091
 
23066
23092
  unique_ptr<ParsedExpression> Copy() const override;
23067
23093
 
23068
23094
  void Serialize(FieldWriter &writer) const override;
23069
23095
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23096
+
23097
+ public:
23098
+ template <class T, class BASE>
23099
+ static string ToString(const T &entry) {
23100
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
23101
+ entry.cast_type.ToString() + ")";
23102
+ }
23070
23103
  };
23071
23104
  } // namespace duckdb
23105
+
23072
23106
  //===----------------------------------------------------------------------===//
23073
23107
  // DuckDB
23074
23108
  //
23075
- // duckdb/parser/expression/operator_expression.hpp
23109
+ // duckdb/parser/expression/collate_expression.hpp
23076
23110
  //
23077
23111
  //
23078
23112
  //===----------------------------------------------------------------------===//
@@ -23081,98 +23115,35 @@ public:
23081
23115
 
23082
23116
 
23083
23117
 
23084
-
23085
-
23086
-
23087
23118
  namespace duckdb {
23088
- //! Represents a built-in operator expression
23089
- class OperatorExpression : public ParsedExpression {
23119
+
23120
+ //! CollateExpression represents a COLLATE statement
23121
+ class CollateExpression : public ParsedExpression {
23090
23122
  public:
23091
- DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
23092
- unique_ptr<ParsedExpression> right = nullptr);
23093
- DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
23123
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
23094
23124
 
23095
- vector<unique_ptr<ParsedExpression>> children;
23125
+ //! The child of the cast expression
23126
+ unique_ptr<ParsedExpression> child;
23127
+ //! The collation clause
23128
+ string collation;
23096
23129
 
23097
23130
  public:
23098
23131
  string ToString() const override;
23099
23132
 
23100
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
23133
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
23101
23134
 
23102
23135
  unique_ptr<ParsedExpression> Copy() const override;
23103
23136
 
23104
23137
  void Serialize(FieldWriter &writer) const override;
23105
23138
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23106
-
23107
- public:
23108
- template <class T, class BASE>
23109
- static string ToString(const T &entry) {
23110
- auto op = ExpressionTypeToOperator(entry.type);
23111
- if (!op.empty()) {
23112
- // use the operator string to represent the operator
23113
- D_ASSERT(entry.children.size() == 2);
23114
- return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
23115
- }
23116
- switch (entry.type) {
23117
- case ExpressionType::COMPARE_IN:
23118
- case ExpressionType::COMPARE_NOT_IN: {
23119
- string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
23120
- string in_child = entry.children[0]->ToString();
23121
- string child_list = "(";
23122
- for (idx_t i = 1; i < entry.children.size(); i++) {
23123
- if (i > 1) {
23124
- child_list += ", ";
23125
- }
23126
- child_list += entry.children[i]->ToString();
23127
- }
23128
- child_list += ")";
23129
- return "(" + in_child + op_type + child_list + ")";
23130
- }
23131
- case ExpressionType::OPERATOR_NOT:
23132
- case ExpressionType::GROUPING_FUNCTION:
23133
- case ExpressionType::OPERATOR_COALESCE: {
23134
- string result = ExpressionTypeToString(entry.type);
23135
- result += "(";
23136
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
23137
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
23138
- result += ")";
23139
- return result;
23140
- }
23141
- case ExpressionType::OPERATOR_IS_NULL:
23142
- return "(" + entry.children[0]->ToString() + " IS NULL)";
23143
- case ExpressionType::OPERATOR_IS_NOT_NULL:
23144
- return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
23145
- case ExpressionType::ARRAY_EXTRACT:
23146
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
23147
- case ExpressionType::ARRAY_SLICE:
23148
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
23149
- entry.children[2]->ToString() + "]";
23150
- case ExpressionType::STRUCT_EXTRACT: {
23151
- D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
23152
- auto child_string = entry.children[1]->ToString();
23153
- D_ASSERT(child_string.size() >= 3);
23154
- D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
23155
- return "(" + entry.children[0]->ToString() + ")." +
23156
- KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
23157
- }
23158
- case ExpressionType::ARRAY_CONSTRUCTOR: {
23159
- string result = "(ARRAY[";
23160
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
23161
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
23162
- result += "])";
23163
- return result;
23164
- }
23165
- default:
23166
- throw InternalException("Unrecognized operator type");
23167
- }
23168
- }
23169
23139
  };
23170
-
23171
23140
  } // namespace duckdb
23141
+
23142
+
23172
23143
  //===----------------------------------------------------------------------===//
23173
23144
  // DuckDB
23174
23145
  //
23175
- // duckdb/parser/expression/constant_expression.hpp
23146
+ // duckdb/parser/expression/comparison_expression.hpp
23176
23147
  //
23177
23148
  //
23178
23149
  //===----------------------------------------------------------------------===//
@@ -23181,34 +23152,39 @@ public:
23181
23152
 
23182
23153
 
23183
23154
 
23184
-
23185
23155
  namespace duckdb {
23186
-
23187
- //! ConstantExpression represents a constant value in the query
23188
- class ConstantExpression : public ParsedExpression {
23156
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
23157
+ //! and has two children.
23158
+ class ComparisonExpression : public ParsedExpression {
23189
23159
  public:
23190
- DUCKDB_API explicit ConstantExpression(Value val);
23160
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
23161
+ unique_ptr<ParsedExpression> right);
23191
23162
 
23192
- //! The constant value referenced
23193
- Value value;
23163
+ unique_ptr<ParsedExpression> left;
23164
+ unique_ptr<ParsedExpression> right;
23194
23165
 
23195
23166
  public:
23196
23167
  string ToString() const override;
23197
23168
 
23198
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
23199
- hash_t Hash() const override;
23169
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
23200
23170
 
23201
23171
  unique_ptr<ParsedExpression> Copy() const override;
23202
23172
 
23203
23173
  void Serialize(FieldWriter &writer) const override;
23204
23174
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23205
- };
23206
23175
 
23176
+ public:
23177
+ template <class T, class BASE>
23178
+ static string ToString(const T &entry) {
23179
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
23180
+ }
23181
+ };
23207
23182
  } // namespace duckdb
23183
+
23208
23184
  //===----------------------------------------------------------------------===//
23209
23185
  // DuckDB
23210
23186
  //
23211
- // duckdb/parser/expression/subquery_expression.hpp
23187
+ // duckdb/parser/expression/conjunction_expression.hpp
23212
23188
  //
23213
23189
  //
23214
23190
  //===----------------------------------------------------------------------===//
@@ -23218,82 +23194,46 @@ public:
23218
23194
 
23219
23195
 
23220
23196
 
23221
-
23222
23197
  namespace duckdb {
23223
23198
 
23224
- //! Represents a subquery
23225
- class SubqueryExpression : public ParsedExpression {
23199
+ //! Represents a conjunction (AND/OR)
23200
+ class ConjunctionExpression : public ParsedExpression {
23226
23201
  public:
23227
- SubqueryExpression();
23202
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
23203
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
23204
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
23205
+ unique_ptr<ParsedExpression> right);
23228
23206
 
23229
- //! The actual subquery
23230
- unique_ptr<SelectStatement> subquery;
23231
- //! The subquery type
23232
- SubqueryType subquery_type;
23233
- //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
23234
- //! subquery)
23235
- unique_ptr<ParsedExpression> child;
23236
- //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
23237
- ExpressionType comparison_type;
23207
+ vector<unique_ptr<ParsedExpression>> children;
23238
23208
 
23239
23209
  public:
23240
- bool HasSubquery() const override {
23241
- return true;
23242
- }
23243
- bool IsScalar() const override {
23244
- return false;
23245
- }
23210
+ void AddExpression(unique_ptr<ParsedExpression> expr);
23246
23211
 
23247
23212
  string ToString() const override;
23248
23213
 
23249
- static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
23214
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
23250
23215
 
23251
23216
  unique_ptr<ParsedExpression> Copy() const override;
23252
23217
 
23253
23218
  void Serialize(FieldWriter &writer) const override;
23254
23219
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23255
- };
23256
- } // namespace duckdb
23257
- //===----------------------------------------------------------------------===//
23258
- // DuckDB
23259
- //
23260
- // duckdb/parser/expression/parameter_expression.hpp
23261
- //
23262
- //
23263
- //===----------------------------------------------------------------------===//
23264
-
23265
-
23266
-
23267
-
23268
-
23269
- namespace duckdb {
23270
- class ParameterExpression : public ParsedExpression {
23271
- public:
23272
- ParameterExpression();
23273
-
23274
- idx_t parameter_nr;
23275
23220
 
23276
23221
  public:
23277
- bool IsScalar() const override {
23278
- return true;
23279
- }
23280
- bool HasParameter() const override {
23281
- return true;
23222
+ template <class T, class BASE>
23223
+ static string ToString(const T &entry) {
23224
+ string result = "(" + entry.children[0]->ToString();
23225
+ for (idx_t i = 1; i < entry.children.size(); i++) {
23226
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
23227
+ }
23228
+ return result + ")";
23282
23229
  }
23283
-
23284
- string ToString() const override;
23285
-
23286
- unique_ptr<ParsedExpression> Copy() const override;
23287
- hash_t Hash() const override;
23288
-
23289
- void Serialize(FieldWriter &writer) const override;
23290
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23291
23230
  };
23292
23231
  } // namespace duckdb
23232
+
23293
23233
  //===----------------------------------------------------------------------===//
23294
23234
  // DuckDB
23295
23235
  //
23296
- // duckdb/parser/expression/between_expression.hpp
23236
+ // duckdb/parser/expression/constant_expression.hpp
23297
23237
  //
23298
23238
  //
23299
23239
  //===----------------------------------------------------------------------===//
@@ -23302,34 +23242,31 @@ public:
23302
23242
 
23303
23243
 
23304
23244
 
23245
+
23305
23246
  namespace duckdb {
23306
23247
 
23307
- class BetweenExpression : public ParsedExpression {
23248
+ //! ConstantExpression represents a constant value in the query
23249
+ class ConstantExpression : public ParsedExpression {
23308
23250
  public:
23309
- DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
23310
- unique_ptr<ParsedExpression> upper);
23251
+ DUCKDB_API explicit ConstantExpression(Value val);
23311
23252
 
23312
- unique_ptr<ParsedExpression> input;
23313
- unique_ptr<ParsedExpression> lower;
23314
- unique_ptr<ParsedExpression> upper;
23253
+ //! The constant value referenced
23254
+ Value value;
23315
23255
 
23316
23256
  public:
23317
23257
  string ToString() const override;
23318
23258
 
23319
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
23259
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
23260
+ hash_t Hash() const override;
23320
23261
 
23321
23262
  unique_ptr<ParsedExpression> Copy() const override;
23322
23263
 
23323
23264
  void Serialize(FieldWriter &writer) const override;
23324
23265
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23325
-
23326
- public:
23327
- template <class T, class BASE>
23328
- static string ToString(const T &entry) {
23329
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
23330
- }
23331
23266
  };
23267
+
23332
23268
  } // namespace duckdb
23269
+
23333
23270
  //===----------------------------------------------------------------------===//
23334
23271
  // DuckDB
23335
23272
  //
@@ -23362,187 +23299,6 @@ public:
23362
23299
  };
23363
23300
  } // namespace duckdb
23364
23301
 
23365
-
23366
- //===----------------------------------------------------------------------===//
23367
- // DuckDB
23368
- //
23369
- // duckdb/parser/expression/case_expression.hpp
23370
- //
23371
- //
23372
- //===----------------------------------------------------------------------===//
23373
-
23374
-
23375
-
23376
-
23377
-
23378
-
23379
- namespace duckdb {
23380
-
23381
- struct CaseCheck {
23382
- unique_ptr<ParsedExpression> when_expr;
23383
- unique_ptr<ParsedExpression> then_expr;
23384
- };
23385
-
23386
- //! The CaseExpression represents a CASE expression in the query
23387
- class CaseExpression : public ParsedExpression {
23388
- public:
23389
- DUCKDB_API CaseExpression();
23390
-
23391
- vector<CaseCheck> case_checks;
23392
- unique_ptr<ParsedExpression> else_expr;
23393
-
23394
- public:
23395
- string ToString() const override;
23396
-
23397
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
23398
-
23399
- unique_ptr<ParsedExpression> Copy() const override;
23400
-
23401
- void Serialize(FieldWriter &writer) const override;
23402
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23403
-
23404
- public:
23405
- template <class T, class BASE>
23406
- static string ToString(const T &entry) {
23407
- string case_str = "CASE ";
23408
- for (auto &check : entry.case_checks) {
23409
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
23410
- case_str += " THEN (" + check.then_expr->ToString() + ")";
23411
- }
23412
- case_str += " ELSE " + entry.else_expr->ToString();
23413
- case_str += " END";
23414
- return case_str;
23415
- }
23416
- };
23417
- } // namespace duckdb
23418
-
23419
- //===----------------------------------------------------------------------===//
23420
- // DuckDB
23421
- //
23422
- // duckdb/parser/expression/cast_expression.hpp
23423
- //
23424
- //
23425
- //===----------------------------------------------------------------------===//
23426
-
23427
-
23428
-
23429
-
23430
-
23431
-
23432
- namespace duckdb {
23433
-
23434
- //! CastExpression represents a type cast from one SQL type to another SQL type
23435
- class CastExpression : public ParsedExpression {
23436
- public:
23437
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
23438
-
23439
- //! The child of the cast expression
23440
- unique_ptr<ParsedExpression> child;
23441
- //! The type to cast to
23442
- LogicalType cast_type;
23443
- //! Whether or not this is a try_cast expression
23444
- bool try_cast;
23445
-
23446
- public:
23447
- string ToString() const override;
23448
-
23449
- static bool Equals(const CastExpression *a, const CastExpression *b);
23450
-
23451
- unique_ptr<ParsedExpression> Copy() const override;
23452
-
23453
- void Serialize(FieldWriter &writer) const override;
23454
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23455
-
23456
- public:
23457
- template <class T, class BASE>
23458
- static string ToString(const T &entry) {
23459
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
23460
- entry.cast_type.ToString() + ")";
23461
- }
23462
- };
23463
- } // namespace duckdb
23464
-
23465
- //===----------------------------------------------------------------------===//
23466
- // DuckDB
23467
- //
23468
- // duckdb/parser/expression/collate_expression.hpp
23469
- //
23470
- //
23471
- //===----------------------------------------------------------------------===//
23472
-
23473
-
23474
-
23475
-
23476
-
23477
- namespace duckdb {
23478
-
23479
- //! CollateExpression represents a COLLATE statement
23480
- class CollateExpression : public ParsedExpression {
23481
- public:
23482
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
23483
-
23484
- //! The child of the cast expression
23485
- unique_ptr<ParsedExpression> child;
23486
- //! The collation clause
23487
- string collation;
23488
-
23489
- public:
23490
- string ToString() const override;
23491
-
23492
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
23493
-
23494
- unique_ptr<ParsedExpression> Copy() const override;
23495
-
23496
- void Serialize(FieldWriter &writer) const override;
23497
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23498
- };
23499
- } // namespace duckdb
23500
-
23501
-
23502
- //===----------------------------------------------------------------------===//
23503
- // DuckDB
23504
- //
23505
- // duckdb/parser/expression/comparison_expression.hpp
23506
- //
23507
- //
23508
- //===----------------------------------------------------------------------===//
23509
-
23510
-
23511
-
23512
-
23513
-
23514
- namespace duckdb {
23515
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
23516
- //! and has two children.
23517
- class ComparisonExpression : public ParsedExpression {
23518
- public:
23519
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
23520
- unique_ptr<ParsedExpression> right);
23521
-
23522
- unique_ptr<ParsedExpression> left;
23523
- unique_ptr<ParsedExpression> right;
23524
-
23525
- public:
23526
- string ToString() const override;
23527
-
23528
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
23529
-
23530
- unique_ptr<ParsedExpression> Copy() const override;
23531
-
23532
- void Serialize(FieldWriter &writer) const override;
23533
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23534
-
23535
- public:
23536
- template <class T, class BASE>
23537
- static string ToString(const T &entry) {
23538
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
23539
- }
23540
- };
23541
- } // namespace duckdb
23542
-
23543
-
23544
-
23545
-
23546
23302
  //===----------------------------------------------------------------------===//
23547
23303
  // DuckDB
23548
23304
  //
@@ -23701,16 +23457,10 @@ public:
23701
23457
 
23702
23458
  } // namespace duckdb
23703
23459
 
23704
-
23705
-
23706
-
23707
-
23708
-
23709
-
23710
23460
  //===----------------------------------------------------------------------===//
23711
23461
  // DuckDB
23712
23462
  //
23713
- // duckdb/parser/parsed_data/vacuum_info.hpp
23463
+ // duckdb/parser/expression/operator_expression.hpp
23714
23464
  //
23715
23465
  //
23716
23466
  //===----------------------------------------------------------------------===//
@@ -23719,21 +23469,435 @@ public:
23719
23469
 
23720
23470
 
23721
23471
 
23722
- namespace duckdb {
23723
23472
 
23724
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23725
23473
 
23726
- struct LoadInfo : public ParseInfo {
23474
+
23475
+ namespace duckdb {
23476
+ //! Represents a built-in operator expression
23477
+ class OperatorExpression : public ParsedExpression {
23478
+ public:
23479
+ DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
23480
+ unique_ptr<ParsedExpression> right = nullptr);
23481
+ DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
23482
+
23483
+ vector<unique_ptr<ParsedExpression>> children;
23484
+
23485
+ public:
23486
+ string ToString() const override;
23487
+
23488
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
23489
+
23490
+ unique_ptr<ParsedExpression> Copy() const override;
23491
+
23492
+ void Serialize(FieldWriter &writer) const override;
23493
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23494
+
23495
+ public:
23496
+ template <class T, class BASE>
23497
+ static string ToString(const T &entry) {
23498
+ auto op = ExpressionTypeToOperator(entry.type);
23499
+ if (!op.empty()) {
23500
+ // use the operator string to represent the operator
23501
+ D_ASSERT(entry.children.size() == 2);
23502
+ return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
23503
+ }
23504
+ switch (entry.type) {
23505
+ case ExpressionType::COMPARE_IN:
23506
+ case ExpressionType::COMPARE_NOT_IN: {
23507
+ string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
23508
+ string in_child = entry.children[0]->ToString();
23509
+ string child_list = "(";
23510
+ for (idx_t i = 1; i < entry.children.size(); i++) {
23511
+ if (i > 1) {
23512
+ child_list += ", ";
23513
+ }
23514
+ child_list += entry.children[i]->ToString();
23515
+ }
23516
+ child_list += ")";
23517
+ return "(" + in_child + op_type + child_list + ")";
23518
+ }
23519
+ case ExpressionType::OPERATOR_NOT:
23520
+ case ExpressionType::GROUPING_FUNCTION:
23521
+ case ExpressionType::OPERATOR_COALESCE: {
23522
+ string result = ExpressionTypeToString(entry.type);
23523
+ result += "(";
23524
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
23525
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
23526
+ result += ")";
23527
+ return result;
23528
+ }
23529
+ case ExpressionType::OPERATOR_IS_NULL:
23530
+ return "(" + entry.children[0]->ToString() + " IS NULL)";
23531
+ case ExpressionType::OPERATOR_IS_NOT_NULL:
23532
+ return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
23533
+ case ExpressionType::ARRAY_EXTRACT:
23534
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
23535
+ case ExpressionType::ARRAY_SLICE:
23536
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
23537
+ entry.children[2]->ToString() + "]";
23538
+ case ExpressionType::STRUCT_EXTRACT: {
23539
+ D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
23540
+ auto child_string = entry.children[1]->ToString();
23541
+ D_ASSERT(child_string.size() >= 3);
23542
+ D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
23543
+ return "(" + entry.children[0]->ToString() + ")." +
23544
+ KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
23545
+ }
23546
+ case ExpressionType::ARRAY_CONSTRUCTOR: {
23547
+ string result = "(ARRAY[";
23548
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
23549
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
23550
+ result += "])";
23551
+ return result;
23552
+ }
23553
+ default:
23554
+ throw InternalException("Unrecognized operator type");
23555
+ }
23556
+ }
23557
+ };
23558
+
23559
+ } // namespace duckdb
23560
+
23561
+ //===----------------------------------------------------------------------===//
23562
+ // DuckDB
23563
+ //
23564
+ // duckdb/parser/expression/parameter_expression.hpp
23565
+ //
23566
+ //
23567
+ //===----------------------------------------------------------------------===//
23568
+
23569
+
23570
+
23571
+
23572
+
23573
+ namespace duckdb {
23574
+ class ParameterExpression : public ParsedExpression {
23575
+ public:
23576
+ ParameterExpression();
23577
+
23578
+ idx_t parameter_nr;
23579
+
23580
+ public:
23581
+ bool IsScalar() const override {
23582
+ return true;
23583
+ }
23584
+ bool HasParameter() const override {
23585
+ return true;
23586
+ }
23587
+
23588
+ string ToString() const override;
23589
+
23590
+ unique_ptr<ParsedExpression> Copy() const override;
23591
+ hash_t Hash() const override;
23592
+
23593
+ void Serialize(FieldWriter &writer) const override;
23594
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23595
+ };
23596
+ } // namespace duckdb
23597
+
23598
+ //===----------------------------------------------------------------------===//
23599
+ // DuckDB
23600
+ //
23601
+ // duckdb/parser/expression/positional_reference_expression.hpp
23602
+ //
23603
+ //
23604
+ //===----------------------------------------------------------------------===//
23605
+
23606
+
23607
+
23608
+
23609
+
23610
+ namespace duckdb {
23611
+ class PositionalReferenceExpression : public ParsedExpression {
23612
+ public:
23613
+ DUCKDB_API PositionalReferenceExpression(idx_t index);
23614
+
23615
+ idx_t index;
23616
+
23617
+ public:
23618
+ bool IsScalar() const override {
23619
+ return false;
23620
+ }
23621
+
23622
+ string ToString() const override;
23623
+
23624
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
23625
+ unique_ptr<ParsedExpression> Copy() const override;
23626
+ hash_t Hash() const override;
23627
+
23628
+ void Serialize(FieldWriter &writer) const override;
23629
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23630
+ };
23631
+ } // namespace duckdb
23632
+
23633
+ //===----------------------------------------------------------------------===//
23634
+ // DuckDB
23635
+ //
23636
+ // duckdb/parser/expression/star_expression.hpp
23637
+ //
23638
+ //
23639
+ //===----------------------------------------------------------------------===//
23640
+
23641
+
23642
+
23643
+
23644
+
23645
+
23646
+ namespace duckdb {
23647
+
23648
+ //! Represents a * expression in the SELECT clause
23649
+ class StarExpression : public ParsedExpression {
23650
+ public:
23651
+ StarExpression(string relation_name = string());
23652
+
23653
+ //! The relation name in case of tbl.*, or empty if this is a normal *
23654
+ string relation_name;
23655
+ //! List of columns to exclude from the STAR expression
23656
+ case_insensitive_set_t exclude_list;
23657
+ //! List of columns to replace with another expression
23658
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
23659
+
23660
+ public:
23661
+ string ToString() const override;
23662
+
23663
+ static bool Equals(const StarExpression *a, const StarExpression *b);
23664
+
23665
+ unique_ptr<ParsedExpression> Copy() const override;
23666
+
23667
+ void Serialize(FieldWriter &writer) const override;
23668
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23669
+ };
23670
+ } // namespace duckdb
23671
+
23672
+ //===----------------------------------------------------------------------===//
23673
+ // DuckDB
23674
+ //
23675
+ // duckdb/parser/expression/subquery_expression.hpp
23676
+ //
23677
+ //
23678
+ //===----------------------------------------------------------------------===//
23679
+
23680
+
23681
+
23682
+
23683
+
23684
+
23685
+
23686
+ namespace duckdb {
23687
+
23688
+ //! Represents a subquery
23689
+ class SubqueryExpression : public ParsedExpression {
23690
+ public:
23691
+ SubqueryExpression();
23692
+
23693
+ //! The actual subquery
23694
+ unique_ptr<SelectStatement> subquery;
23695
+ //! The subquery type
23696
+ SubqueryType subquery_type;
23697
+ //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
23698
+ //! subquery)
23699
+ unique_ptr<ParsedExpression> child;
23700
+ //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
23701
+ ExpressionType comparison_type;
23702
+
23703
+ public:
23704
+ bool HasSubquery() const override {
23705
+ return true;
23706
+ }
23707
+ bool IsScalar() const override {
23708
+ return false;
23709
+ }
23710
+
23711
+ string ToString() const override;
23712
+
23713
+ static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
23714
+
23715
+ unique_ptr<ParsedExpression> Copy() const override;
23716
+
23717
+ void Serialize(FieldWriter &writer) const override;
23718
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23719
+ };
23720
+ } // namespace duckdb
23721
+
23722
+
23723
+ //===----------------------------------------------------------------------===//
23724
+ // DuckDB
23725
+ //
23726
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23727
+ //
23728
+ //
23729
+ //===----------------------------------------------------------------------===//
23730
+
23731
+
23732
+
23733
+
23734
+
23735
+ namespace duckdb {
23736
+
23737
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23738
+
23739
+ struct LoadInfo : public ParseInfo {
23727
23740
  std::string filename;
23728
23741
  LoadType load_type;
23729
23742
 
23730
- public:
23731
- unique_ptr<LoadInfo> Copy() const {
23732
- auto result = make_unique<LoadInfo>();
23733
- result->filename = filename;
23734
- result->load_type = load_type;
23735
- return result;
23743
+ public:
23744
+ unique_ptr<LoadInfo> Copy() const {
23745
+ auto result = make_unique<LoadInfo>();
23746
+ result->filename = filename;
23747
+ result->load_type = load_type;
23748
+ return result;
23749
+ }
23750
+ };
23751
+
23752
+ } // namespace duckdb
23753
+ //===----------------------------------------------------------------------===//
23754
+ // DuckDB
23755
+ //
23756
+ // duckdb/parser/parsed_data/create_type_info.hpp
23757
+ //
23758
+ //
23759
+ //===----------------------------------------------------------------------===//
23760
+
23761
+
23762
+
23763
+
23764
+
23765
+
23766
+
23767
+
23768
+ namespace duckdb {
23769
+
23770
+ struct CreateTypeInfo : public CreateInfo {
23771
+
23772
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23773
+ }
23774
+
23775
+ //! Name of the Type
23776
+ string name;
23777
+ //! Logical Type
23778
+ LogicalType type;
23779
+
23780
+ public:
23781
+ unique_ptr<CreateInfo> Copy() const override {
23782
+ auto result = make_unique<CreateTypeInfo>();
23783
+ CopyProperties(*result);
23784
+ result->name = name;
23785
+ result->type = type;
23786
+ return move(result);
23787
+ }
23788
+ };
23789
+
23790
+ } // namespace duckdb
23791
+ //===----------------------------------------------------------------------===//
23792
+ // DuckDB
23793
+ //
23794
+ // duckdb/parser/parsed_data/create_index_info.hpp
23795
+ //
23796
+ //
23797
+ //===----------------------------------------------------------------------===//
23798
+
23799
+
23800
+
23801
+
23802
+
23803
+
23804
+ //===----------------------------------------------------------------------===//
23805
+ // DuckDB
23806
+ //
23807
+ // duckdb/parser/tableref/basetableref.hpp
23808
+ //
23809
+ //
23810
+ //===----------------------------------------------------------------------===//
23811
+
23812
+
23813
+
23814
+
23815
+
23816
+
23817
+ namespace duckdb {
23818
+ //! Represents a TableReference to a base table in the schema
23819
+ class BaseTableRef : public TableRef {
23820
+ public:
23821
+ BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
23822
+ }
23823
+
23824
+ //! Schema name
23825
+ string schema_name;
23826
+ //! Table name
23827
+ string table_name;
23828
+ //! Aliases for the column names
23829
+ vector<string> column_name_alias;
23830
+
23831
+ public:
23832
+ string ToString() const override;
23833
+ bool Equals(const TableRef *other_p) const override;
23834
+
23835
+ unique_ptr<TableRef> Copy() override;
23836
+
23837
+ //! Serializes a blob into a BaseTableRef
23838
+ void Serialize(FieldWriter &serializer) const override;
23839
+ //! Deserializes a blob back into a BaseTableRef
23840
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
23841
+ };
23842
+ } // namespace duckdb
23843
+
23844
+
23845
+
23846
+ namespace duckdb {
23847
+
23848
+ struct CreateIndexInfo : public CreateInfo {
23849
+ CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
23850
+ }
23851
+
23852
+ //! Index Type (e.g., B+-tree, Skip-List, ...)
23853
+ IndexType index_type;
23854
+ //! Name of the Index
23855
+ string index_name;
23856
+ //! If it is an unique index
23857
+ bool unique = false;
23858
+ //! The table to create the index on
23859
+ unique_ptr<BaseTableRef> table;
23860
+ //! Set of expressions to index by
23861
+ vector<unique_ptr<ParsedExpression>> expressions;
23862
+
23863
+ public:
23864
+ unique_ptr<CreateInfo> Copy() const override {
23865
+ auto result = make_unique<CreateIndexInfo>();
23866
+ CopyProperties(*result);
23867
+ result->index_type = index_type;
23868
+ result->index_name = index_name;
23869
+ result->unique = unique;
23870
+ result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
23871
+ for (auto &expr : expressions) {
23872
+ result->expressions.push_back(expr->Copy());
23873
+ }
23874
+ return move(result);
23875
+ }
23876
+ };
23877
+
23878
+ } // namespace duckdb
23879
+ //===----------------------------------------------------------------------===//
23880
+ // DuckDB
23881
+ //
23882
+ // duckdb/parser/parsed_data/transaction_info.hpp
23883
+ //
23884
+ //
23885
+ //===----------------------------------------------------------------------===//
23886
+
23887
+
23888
+
23889
+
23890
+
23891
+ namespace duckdb {
23892
+
23893
+ enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
23894
+
23895
+ struct TransactionInfo : public ParseInfo {
23896
+ explicit TransactionInfo(TransactionType type) : type(type) {
23736
23897
  }
23898
+
23899
+ //! The type of transaction statement
23900
+ TransactionType type;
23737
23901
  };
23738
23902
 
23739
23903
  } // namespace duckdb
@@ -23776,6 +23940,25 @@ public:
23776
23940
  }
23777
23941
  };
23778
23942
 
23943
+ } // namespace duckdb
23944
+ //===----------------------------------------------------------------------===//
23945
+ // DuckDB
23946
+ //
23947
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23948
+ //
23949
+ //
23950
+ //===----------------------------------------------------------------------===//
23951
+
23952
+
23953
+
23954
+
23955
+
23956
+ namespace duckdb {
23957
+
23958
+ struct VacuumInfo : public ParseInfo {
23959
+ // nothing for now
23960
+ };
23961
+
23779
23962
  } // namespace duckdb
23780
23963
  //===----------------------------------------------------------------------===//
23781
23964
  // DuckDB
@@ -23824,106 +24007,38 @@ public:
23824
24007
  //===----------------------------------------------------------------------===//
23825
24008
  // DuckDB
23826
24009
  //
23827
- // duckdb/parser/parsed_data/transaction_info.hpp
23828
- //
23829
- //
23830
- //===----------------------------------------------------------------------===//
23831
-
23832
-
23833
-
23834
-
23835
-
23836
- namespace duckdb {
23837
-
23838
- enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
23839
-
23840
- struct TransactionInfo : public ParseInfo {
23841
- explicit TransactionInfo(TransactionType type) : type(type) {
23842
- }
23843
-
23844
- //! The type of transaction statement
23845
- TransactionType type;
23846
- };
23847
-
23848
- } // namespace duckdb
23849
- //===----------------------------------------------------------------------===//
23850
- // DuckDB
23851
- //
23852
- // duckdb/parser/parsed_data/create_macro_info.hpp
23853
- //
23854
- //
23855
- //===----------------------------------------------------------------------===//
23856
-
23857
-
23858
-
23859
-
23860
- //===----------------------------------------------------------------------===//
23861
- // DuckDB
23862
- //
23863
- // duckdb/function/macro_function.hpp
24010
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23864
24011
  //
23865
24012
  //
23866
24013
  //===----------------------------------------------------------------------===//
23867
24014
 
23868
24015
 
23869
- //! The SelectStatement of the view
23870
-
23871
-
23872
-
23873
-
23874
-
23875
-
23876
-
23877
- namespace duckdb {
23878
-
23879
- enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
23880
-
23881
- class MacroFunction {
23882
- public:
23883
- // explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23884
- MacroFunction(MacroType type);
23885
-
23886
- // MacroFunction(void);
23887
- // The type
23888
- MacroType type;
23889
- //! The positional parameters
23890
- vector<unique_ptr<ParsedExpression>> parameters;
23891
- //! The default parameters and their associated values
23892
- unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
23893
-
23894
- public:
23895
- virtual ~MacroFunction() {
23896
- }
23897
-
23898
- void CopyProperties(MacroFunction &other);
23899
-
23900
- virtual unique_ptr<MacroFunction> Copy() = 0;
23901
24016
 
23902
- static string ValidateArguments(MacroFunction &macro_function, const string &name,
23903
- FunctionExpression &function_expr,
23904
- vector<unique_ptr<ParsedExpression>> &positionals,
23905
- unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
23906
- };
23907
24017
 
23908
- } // namespace duckdb
23909
24018
 
23910
24019
 
23911
24020
  namespace duckdb {
23912
24021
 
23913
- struct CreateMacroInfo : public CreateFunctionInfo {
23914
- CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
24022
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
24023
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
24024
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
24025
+ this->name = function.name;
24026
+ functions.AddFunction(move(function));
23915
24027
  }
23916
24028
 
23917
- CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
24029
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
24030
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
24031
+ this->name = functions.name;
24032
+ for (auto &func : functions.functions) {
24033
+ func.name = functions.name;
24034
+ }
23918
24035
  }
23919
24036
 
23920
- unique_ptr<MacroFunction> function;
24037
+ AggregateFunctionSet functions;
23921
24038
 
23922
24039
  public:
23923
24040
  unique_ptr<CreateInfo> Copy() const override {
23924
- auto result = make_unique<CreateMacroInfo>();
23925
- result->function = function->Copy();
23926
- result->name = name;
24041
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23927
24042
  CopyProperties(*result);
23928
24043
  return move(result);
23929
24044
  }
@@ -23945,130 +24060,23 @@ public:
23945
24060
 
23946
24061
  namespace duckdb {
23947
24062
 
23948
- struct ShowSelectInfo : public ParseInfo {
23949
- //! Types of projected columns
23950
- vector<LogicalType> types;
23951
- //! The QueryNode of select query
23952
- unique_ptr<QueryNode> query;
23953
- //! Aliases of projected columns
23954
- vector<string> aliases;
23955
- //! Whether or not we are requesting a summary or a describe
23956
- bool is_summary;
23957
-
23958
- unique_ptr<ShowSelectInfo> Copy() {
23959
- auto result = make_unique<ShowSelectInfo>();
23960
- result->types = types;
23961
- result->query = query->Copy();
23962
- result->aliases = aliases;
23963
- result->is_summary = is_summary;
23964
- return result;
23965
- }
23966
- };
23967
-
23968
- } // namespace duckdb
23969
- //===----------------------------------------------------------------------===//
23970
- // DuckDB
23971
- //
23972
- // duckdb/parser/parsed_data/vacuum_info.hpp
23973
- //
23974
- //
23975
- //===----------------------------------------------------------------------===//
23976
-
23977
-
23978
-
23979
-
23980
-
23981
- namespace duckdb {
23982
-
23983
- struct VacuumInfo : public ParseInfo {
23984
- // nothing for now
23985
- };
23986
-
23987
- } // namespace duckdb
23988
- //===----------------------------------------------------------------------===//
23989
- // DuckDB
23990
- //
23991
- // duckdb/parser/parsed_data/create_index_info.hpp
23992
- //
23993
- //
23994
- //===----------------------------------------------------------------------===//
23995
-
23996
-
23997
-
23998
-
23999
-
24000
-
24001
- //===----------------------------------------------------------------------===//
24002
- // DuckDB
24003
- //
24004
- // duckdb/parser/tableref/basetableref.hpp
24005
- //
24006
- //
24007
- //===----------------------------------------------------------------------===//
24008
-
24009
-
24010
-
24011
-
24012
-
24013
-
24014
- namespace duckdb {
24015
- //! Represents a TableReference to a base table in the schema
24016
- class BaseTableRef : public TableRef {
24017
- public:
24018
- BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
24019
- }
24020
-
24021
- //! Schema name
24022
- string schema_name;
24023
- //! Table name
24024
- string table_name;
24025
- //! Aliases for the column names
24026
- vector<string> column_name_alias;
24027
-
24028
- public:
24029
- string ToString() const override;
24030
- bool Equals(const TableRef *other_p) const override;
24031
-
24032
- unique_ptr<TableRef> Copy() override;
24033
-
24034
- //! Serializes a blob into a BaseTableRef
24035
- void Serialize(FieldWriter &serializer) const override;
24036
- //! Deserializes a blob back into a BaseTableRef
24037
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
24038
- };
24039
- } // namespace duckdb
24040
-
24041
-
24042
-
24043
- namespace duckdb {
24044
-
24045
- struct CreateIndexInfo : public CreateInfo {
24046
- CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
24047
- }
24048
-
24049
- //! Index Type (e.g., B+-tree, Skip-List, ...)
24050
- IndexType index_type;
24051
- //! Name of the Index
24052
- string index_name;
24053
- //! If it is an unique index
24054
- bool unique = false;
24055
- //! The table to create the index on
24056
- unique_ptr<BaseTableRef> table;
24057
- //! Set of expressions to index by
24058
- vector<unique_ptr<ParsedExpression>> expressions;
24059
-
24060
- public:
24061
- unique_ptr<CreateInfo> Copy() const override {
24062
- auto result = make_unique<CreateIndexInfo>();
24063
- CopyProperties(*result);
24064
- result->index_type = index_type;
24065
- result->index_name = index_name;
24066
- result->unique = unique;
24067
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
24068
- for (auto &expr : expressions) {
24069
- result->expressions.push_back(expr->Copy());
24070
- }
24071
- return move(result);
24063
+ struct ShowSelectInfo : public ParseInfo {
24064
+ //! Types of projected columns
24065
+ vector<LogicalType> types;
24066
+ //! The QueryNode of select query
24067
+ unique_ptr<QueryNode> query;
24068
+ //! Aliases of projected columns
24069
+ vector<string> aliases;
24070
+ //! Whether or not we are requesting a summary or a describe
24071
+ bool is_summary;
24072
+
24073
+ unique_ptr<ShowSelectInfo> Copy() {
24074
+ auto result = make_unique<ShowSelectInfo>();
24075
+ result->types = types;
24076
+ result->query = query->Copy();
24077
+ result->aliases = aliases;
24078
+ result->is_summary = is_summary;
24079
+ return result;
24072
24080
  }
24073
24081
  };
24074
24082
 
@@ -24112,7 +24120,7 @@ struct BoundExportData : public ParseInfo {
24112
24120
  //===----------------------------------------------------------------------===//
24113
24121
  // DuckDB
24114
24122
  //
24115
- // duckdb/parser/parsed_data/create_schema_info.hpp
24123
+ // duckdb/parser/parsed_data/create_macro_info.hpp
24116
24124
  //
24117
24125
  //
24118
24126
  //===----------------------------------------------------------------------===//
@@ -24120,57 +24128,73 @@ struct BoundExportData : public ParseInfo {
24120
24128
 
24121
24129
 
24122
24130
 
24123
-
24124
- namespace duckdb {
24125
-
24126
- struct CreateSchemaInfo : public CreateInfo {
24127
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
24128
- }
24129
-
24130
- public:
24131
- unique_ptr<CreateInfo> Copy() const override {
24132
- auto result = make_unique<CreateSchemaInfo>();
24133
- CopyProperties(*result);
24134
- return move(result);
24135
- }
24136
- };
24137
-
24138
- } // namespace duckdb
24139
24131
  //===----------------------------------------------------------------------===//
24140
24132
  // DuckDB
24141
24133
  //
24142
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
24134
+ // duckdb/function/macro_function.hpp
24143
24135
  //
24144
24136
  //
24145
24137
  //===----------------------------------------------------------------------===//
24146
24138
 
24147
24139
 
24140
+ //! The SelectStatement of the view
24141
+
24142
+
24143
+
24148
24144
 
24149
24145
 
24150
24146
 
24151
24147
 
24152
24148
  namespace duckdb {
24153
24149
 
24154
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
24155
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
24156
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
24157
- this->name = function.name;
24158
- functions.AddFunction(move(function));
24150
+ enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
24151
+
24152
+ class MacroFunction {
24153
+ public:
24154
+ // explicit MacroFunction(unique_ptr<ParsedExpression> expression);
24155
+ MacroFunction(MacroType type);
24156
+
24157
+ // MacroFunction(void);
24158
+ // The type
24159
+ MacroType type;
24160
+ //! The positional parameters
24161
+ vector<unique_ptr<ParsedExpression>> parameters;
24162
+ //! The default parameters and their associated values
24163
+ unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
24164
+
24165
+ public:
24166
+ virtual ~MacroFunction() {
24159
24167
  }
24160
24168
 
24161
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
24162
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
24163
- this->name = functions.name;
24164
- for (auto &func : functions.functions) {
24165
- func.name = functions.name;
24166
- }
24169
+ void CopyProperties(MacroFunction &other);
24170
+
24171
+ virtual unique_ptr<MacroFunction> Copy() = 0;
24172
+
24173
+ static string ValidateArguments(MacroFunction &macro_function, const string &name,
24174
+ FunctionExpression &function_expr,
24175
+ vector<unique_ptr<ParsedExpression>> &positionals,
24176
+ unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
24177
+ };
24178
+
24179
+ } // namespace duckdb
24180
+
24181
+
24182
+ namespace duckdb {
24183
+
24184
+ struct CreateMacroInfo : public CreateFunctionInfo {
24185
+ CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
24167
24186
  }
24168
24187
 
24169
- AggregateFunctionSet functions;
24188
+ CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
24189
+ }
24190
+
24191
+ unique_ptr<MacroFunction> function;
24170
24192
 
24171
24193
  public:
24172
24194
  unique_ptr<CreateInfo> Copy() const override {
24173
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
24195
+ auto result = make_unique<CreateMacroInfo>();
24196
+ result->function = function->Copy();
24197
+ result->name = name;
24174
24198
  CopyProperties(*result);
24175
24199
  return move(result);
24176
24200
  }
@@ -24180,7 +24204,7 @@ public:
24180
24204
  //===----------------------------------------------------------------------===//
24181
24205
  // DuckDB
24182
24206
  //
24183
- // duckdb/parser/parsed_data/create_type_info.hpp
24207
+ // duckdb/parser/parsed_data/create_view_info.hpp
24184
24208
  //
24185
24209
  //
24186
24210
  //===----------------------------------------------------------------------===//
@@ -24190,26 +24214,31 @@ public:
24190
24214
 
24191
24215
 
24192
24216
 
24193
-
24194
-
24195
24217
  namespace duckdb {
24196
24218
 
24197
- struct CreateTypeInfo : public CreateInfo {
24198
-
24199
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
24219
+ struct CreateViewInfo : public CreateInfo {
24220
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
24221
+ }
24222
+ CreateViewInfo(string schema, string view_name)
24223
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
24200
24224
  }
24201
24225
 
24202
- //! Name of the Type
24203
- string name;
24204
- //! Logical Type
24205
- LogicalType type;
24226
+ //! Table name to insert to
24227
+ string view_name;
24228
+ //! Aliases of the view
24229
+ vector<string> aliases;
24230
+ //! Return types
24231
+ vector<LogicalType> types;
24232
+ //! The SelectStatement of the view
24233
+ unique_ptr<SelectStatement> query;
24206
24234
 
24207
24235
  public:
24208
24236
  unique_ptr<CreateInfo> Copy() const override {
24209
- auto result = make_unique<CreateTypeInfo>();
24237
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
24210
24238
  CopyProperties(*result);
24211
- result->name = name;
24212
- result->type = type;
24239
+ result->aliases = aliases;
24240
+ result->types = types;
24241
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
24213
24242
  return move(result);
24214
24243
  }
24215
24244
  };
@@ -24260,7 +24289,7 @@ public:
24260
24289
  //===----------------------------------------------------------------------===//
24261
24290
  // DuckDB
24262
24291
  //
24263
- // duckdb/parser/parsed_data/create_view_info.hpp
24292
+ // duckdb/parser/parsed_data/create_schema_info.hpp
24264
24293
  //
24265
24294
  //
24266
24295
  //===----------------------------------------------------------------------===//
@@ -24269,41 +24298,26 @@ public:
24269
24298
 
24270
24299
 
24271
24300
 
24272
-
24273
24301
  namespace duckdb {
24274
24302
 
24275
- struct CreateViewInfo : public CreateInfo {
24276
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
24277
- }
24278
- CreateViewInfo(string schema, string view_name)
24279
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
24303
+ struct CreateSchemaInfo : public CreateInfo {
24304
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
24280
24305
  }
24281
24306
 
24282
- //! Table name to insert to
24283
- string view_name;
24284
- //! Aliases of the view
24285
- vector<string> aliases;
24286
- //! Return types
24287
- vector<LogicalType> types;
24288
- //! The SelectStatement of the view
24289
- unique_ptr<SelectStatement> query;
24290
-
24291
24307
  public:
24292
24308
  unique_ptr<CreateInfo> Copy() const override {
24293
- auto result = make_unique<CreateViewInfo>(schema, view_name);
24309
+ auto result = make_unique<CreateSchemaInfo>();
24294
24310
  CopyProperties(*result);
24295
- result->aliases = aliases;
24296
- result->types = types;
24297
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
24298
24311
  return move(result);
24299
24312
  }
24300
24313
  };
24301
24314
 
24302
24315
  } // namespace duckdb
24316
+
24303
24317
  //===----------------------------------------------------------------------===//
24304
24318
  // DuckDB
24305
24319
  //
24306
- // duckdb/parser/tableref/emptytableref.hpp
24320
+ // duckdb/parser/tableref/crossproductref.hpp
24307
24321
  //
24308
24322
  //
24309
24323
  //===----------------------------------------------------------------------===//
@@ -24314,27 +24328,33 @@ public:
24314
24328
 
24315
24329
  namespace duckdb {
24316
24330
  //! Represents a cross product
24317
- class EmptyTableRef : public TableRef {
24331
+ class CrossProductRef : public TableRef {
24318
24332
  public:
24319
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
24333
+ CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
24320
24334
  }
24321
24335
 
24336
+ //! The left hand side of the cross product
24337
+ unique_ptr<TableRef> left;
24338
+ //! The right hand side of the cross product
24339
+ unique_ptr<TableRef> right;
24340
+
24322
24341
  public:
24323
24342
  string ToString() const override;
24324
24343
  bool Equals(const TableRef *other_p) const override;
24325
24344
 
24326
24345
  unique_ptr<TableRef> Copy() override;
24327
24346
 
24328
- //! Serializes a blob into a DummyTableRef
24347
+ //! Serializes a blob into a CrossProductRef
24329
24348
  void Serialize(FieldWriter &serializer) const override;
24330
- //! Deserializes a blob back into a DummyTableRef
24349
+ //! Deserializes a blob back into a CrossProductRef
24331
24350
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24332
24351
  };
24333
24352
  } // namespace duckdb
24353
+
24334
24354
  //===----------------------------------------------------------------------===//
24335
24355
  // DuckDB
24336
24356
  //
24337
- // duckdb/parser/tableref/joinref.hpp
24357
+ // duckdb/parser/tableref/emptytableref.hpp
24338
24358
  //
24339
24359
  //
24340
24360
  //===----------------------------------------------------------------------===//
@@ -24343,46 +24363,30 @@ public:
24343
24363
 
24344
24364
 
24345
24365
 
24346
-
24347
-
24348
-
24349
-
24350
24366
  namespace duckdb {
24351
- //! Represents a JOIN between two expressions
24352
- class JoinRef : public TableRef {
24367
+ //! Represents a cross product
24368
+ class EmptyTableRef : public TableRef {
24353
24369
  public:
24354
- JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
24370
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
24355
24371
  }
24356
24372
 
24357
- //! The left hand side of the join
24358
- unique_ptr<TableRef> left;
24359
- //! The right hand side of the join
24360
- unique_ptr<TableRef> right;
24361
- //! The join condition
24362
- unique_ptr<ParsedExpression> condition;
24363
- //! The join type
24364
- JoinType type;
24365
- //! Natural join
24366
- bool is_natural;
24367
- //! The set of USING columns (if any)
24368
- vector<string> using_columns;
24369
-
24370
24373
  public:
24371
24374
  string ToString() const override;
24372
24375
  bool Equals(const TableRef *other_p) const override;
24373
24376
 
24374
24377
  unique_ptr<TableRef> Copy() override;
24375
24378
 
24376
- //! Serializes a blob into a JoinRef
24379
+ //! Serializes a blob into a DummyTableRef
24377
24380
  void Serialize(FieldWriter &serializer) const override;
24378
- //! Deserializes a blob back into a JoinRef
24381
+ //! Deserializes a blob back into a DummyTableRef
24379
24382
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24380
24383
  };
24381
24384
  } // namespace duckdb
24385
+
24382
24386
  //===----------------------------------------------------------------------===//
24383
24387
  // DuckDB
24384
24388
  //
24385
- // duckdb/parser/tableref/crossproductref.hpp
24389
+ // duckdb/parser/tableref/expressionlistref.hpp
24386
24390
  //
24387
24391
  //
24388
24392
  //===----------------------------------------------------------------------===//
@@ -24391,17 +24395,22 @@ public:
24391
24395
 
24392
24396
 
24393
24397
 
24398
+
24399
+
24400
+
24394
24401
  namespace duckdb {
24395
- //! Represents a cross product
24396
- class CrossProductRef : public TableRef {
24402
+ //! Represents an expression list as generated by a VALUES statement
24403
+ class ExpressionListRef : public TableRef {
24397
24404
  public:
24398
- CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
24405
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
24399
24406
  }
24400
24407
 
24401
- //! The left hand side of the cross product
24402
- unique_ptr<TableRef> left;
24403
- //! The right hand side of the cross product
24404
- unique_ptr<TableRef> right;
24408
+ //! Value list, only used for VALUES statement
24409
+ vector<vector<unique_ptr<ParsedExpression>>> values;
24410
+ //! Expected SQL types
24411
+ vector<LogicalType> expected_types;
24412
+ //! The set of expected names
24413
+ vector<string> expected_names;
24405
24414
 
24406
24415
  public:
24407
24416
  string ToString() const override;
@@ -24409,19 +24418,17 @@ public:
24409
24418
 
24410
24419
  unique_ptr<TableRef> Copy() override;
24411
24420
 
24412
- //! Serializes a blob into a CrossProductRef
24421
+ //! Serializes a blob into a ExpressionListRef
24413
24422
  void Serialize(FieldWriter &serializer) const override;
24414
- //! Deserializes a blob back into a CrossProductRef
24423
+ //! Deserializes a blob back into a ExpressionListRef
24415
24424
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24416
24425
  };
24417
24426
  } // namespace duckdb
24418
24427
 
24419
-
24420
-
24421
24428
  //===----------------------------------------------------------------------===//
24422
24429
  // DuckDB
24423
24430
  //
24424
- // duckdb/parser/tableref/expressionlistref.hpp
24431
+ // duckdb/parser/tableref/joinref.hpp
24425
24432
  //
24426
24433
  //
24427
24434
  //===----------------------------------------------------------------------===//
@@ -24433,19 +24440,26 @@ public:
24433
24440
 
24434
24441
 
24435
24442
 
24443
+
24436
24444
  namespace duckdb {
24437
- //! Represents an expression list as generated by a VALUES statement
24438
- class ExpressionListRef : public TableRef {
24445
+ //! Represents a JOIN between two expressions
24446
+ class JoinRef : public TableRef {
24439
24447
  public:
24440
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
24448
+ JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
24441
24449
  }
24442
24450
 
24443
- //! Value list, only used for VALUES statement
24444
- vector<vector<unique_ptr<ParsedExpression>>> values;
24445
- //! Expected SQL types
24446
- vector<LogicalType> expected_types;
24447
- //! The set of expected names
24448
- vector<string> expected_names;
24451
+ //! The left hand side of the join
24452
+ unique_ptr<TableRef> left;
24453
+ //! The right hand side of the join
24454
+ unique_ptr<TableRef> right;
24455
+ //! The join condition
24456
+ unique_ptr<ParsedExpression> condition;
24457
+ //! The join type
24458
+ JoinType type;
24459
+ //! Natural join
24460
+ bool is_natural;
24461
+ //! The set of USING columns (if any)
24462
+ vector<string> using_columns;
24449
24463
 
24450
24464
  public:
24451
24465
  string ToString() const override;
@@ -24453,14 +24467,13 @@ public:
24453
24467
 
24454
24468
  unique_ptr<TableRef> Copy() override;
24455
24469
 
24456
- //! Serializes a blob into a ExpressionListRef
24470
+ //! Serializes a blob into a JoinRef
24457
24471
  void Serialize(FieldWriter &serializer) const override;
24458
- //! Deserializes a blob back into a ExpressionListRef
24472
+ //! Deserializes a blob back into a JoinRef
24459
24473
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24460
24474
  };
24461
24475
  } // namespace duckdb
24462
24476
 
24463
-
24464
24477
  //===----------------------------------------------------------------------===//
24465
24478
  // DuckDB
24466
24479
  //