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