duckdb 0.4.1-dev801.0 → 0.4.1-dev833.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 "bc7a4514c"
15
- #define DUCKDB_VERSION "v0.4.1-dev801"
14
+ #define DUCKDB_SOURCE_ID "6281f2b2e"
15
+ #define DUCKDB_VERSION "v0.4.1-dev833"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -12208,6 +12208,21 @@ public:
12208
12208
 
12209
12209
  namespace duckdb {
12210
12210
 
12211
+ enum class SequenceInfo : uint8_t {
12212
+ // Sequence start
12213
+ SEQ_START,
12214
+ // Sequence increment
12215
+ SEQ_INC,
12216
+ // Sequence minimum value
12217
+ SEQ_MIN,
12218
+ // Sequence maximum value
12219
+ SEQ_MAX,
12220
+ // Sequence cycle option
12221
+ SEQ_CYCLE,
12222
+ // Sequence owner table
12223
+ SEQ_OWN
12224
+ };
12225
+
12211
12226
  struct CreateSequenceInfo : public CreateInfo {
12212
12227
  CreateSequenceInfo()
12213
12228
  : CreateInfo(CatalogType::SEQUENCE_ENTRY, INVALID_SCHEMA), name(string()), usage_count(0), increment(1),
@@ -24674,7 +24689,7 @@ private:
24674
24689
  //===----------------------------------------------------------------------===//
24675
24690
  // DuckDB
24676
24691
  //
24677
- // duckdb/parser/expression/cast_expression.hpp
24692
+ // duckdb/parser/expression/default_expression.hpp
24678
24693
  //
24679
24694
  //
24680
24695
  //===----------------------------------------------------------------------===//
@@ -24683,43 +24698,29 @@ private:
24683
24698
 
24684
24699
 
24685
24700
 
24686
-
24687
24701
  namespace duckdb {
24688
-
24689
- //! CastExpression represents a type cast from one SQL type to another SQL type
24690
- class CastExpression : public ParsedExpression {
24702
+ //! Represents the default value of a column
24703
+ class DefaultExpression : public ParsedExpression {
24691
24704
  public:
24692
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
24693
-
24694
- //! The child of the cast expression
24695
- unique_ptr<ParsedExpression> child;
24696
- //! The type to cast to
24697
- LogicalType cast_type;
24698
- //! Whether or not this is a try_cast expression
24699
- bool try_cast;
24705
+ DefaultExpression();
24700
24706
 
24701
24707
  public:
24702
- string ToString() const override;
24708
+ bool IsScalar() const override {
24709
+ return false;
24710
+ }
24703
24711
 
24704
- static bool Equals(const CastExpression *a, const CastExpression *b);
24712
+ string ToString() const override;
24705
24713
 
24706
24714
  unique_ptr<ParsedExpression> Copy() const override;
24707
24715
 
24708
24716
  void Serialize(FieldWriter &writer) const override;
24709
24717
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
24710
-
24711
- public:
24712
- template <class T, class BASE>
24713
- static string ToString(const T &entry) {
24714
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
24715
- entry.cast_type.ToString() + ")";
24716
- }
24717
24718
  };
24718
24719
  } // namespace duckdb
24719
24720
  //===----------------------------------------------------------------------===//
24720
24721
  // DuckDB
24721
24722
  //
24722
- // duckdb/parser/expression/operator_expression.hpp
24723
+ // duckdb/parser/expression/comparison_expression.hpp
24723
24724
  //
24724
24725
  //
24725
24726
  //===----------------------------------------------------------------------===//
@@ -24728,23 +24729,21 @@ public:
24728
24729
 
24729
24730
 
24730
24731
 
24731
-
24732
-
24733
-
24734
24732
  namespace duckdb {
24735
- //! Represents a built-in operator expression
24736
- class OperatorExpression : public ParsedExpression {
24733
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
24734
+ //! and has two children.
24735
+ class ComparisonExpression : public ParsedExpression {
24737
24736
  public:
24738
- DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
24739
- unique_ptr<ParsedExpression> right = nullptr);
24740
- DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
24737
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
24738
+ unique_ptr<ParsedExpression> right);
24741
24739
 
24742
- vector<unique_ptr<ParsedExpression>> children;
24740
+ unique_ptr<ParsedExpression> left;
24741
+ unique_ptr<ParsedExpression> right;
24743
24742
 
24744
24743
  public:
24745
24744
  string ToString() const override;
24746
24745
 
24747
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
24746
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
24748
24747
 
24749
24748
  unique_ptr<ParsedExpression> Copy() const override;
24750
24749
 
@@ -24754,74 +24753,14 @@ public:
24754
24753
  public:
24755
24754
  template <class T, class BASE>
24756
24755
  static string ToString(const T &entry) {
24757
- auto op = ExpressionTypeToOperator(entry.type);
24758
- if (!op.empty()) {
24759
- // use the operator string to represent the operator
24760
- D_ASSERT(entry.children.size() == 2);
24761
- return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
24762
- }
24763
- switch (entry.type) {
24764
- case ExpressionType::COMPARE_IN:
24765
- case ExpressionType::COMPARE_NOT_IN: {
24766
- string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
24767
- string in_child = entry.children[0]->ToString();
24768
- string child_list = "(";
24769
- for (idx_t i = 1; i < entry.children.size(); i++) {
24770
- if (i > 1) {
24771
- child_list += ", ";
24772
- }
24773
- child_list += entry.children[i]->ToString();
24774
- }
24775
- child_list += ")";
24776
- return "(" + in_child + op_type + child_list + ")";
24777
- }
24778
- case ExpressionType::OPERATOR_NOT:
24779
- case ExpressionType::GROUPING_FUNCTION:
24780
- case ExpressionType::OPERATOR_COALESCE: {
24781
- string result = ExpressionTypeToString(entry.type);
24782
- result += "(";
24783
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
24784
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
24785
- result += ")";
24786
- return result;
24787
- }
24788
- case ExpressionType::OPERATOR_IS_NULL:
24789
- return "(" + entry.children[0]->ToString() + " IS NULL)";
24790
- case ExpressionType::OPERATOR_IS_NOT_NULL:
24791
- return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
24792
- case ExpressionType::ARRAY_EXTRACT:
24793
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
24794
- case ExpressionType::ARRAY_SLICE:
24795
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
24796
- entry.children[2]->ToString() + "]";
24797
- case ExpressionType::STRUCT_EXTRACT: {
24798
- if (entry.children[1]->type != ExpressionType::VALUE_CONSTANT) {
24799
- return string();
24800
- }
24801
- auto child_string = entry.children[1]->ToString();
24802
- D_ASSERT(child_string.size() >= 3);
24803
- D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
24804
- return "(" + entry.children[0]->ToString() + ")." +
24805
- KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
24806
- }
24807
- case ExpressionType::ARRAY_CONSTRUCTOR: {
24808
- string result = "(ARRAY[";
24809
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
24810
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
24811
- result += "])";
24812
- return result;
24813
- }
24814
- default:
24815
- throw InternalException("Unrecognized operator type");
24816
- }
24756
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
24817
24757
  }
24818
24758
  };
24819
-
24820
24759
  } // namespace duckdb
24821
24760
  //===----------------------------------------------------------------------===//
24822
24761
  // DuckDB
24823
24762
  //
24824
- // duckdb/parser/expression/star_expression.hpp
24763
+ // duckdb/parser/expression/parameter_expression.hpp
24825
24764
  //
24826
24765
  //
24827
24766
  //===----------------------------------------------------------------------===//
@@ -24830,27 +24769,27 @@ public:
24830
24769
 
24831
24770
 
24832
24771
 
24833
-
24834
24772
  namespace duckdb {
24835
-
24836
- //! Represents a * expression in the SELECT clause
24837
- class StarExpression : public ParsedExpression {
24773
+ class ParameterExpression : public ParsedExpression {
24838
24774
  public:
24839
- StarExpression(string relation_name = string());
24775
+ ParameterExpression();
24840
24776
 
24841
- //! The relation name in case of tbl.*, or empty if this is a normal *
24842
- string relation_name;
24843
- //! List of columns to exclude from the STAR expression
24844
- case_insensitive_set_t exclude_list;
24845
- //! List of columns to replace with another expression
24846
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
24777
+ idx_t parameter_nr;
24847
24778
 
24848
24779
  public:
24780
+ bool IsScalar() const override {
24781
+ return true;
24782
+ }
24783
+ bool HasParameter() const override {
24784
+ return true;
24785
+ }
24786
+
24849
24787
  string ToString() const override;
24850
24788
 
24851
- static bool Equals(const StarExpression *a, const StarExpression *b);
24789
+ static bool Equals(const ParameterExpression *a, const ParameterExpression *b);
24852
24790
 
24853
24791
  unique_ptr<ParsedExpression> Copy() const override;
24792
+ hash_t Hash() const override;
24854
24793
 
24855
24794
  void Serialize(FieldWriter &writer) const override;
24856
24795
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
@@ -24859,7 +24798,7 @@ public:
24859
24798
  //===----------------------------------------------------------------------===//
24860
24799
  // DuckDB
24861
24800
  //
24862
- // duckdb/parser/expression/conjunction_expression.hpp
24801
+ // duckdb/parser/expression/between_expression.hpp
24863
24802
  //
24864
24803
  //
24865
24804
  //===----------------------------------------------------------------------===//
@@ -24868,25 +24807,21 @@ public:
24868
24807
 
24869
24808
 
24870
24809
 
24871
-
24872
24810
  namespace duckdb {
24873
24811
 
24874
- //! Represents a conjunction (AND/OR)
24875
- class ConjunctionExpression : public ParsedExpression {
24812
+ class BetweenExpression : public ParsedExpression {
24876
24813
  public:
24877
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
24878
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
24879
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
24880
- unique_ptr<ParsedExpression> right);
24814
+ DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
24815
+ unique_ptr<ParsedExpression> upper);
24881
24816
 
24882
- vector<unique_ptr<ParsedExpression>> children;
24817
+ unique_ptr<ParsedExpression> input;
24818
+ unique_ptr<ParsedExpression> lower;
24819
+ unique_ptr<ParsedExpression> upper;
24883
24820
 
24884
24821
  public:
24885
- void AddExpression(unique_ptr<ParsedExpression> expr);
24886
-
24887
24822
  string ToString() const override;
24888
24823
 
24889
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
24824
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
24890
24825
 
24891
24826
  unique_ptr<ParsedExpression> Copy() const override;
24892
24827
 
@@ -24896,14 +24831,12 @@ public:
24896
24831
  public:
24897
24832
  template <class T, class BASE>
24898
24833
  static string ToString(const T &entry) {
24899
- string result = "(" + entry.children[0]->ToString();
24900
- for (idx_t i = 1; i < entry.children.size(); i++) {
24901
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
24902
- }
24903
- return result + ")";
24834
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
24904
24835
  }
24905
24836
  };
24906
24837
  } // namespace duckdb
24838
+
24839
+
24907
24840
  //===----------------------------------------------------------------------===//
24908
24841
  // DuckDB
24909
24842
  //
@@ -24956,10 +24889,11 @@ public:
24956
24889
  }
24957
24890
  };
24958
24891
  } // namespace duckdb
24892
+
24959
24893
  //===----------------------------------------------------------------------===//
24960
24894
  // DuckDB
24961
24895
  //
24962
- // duckdb/parser/expression/constant_expression.hpp
24896
+ // duckdb/parser/expression/cast_expression.hpp
24963
24897
  //
24964
24898
  //
24965
24899
  //===----------------------------------------------------------------------===//
@@ -24971,27 +24905,37 @@ public:
24971
24905
 
24972
24906
  namespace duckdb {
24973
24907
 
24974
- //! ConstantExpression represents a constant value in the query
24975
- class ConstantExpression : public ParsedExpression {
24908
+ //! CastExpression represents a type cast from one SQL type to another SQL type
24909
+ class CastExpression : public ParsedExpression {
24976
24910
  public:
24977
- DUCKDB_API explicit ConstantExpression(Value val);
24911
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
24978
24912
 
24979
- //! The constant value referenced
24980
- Value value;
24913
+ //! The child of the cast expression
24914
+ unique_ptr<ParsedExpression> child;
24915
+ //! The type to cast to
24916
+ LogicalType cast_type;
24917
+ //! Whether or not this is a try_cast expression
24918
+ bool try_cast;
24981
24919
 
24982
24920
  public:
24983
24921
  string ToString() const override;
24984
24922
 
24985
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
24986
- hash_t Hash() const override;
24923
+ static bool Equals(const CastExpression *a, const CastExpression *b);
24987
24924
 
24988
24925
  unique_ptr<ParsedExpression> Copy() const override;
24989
24926
 
24990
24927
  void Serialize(FieldWriter &writer) const override;
24991
24928
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
24992
- };
24993
24929
 
24930
+ public:
24931
+ template <class T, class BASE>
24932
+ static string ToString(const T &entry) {
24933
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
24934
+ entry.cast_type.ToString() + ")";
24935
+ }
24936
+ };
24994
24937
  } // namespace duckdb
24938
+
24995
24939
  //===----------------------------------------------------------------------===//
24996
24940
  // DuckDB
24997
24941
  //
@@ -25027,10 +24971,13 @@ public:
25027
24971
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
25028
24972
  };
25029
24973
  } // namespace duckdb
24974
+
24975
+
24976
+
25030
24977
  //===----------------------------------------------------------------------===//
25031
24978
  // DuckDB
25032
24979
  //
25033
- // duckdb/parser/expression/between_expression.hpp
24980
+ // duckdb/parser/expression/conjunction_expression.hpp
25034
24981
  //
25035
24982
  //
25036
24983
  //===----------------------------------------------------------------------===//
@@ -25039,21 +24986,25 @@ public:
25039
24986
 
25040
24987
 
25041
24988
 
24989
+
25042
24990
  namespace duckdb {
25043
24991
 
25044
- class BetweenExpression : public ParsedExpression {
24992
+ //! Represents a conjunction (AND/OR)
24993
+ class ConjunctionExpression : public ParsedExpression {
25045
24994
  public:
25046
- DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
25047
- unique_ptr<ParsedExpression> upper);
24995
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
24996
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
24997
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
24998
+ unique_ptr<ParsedExpression> right);
25048
24999
 
25049
- unique_ptr<ParsedExpression> input;
25050
- unique_ptr<ParsedExpression> lower;
25051
- unique_ptr<ParsedExpression> upper;
25000
+ vector<unique_ptr<ParsedExpression>> children;
25052
25001
 
25053
25002
  public:
25003
+ void AddExpression(unique_ptr<ParsedExpression> expr);
25004
+
25054
25005
  string ToString() const override;
25055
25006
 
25056
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
25007
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
25057
25008
 
25058
25009
  unique_ptr<ParsedExpression> Copy() const override;
25059
25010
 
@@ -25063,14 +25014,19 @@ public:
25063
25014
  public:
25064
25015
  template <class T, class BASE>
25065
25016
  static string ToString(const T &entry) {
25066
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
25017
+ string result = "(" + entry.children[0]->ToString();
25018
+ for (idx_t i = 1; i < entry.children.size(); i++) {
25019
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
25020
+ }
25021
+ return result + ")";
25067
25022
  }
25068
25023
  };
25069
25024
  } // namespace duckdb
25025
+
25070
25026
  //===----------------------------------------------------------------------===//
25071
25027
  // DuckDB
25072
25028
  //
25073
- // duckdb/parser/expression/function_expression.hpp
25029
+ // duckdb/parser/expression/constant_expression.hpp
25074
25030
  //
25075
25031
  //
25076
25032
  //===----------------------------------------------------------------------===//
@@ -25080,32 +25036,70 @@ public:
25080
25036
 
25081
25037
 
25082
25038
 
25083
-
25084
25039
  namespace duckdb {
25085
- //! Represents a function call
25086
- class FunctionExpression : public ParsedExpression {
25040
+
25041
+ //! ConstantExpression represents a constant value in the query
25042
+ class ConstantExpression : public ParsedExpression {
25087
25043
  public:
25088
- DUCKDB_API FunctionExpression(string schema_name, const string &function_name,
25089
- vector<unique_ptr<ParsedExpression>> children,
25090
- unique_ptr<ParsedExpression> filter = nullptr,
25091
- unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
25092
- bool is_operator = false, bool export_state = false);
25093
- DUCKDB_API FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
25094
- unique_ptr<ParsedExpression> filter = nullptr,
25095
- unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
25096
- bool is_operator = false, bool export_state = false);
25044
+ DUCKDB_API explicit ConstantExpression(Value val);
25097
25045
 
25098
- //! Schema of the function
25099
- string schema;
25100
- //! Function name
25101
- string function_name;
25102
- //! Whether or not the function is an operator, only used for rendering
25103
- bool is_operator;
25104
- //! List of arguments to the function
25105
- vector<unique_ptr<ParsedExpression>> children;
25106
- //! Whether or not the aggregate function is distinct, only used for aggregates
25107
- bool distinct;
25108
- //! Expression representing a filter, only used for aggregates
25046
+ //! The constant value referenced
25047
+ Value value;
25048
+
25049
+ public:
25050
+ string ToString() const override;
25051
+
25052
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
25053
+ hash_t Hash() const override;
25054
+
25055
+ unique_ptr<ParsedExpression> Copy() const override;
25056
+
25057
+ void Serialize(FieldWriter &writer) const override;
25058
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
25059
+ };
25060
+
25061
+ } // namespace duckdb
25062
+
25063
+
25064
+ //===----------------------------------------------------------------------===//
25065
+ // DuckDB
25066
+ //
25067
+ // duckdb/parser/expression/function_expression.hpp
25068
+ //
25069
+ //
25070
+ //===----------------------------------------------------------------------===//
25071
+
25072
+
25073
+
25074
+
25075
+
25076
+
25077
+
25078
+ namespace duckdb {
25079
+ //! Represents a function call
25080
+ class FunctionExpression : public ParsedExpression {
25081
+ public:
25082
+ DUCKDB_API FunctionExpression(string schema_name, const string &function_name,
25083
+ vector<unique_ptr<ParsedExpression>> children,
25084
+ unique_ptr<ParsedExpression> filter = nullptr,
25085
+ unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
25086
+ bool is_operator = false, bool export_state = false);
25087
+ DUCKDB_API FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
25088
+ unique_ptr<ParsedExpression> filter = nullptr,
25089
+ unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
25090
+ bool is_operator = false, bool export_state = false);
25091
+
25092
+ //! Schema of the function
25093
+ string schema;
25094
+ //! Function name
25095
+ string function_name;
25096
+ //! Whether or not the function is an operator, only used for rendering
25097
+ bool is_operator;
25098
+ //! List of arguments to the function
25099
+ vector<unique_ptr<ParsedExpression>> children;
25100
+ //! Whether or not the aggregate function is distinct, only used for aggregates
25101
+ bool distinct;
25102
+ //! Expression representing a filter, only used for aggregates
25109
25103
  unique_ptr<ParsedExpression> filter;
25110
25104
  //! Modifier representing an ORDER BY, only used for aggregates
25111
25105
  unique_ptr<OrderModifier> order_bys;
@@ -25184,10 +25178,12 @@ public:
25184
25178
  }
25185
25179
  };
25186
25180
  } // namespace duckdb
25181
+
25182
+
25187
25183
  //===----------------------------------------------------------------------===//
25188
25184
  // DuckDB
25189
25185
  //
25190
- // duckdb/parser/expression/comparison_expression.hpp
25186
+ // duckdb/parser/expression/operator_expression.hpp
25191
25187
  //
25192
25188
  //
25193
25189
  //===----------------------------------------------------------------------===//
@@ -25196,21 +25192,23 @@ public:
25196
25192
 
25197
25193
 
25198
25194
 
25195
+
25196
+
25197
+
25199
25198
  namespace duckdb {
25200
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
25201
- //! and has two children.
25202
- class ComparisonExpression : public ParsedExpression {
25199
+ //! Represents a built-in operator expression
25200
+ class OperatorExpression : public ParsedExpression {
25203
25201
  public:
25204
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
25205
- unique_ptr<ParsedExpression> right);
25202
+ DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
25203
+ unique_ptr<ParsedExpression> right = nullptr);
25204
+ DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
25206
25205
 
25207
- unique_ptr<ParsedExpression> left;
25208
- unique_ptr<ParsedExpression> right;
25206
+ vector<unique_ptr<ParsedExpression>> children;
25209
25207
 
25210
25208
  public:
25211
25209
  string ToString() const override;
25212
25210
 
25213
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
25211
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
25214
25212
 
25215
25213
  unique_ptr<ParsedExpression> Copy() const override;
25216
25214
 
@@ -25220,58 +25218,76 @@ public:
25220
25218
  public:
25221
25219
  template <class T, class BASE>
25222
25220
  static string ToString(const T &entry) {
25223
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
25221
+ auto op = ExpressionTypeToOperator(entry.type);
25222
+ if (!op.empty()) {
25223
+ // use the operator string to represent the operator
25224
+ D_ASSERT(entry.children.size() == 2);
25225
+ return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
25226
+ }
25227
+ switch (entry.type) {
25228
+ case ExpressionType::COMPARE_IN:
25229
+ case ExpressionType::COMPARE_NOT_IN: {
25230
+ string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
25231
+ string in_child = entry.children[0]->ToString();
25232
+ string child_list = "(";
25233
+ for (idx_t i = 1; i < entry.children.size(); i++) {
25234
+ if (i > 1) {
25235
+ child_list += ", ";
25236
+ }
25237
+ child_list += entry.children[i]->ToString();
25238
+ }
25239
+ child_list += ")";
25240
+ return "(" + in_child + op_type + child_list + ")";
25241
+ }
25242
+ case ExpressionType::OPERATOR_NOT:
25243
+ case ExpressionType::GROUPING_FUNCTION:
25244
+ case ExpressionType::OPERATOR_COALESCE: {
25245
+ string result = ExpressionTypeToString(entry.type);
25246
+ result += "(";
25247
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
25248
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
25249
+ result += ")";
25250
+ return result;
25251
+ }
25252
+ case ExpressionType::OPERATOR_IS_NULL:
25253
+ return "(" + entry.children[0]->ToString() + " IS NULL)";
25254
+ case ExpressionType::OPERATOR_IS_NOT_NULL:
25255
+ return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
25256
+ case ExpressionType::ARRAY_EXTRACT:
25257
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
25258
+ case ExpressionType::ARRAY_SLICE:
25259
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
25260
+ entry.children[2]->ToString() + "]";
25261
+ case ExpressionType::STRUCT_EXTRACT: {
25262
+ if (entry.children[1]->type != ExpressionType::VALUE_CONSTANT) {
25263
+ return string();
25264
+ }
25265
+ auto child_string = entry.children[1]->ToString();
25266
+ D_ASSERT(child_string.size() >= 3);
25267
+ D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
25268
+ return "(" + entry.children[0]->ToString() + ")." +
25269
+ KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
25270
+ }
25271
+ case ExpressionType::ARRAY_CONSTRUCTOR: {
25272
+ string result = "(ARRAY[";
25273
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
25274
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
25275
+ result += "])";
25276
+ return result;
25277
+ }
25278
+ default:
25279
+ throw InternalException("Unrecognized operator type");
25280
+ }
25224
25281
  }
25225
25282
  };
25226
- } // namespace duckdb
25227
-
25228
-
25229
-
25230
-
25231
-
25232
-
25233
-
25234
-
25235
-
25236
- //===----------------------------------------------------------------------===//
25237
- // DuckDB
25238
- //
25239
- // duckdb/parser/expression/default_expression.hpp
25240
- //
25241
- //
25242
- //===----------------------------------------------------------------------===//
25243
-
25244
-
25245
-
25246
25283
 
25247
-
25248
- namespace duckdb {
25249
- //! Represents the default value of a column
25250
- class DefaultExpression : public ParsedExpression {
25251
- public:
25252
- DefaultExpression();
25253
-
25254
- public:
25255
- bool IsScalar() const override {
25256
- return false;
25257
- }
25258
-
25259
- string ToString() const override;
25260
-
25261
- unique_ptr<ParsedExpression> Copy() const override;
25262
-
25263
- void Serialize(FieldWriter &writer) const override;
25264
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
25265
- };
25266
25284
  } // namespace duckdb
25267
25285
 
25268
25286
 
25269
-
25270
-
25271
25287
  //===----------------------------------------------------------------------===//
25272
25288
  // DuckDB
25273
25289
  //
25274
- // duckdb/parser/expression/parameter_expression.hpp
25290
+ // duckdb/parser/expression/positional_reference_expression.hpp
25275
25291
  //
25276
25292
  //
25277
25293
  //===----------------------------------------------------------------------===//
@@ -25281,24 +25297,20 @@ public:
25281
25297
 
25282
25298
 
25283
25299
  namespace duckdb {
25284
- class ParameterExpression : public ParsedExpression {
25300
+ class PositionalReferenceExpression : public ParsedExpression {
25285
25301
  public:
25286
- ParameterExpression();
25302
+ DUCKDB_API PositionalReferenceExpression(idx_t index);
25287
25303
 
25288
- idx_t parameter_nr;
25304
+ idx_t index;
25289
25305
 
25290
25306
  public:
25291
25307
  bool IsScalar() const override {
25292
- return true;
25293
- }
25294
- bool HasParameter() const override {
25295
- return true;
25308
+ return false;
25296
25309
  }
25297
25310
 
25298
25311
  string ToString() const override;
25299
25312
 
25300
- static bool Equals(const ParameterExpression *a, const ParameterExpression *b);
25301
-
25313
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
25302
25314
  unique_ptr<ParsedExpression> Copy() const override;
25303
25315
  hash_t Hash() const override;
25304
25316
 
@@ -25310,7 +25322,7 @@ public:
25310
25322
  //===----------------------------------------------------------------------===//
25311
25323
  // DuckDB
25312
25324
  //
25313
- // duckdb/parser/expression/positional_reference_expression.hpp
25325
+ // duckdb/parser/expression/star_expression.hpp
25314
25326
  //
25315
25327
  //
25316
25328
  //===----------------------------------------------------------------------===//
@@ -25319,30 +25331,33 @@ public:
25319
25331
 
25320
25332
 
25321
25333
 
25334
+
25322
25335
  namespace duckdb {
25323
- class PositionalReferenceExpression : public ParsedExpression {
25336
+
25337
+ //! Represents a * expression in the SELECT clause
25338
+ class StarExpression : public ParsedExpression {
25324
25339
  public:
25325
- DUCKDB_API PositionalReferenceExpression(idx_t index);
25340
+ StarExpression(string relation_name = string());
25326
25341
 
25327
- idx_t index;
25342
+ //! The relation name in case of tbl.*, or empty if this is a normal *
25343
+ string relation_name;
25344
+ //! List of columns to exclude from the STAR expression
25345
+ case_insensitive_set_t exclude_list;
25346
+ //! List of columns to replace with another expression
25347
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
25328
25348
 
25329
25349
  public:
25330
- bool IsScalar() const override {
25331
- return false;
25332
- }
25333
-
25334
25350
  string ToString() const override;
25335
25351
 
25336
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
25352
+ static bool Equals(const StarExpression *a, const StarExpression *b);
25353
+
25337
25354
  unique_ptr<ParsedExpression> Copy() const override;
25338
- hash_t Hash() const override;
25339
25355
 
25340
25356
  void Serialize(FieldWriter &writer) const override;
25341
25357
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
25342
25358
  };
25343
25359
  } // namespace duckdb
25344
25360
 
25345
-
25346
25361
  //===----------------------------------------------------------------------===//
25347
25362
  // DuckDB
25348
25363
  //
@@ -25397,7 +25412,7 @@ public:
25397
25412
  //===----------------------------------------------------------------------===//
25398
25413
  // DuckDB
25399
25414
  //
25400
- // duckdb/parser/parsed_data/create_collation_info.hpp
25415
+ // duckdb/parser/parsed_data/create_view_info.hpp
25401
25416
  //
25402
25417
  //
25403
25418
  //===----------------------------------------------------------------------===//
@@ -25409,30 +25424,58 @@ public:
25409
25424
 
25410
25425
  namespace duckdb {
25411
25426
 
25412
- struct CreateCollationInfo : public CreateInfo {
25413
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
25414
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
25415
- not_required_for_equality(not_required_for_equality_p) {
25416
- this->name = move(name_p);
25427
+ struct CreateViewInfo : public CreateInfo {
25428
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
25429
+ }
25430
+ CreateViewInfo(string schema, string view_name)
25431
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
25417
25432
  }
25418
25433
 
25419
- //! The name of the collation
25420
- string name;
25421
- //! The collation function to push in case collation is required
25422
- ScalarFunction function;
25423
- //! Whether or not the collation can be combined with other collations.
25424
- bool combinable;
25425
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
25426
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
25427
- //! speeds up processing.
25428
- bool not_required_for_equality;
25434
+ //! Table name to insert to
25435
+ string view_name;
25436
+ //! Aliases of the view
25437
+ vector<string> aliases;
25438
+ //! Return types
25439
+ vector<LogicalType> types;
25440
+ //! The SelectStatement of the view
25441
+ unique_ptr<SelectStatement> query;
25429
25442
 
25430
25443
  public:
25431
25444
  unique_ptr<CreateInfo> Copy() const override {
25432
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
25445
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
25433
25446
  CopyProperties(*result);
25434
- return move(result);
25435
- }
25447
+ result->aliases = aliases;
25448
+ result->types = types;
25449
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
25450
+ return move(result);
25451
+ }
25452
+ };
25453
+
25454
+ } // namespace duckdb
25455
+ //===----------------------------------------------------------------------===//
25456
+ // DuckDB
25457
+ //
25458
+ // duckdb/parser/parsed_data/create_schema_info.hpp
25459
+ //
25460
+ //
25461
+ //===----------------------------------------------------------------------===//
25462
+
25463
+
25464
+
25465
+
25466
+
25467
+ namespace duckdb {
25468
+
25469
+ struct CreateSchemaInfo : public CreateInfo {
25470
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
25471
+ }
25472
+
25473
+ public:
25474
+ unique_ptr<CreateInfo> Copy() const override {
25475
+ auto result = make_unique<CreateSchemaInfo>();
25476
+ CopyProperties(*result);
25477
+ return move(result);
25478
+ }
25436
25479
  };
25437
25480
 
25438
25481
  } // namespace duckdb
@@ -25537,42 +25580,6 @@ public:
25537
25580
  vector<string> columns;
25538
25581
  };
25539
25582
 
25540
- } // namespace duckdb
25541
- //===----------------------------------------------------------------------===//
25542
- // DuckDB
25543
- //
25544
- // duckdb/parser/parsed_data/export_table_data.hpp
25545
- //
25546
- //
25547
- //===----------------------------------------------------------------------===//
25548
-
25549
-
25550
-
25551
-
25552
-
25553
-
25554
- namespace duckdb {
25555
-
25556
- struct ExportedTableData {
25557
- //! Name of the exported table
25558
- string table_name;
25559
-
25560
- //! Name of the schema
25561
- string schema_name;
25562
-
25563
- //! Path to be exported
25564
- string file_path;
25565
- };
25566
-
25567
- struct ExportedTableInfo {
25568
- TableCatalogEntry *entry;
25569
- ExportedTableData table_data;
25570
- };
25571
-
25572
- struct BoundExportData : public ParseInfo {
25573
- std::vector<ExportedTableInfo> data;
25574
- };
25575
-
25576
25583
  } // namespace duckdb
25577
25584
  //===----------------------------------------------------------------------===//
25578
25585
  // DuckDB
@@ -25645,7 +25652,7 @@ public:
25645
25652
  //===----------------------------------------------------------------------===//
25646
25653
  // DuckDB
25647
25654
  //
25648
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
25655
+ // duckdb/parser/parsed_data/create_collation_info.hpp
25649
25656
  //
25650
25657
  //
25651
25658
  //===----------------------------------------------------------------------===//
@@ -25657,26 +25664,27 @@ public:
25657
25664
 
25658
25665
  namespace duckdb {
25659
25666
 
25660
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
25661
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
25662
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
25663
- this->name = function.name;
25664
- functions.AddFunction(move(function));
25665
- }
25666
-
25667
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
25668
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
25669
- this->name = functions.name;
25670
- for (auto &func : functions.functions) {
25671
- func.name = functions.name;
25672
- }
25667
+ struct CreateCollationInfo : public CreateInfo {
25668
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
25669
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
25670
+ not_required_for_equality(not_required_for_equality_p) {
25671
+ this->name = move(name_p);
25673
25672
  }
25674
25673
 
25675
- AggregateFunctionSet functions;
25674
+ //! The name of the collation
25675
+ string name;
25676
+ //! The collation function to push in case collation is required
25677
+ ScalarFunction function;
25678
+ //! Whether or not the collation can be combined with other collations.
25679
+ bool combinable;
25680
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
25681
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
25682
+ //! speeds up processing.
25683
+ bool not_required_for_equality;
25676
25684
 
25677
25685
  public:
25678
25686
  unique_ptr<CreateInfo> Copy() const override {
25679
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
25687
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
25680
25688
  CopyProperties(*result);
25681
25689
  return move(result);
25682
25690
  }
@@ -25686,7 +25694,7 @@ public:
25686
25694
  //===----------------------------------------------------------------------===//
25687
25695
  // DuckDB
25688
25696
  //
25689
- // duckdb/parser/parsed_data/show_select_info.hpp
25697
+ // duckdb/parser/parsed_data/export_table_data.hpp
25690
25698
  //
25691
25699
  //
25692
25700
  //===----------------------------------------------------------------------===//
@@ -25698,31 +25706,31 @@ public:
25698
25706
 
25699
25707
  namespace duckdb {
25700
25708
 
25701
- struct ShowSelectInfo : public ParseInfo {
25702
- //! Types of projected columns
25703
- vector<LogicalType> types;
25704
- //! The QueryNode of select query
25705
- unique_ptr<QueryNode> query;
25706
- //! Aliases of projected columns
25707
- vector<string> aliases;
25708
- //! Whether or not we are requesting a summary or a describe
25709
- bool is_summary;
25709
+ struct ExportedTableData {
25710
+ //! Name of the exported table
25711
+ string table_name;
25710
25712
 
25711
- unique_ptr<ShowSelectInfo> Copy() {
25712
- auto result = make_unique<ShowSelectInfo>();
25713
- result->types = types;
25714
- result->query = query->Copy();
25715
- result->aliases = aliases;
25716
- result->is_summary = is_summary;
25717
- return result;
25718
- }
25713
+ //! Name of the schema
25714
+ string schema_name;
25715
+
25716
+ //! Path to be exported
25717
+ string file_path;
25718
+ };
25719
+
25720
+ struct ExportedTableInfo {
25721
+ TableCatalogEntry *entry;
25722
+ ExportedTableData table_data;
25723
+ };
25724
+
25725
+ struct BoundExportData : public ParseInfo {
25726
+ std::vector<ExportedTableInfo> data;
25719
25727
  };
25720
25728
 
25721
25729
  } // namespace duckdb
25722
25730
  //===----------------------------------------------------------------------===//
25723
25731
  // DuckDB
25724
25732
  //
25725
- // duckdb/parser/parsed_data/create_view_info.hpp
25733
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
25726
25734
  //
25727
25735
  //
25728
25736
  //===----------------------------------------------------------------------===//
@@ -25734,33 +25742,56 @@ struct ShowSelectInfo : public ParseInfo {
25734
25742
 
25735
25743
  namespace duckdb {
25736
25744
 
25737
- struct CreateViewInfo : public CreateInfo {
25738
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
25745
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
25746
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
25747
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
25748
+ this->name = function.name;
25749
+ functions.AddFunction(move(function));
25739
25750
  }
25740
- CreateViewInfo(string schema, string view_name)
25741
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
25751
+
25752
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
25753
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
25754
+ this->name = functions.name;
25755
+ for (auto &func : functions.functions) {
25756
+ func.name = functions.name;
25757
+ }
25742
25758
  }
25743
25759
 
25744
- //! Table name to insert to
25745
- string view_name;
25746
- //! Aliases of the view
25747
- vector<string> aliases;
25748
- //! Return types
25749
- vector<LogicalType> types;
25750
- //! The SelectStatement of the view
25751
- unique_ptr<SelectStatement> query;
25760
+ AggregateFunctionSet functions;
25752
25761
 
25753
25762
  public:
25754
25763
  unique_ptr<CreateInfo> Copy() const override {
25755
- auto result = make_unique<CreateViewInfo>(schema, view_name);
25764
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
25756
25765
  CopyProperties(*result);
25757
- result->aliases = aliases;
25758
- result->types = types;
25759
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
25760
25766
  return move(result);
25761
25767
  }
25762
25768
  };
25763
25769
 
25770
+ } // namespace duckdb
25771
+ //===----------------------------------------------------------------------===//
25772
+ // DuckDB
25773
+ //
25774
+ // duckdb/parser/parsed_data/transaction_info.hpp
25775
+ //
25776
+ //
25777
+ //===----------------------------------------------------------------------===//
25778
+
25779
+
25780
+
25781
+
25782
+
25783
+ namespace duckdb {
25784
+
25785
+ enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
25786
+
25787
+ struct TransactionInfo : public ParseInfo {
25788
+ explicit TransactionInfo(TransactionType type) : type(type) {
25789
+ }
25790
+
25791
+ //! The type of transaction statement
25792
+ TransactionType type;
25793
+ };
25794
+
25764
25795
  } // namespace duckdb
25765
25796
  //===----------------------------------------------------------------------===//
25766
25797
  // DuckDB
@@ -25845,150 +25876,6 @@ public:
25845
25876
  }
25846
25877
  };
25847
25878
 
25848
- } // namespace duckdb
25849
- //===----------------------------------------------------------------------===//
25850
- // DuckDB
25851
- //
25852
- // duckdb/parser/parsed_data/create_index_info.hpp
25853
- //
25854
- //
25855
- //===----------------------------------------------------------------------===//
25856
-
25857
-
25858
-
25859
-
25860
-
25861
-
25862
- //===----------------------------------------------------------------------===//
25863
- // DuckDB
25864
- //
25865
- // duckdb/parser/tableref/basetableref.hpp
25866
- //
25867
- //
25868
- //===----------------------------------------------------------------------===//
25869
-
25870
-
25871
-
25872
-
25873
-
25874
-
25875
- namespace duckdb {
25876
- //! Represents a TableReference to a base table in the schema
25877
- class BaseTableRef : public TableRef {
25878
- public:
25879
- BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
25880
- }
25881
-
25882
- //! Schema name
25883
- string schema_name;
25884
- //! Table name
25885
- string table_name;
25886
- //! Aliases for the column names
25887
- vector<string> column_name_alias;
25888
-
25889
- public:
25890
- string ToString() const override;
25891
- bool Equals(const TableRef *other_p) const override;
25892
-
25893
- unique_ptr<TableRef> Copy() override;
25894
-
25895
- //! Serializes a blob into a BaseTableRef
25896
- void Serialize(FieldWriter &serializer) const override;
25897
- //! Deserializes a blob back into a BaseTableRef
25898
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
25899
- };
25900
- } // namespace duckdb
25901
-
25902
-
25903
-
25904
- namespace duckdb {
25905
-
25906
- struct CreateIndexInfo : public CreateInfo {
25907
- CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
25908
- }
25909
-
25910
- //! Index Type (e.g., B+-tree, Skip-List, ...)
25911
- IndexType index_type;
25912
- //! Name of the Index
25913
- string index_name;
25914
- //! Index Constraint Type
25915
- IndexConstraintType constraint_type;
25916
- //! The table to create the index on
25917
- unique_ptr<BaseTableRef> table;
25918
- //! Set of expressions to index by
25919
- vector<unique_ptr<ParsedExpression>> expressions;
25920
- vector<unique_ptr<ParsedExpression>> parsed_expressions;
25921
-
25922
- vector<idx_t> column_ids;
25923
-
25924
- public:
25925
- unique_ptr<CreateInfo> Copy() const override {
25926
- auto result = make_unique<CreateIndexInfo>();
25927
- CopyProperties(*result);
25928
- result->index_type = index_type;
25929
- result->index_name = index_name;
25930
- result->constraint_type = constraint_type;
25931
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
25932
- for (auto &expr : expressions) {
25933
- result->expressions.push_back(expr->Copy());
25934
- }
25935
- result->column_ids = column_ids;
25936
- return move(result);
25937
- }
25938
- };
25939
-
25940
- } // namespace duckdb
25941
- //===----------------------------------------------------------------------===//
25942
- // DuckDB
25943
- //
25944
- // duckdb/parser/parsed_data/create_schema_info.hpp
25945
- //
25946
- //
25947
- //===----------------------------------------------------------------------===//
25948
-
25949
-
25950
-
25951
-
25952
-
25953
- namespace duckdb {
25954
-
25955
- struct CreateSchemaInfo : public CreateInfo {
25956
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
25957
- }
25958
-
25959
- public:
25960
- unique_ptr<CreateInfo> Copy() const override {
25961
- auto result = make_unique<CreateSchemaInfo>();
25962
- CopyProperties(*result);
25963
- return move(result);
25964
- }
25965
- };
25966
-
25967
- } // namespace duckdb
25968
- //===----------------------------------------------------------------------===//
25969
- // DuckDB
25970
- //
25971
- // duckdb/parser/parsed_data/transaction_info.hpp
25972
- //
25973
- //
25974
- //===----------------------------------------------------------------------===//
25975
-
25976
-
25977
-
25978
-
25979
-
25980
- namespace duckdb {
25981
-
25982
- enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
25983
-
25984
- struct TransactionInfo : public ParseInfo {
25985
- explicit TransactionInfo(TransactionType type) : type(type) {
25986
- }
25987
-
25988
- //! The type of transaction statement
25989
- TransactionType type;
25990
- };
25991
-
25992
25879
  } // namespace duckdb
25993
25880
  //===----------------------------------------------------------------------===//
25994
25881
  // DuckDB
@@ -26029,6 +25916,42 @@ public:
26029
25916
  }
26030
25917
  };
26031
25918
 
25919
+ } // namespace duckdb
25920
+ //===----------------------------------------------------------------------===//
25921
+ // DuckDB
25922
+ //
25923
+ // duckdb/parser/parsed_data/show_select_info.hpp
25924
+ //
25925
+ //
25926
+ //===----------------------------------------------------------------------===//
25927
+
25928
+
25929
+
25930
+
25931
+
25932
+
25933
+ namespace duckdb {
25934
+
25935
+ struct ShowSelectInfo : public ParseInfo {
25936
+ //! Types of projected columns
25937
+ vector<LogicalType> types;
25938
+ //! The QueryNode of select query
25939
+ unique_ptr<QueryNode> query;
25940
+ //! Aliases of projected columns
25941
+ vector<string> aliases;
25942
+ //! Whether or not we are requesting a summary or a describe
25943
+ bool is_summary;
25944
+
25945
+ unique_ptr<ShowSelectInfo> Copy() {
25946
+ auto result = make_unique<ShowSelectInfo>();
25947
+ result->types = types;
25948
+ result->query = query->Copy();
25949
+ result->aliases = aliases;
25950
+ result->is_summary = is_summary;
25951
+ return result;
25952
+ }
25953
+ };
25954
+
26032
25955
  } // namespace duckdb
26033
25956
  //===----------------------------------------------------------------------===//
26034
25957
  // DuckDB
@@ -26077,7 +26000,7 @@ public:
26077
26000
  //===----------------------------------------------------------------------===//
26078
26001
  // DuckDB
26079
26002
  //
26080
- // duckdb/parser/tableref/expressionlistref.hpp
26003
+ // duckdb/parser/parsed_data/create_index_info.hpp
26081
26004
  //
26082
26005
  //
26083
26006
  //===----------------------------------------------------------------------===//
@@ -26087,21 +26010,32 @@ public:
26087
26010
 
26088
26011
 
26089
26012
 
26013
+ //===----------------------------------------------------------------------===//
26014
+ // DuckDB
26015
+ //
26016
+ // duckdb/parser/tableref/basetableref.hpp
26017
+ //
26018
+ //
26019
+ //===----------------------------------------------------------------------===//
26020
+
26021
+
26022
+
26023
+
26090
26024
 
26091
26025
 
26092
26026
  namespace duckdb {
26093
- //! Represents an expression list as generated by a VALUES statement
26094
- class ExpressionListRef : public TableRef {
26027
+ //! Represents a TableReference to a base table in the schema
26028
+ class BaseTableRef : public TableRef {
26095
26029
  public:
26096
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
26030
+ BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
26097
26031
  }
26098
26032
 
26099
- //! Value list, only used for VALUES statement
26100
- vector<vector<unique_ptr<ParsedExpression>>> values;
26101
- //! Expected SQL types
26102
- vector<LogicalType> expected_types;
26103
- //! The set of expected names
26104
- vector<string> expected_names;
26033
+ //! Schema name
26034
+ string schema_name;
26035
+ //! Table name
26036
+ string table_name;
26037
+ //! Aliases for the column names
26038
+ vector<string> column_name_alias;
26105
26039
 
26106
26040
  public:
26107
26041
  string ToString() const override;
@@ -26109,9 +26043,85 @@ public:
26109
26043
 
26110
26044
  unique_ptr<TableRef> Copy() override;
26111
26045
 
26112
- //! Serializes a blob into a ExpressionListRef
26046
+ //! Serializes a blob into a BaseTableRef
26113
26047
  void Serialize(FieldWriter &serializer) const override;
26114
- //! Deserializes a blob back into a ExpressionListRef
26048
+ //! Deserializes a blob back into a BaseTableRef
26049
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
26050
+ };
26051
+ } // namespace duckdb
26052
+
26053
+
26054
+
26055
+ namespace duckdb {
26056
+
26057
+ struct CreateIndexInfo : public CreateInfo {
26058
+ CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
26059
+ }
26060
+
26061
+ //! Index Type (e.g., B+-tree, Skip-List, ...)
26062
+ IndexType index_type;
26063
+ //! Name of the Index
26064
+ string index_name;
26065
+ //! Index Constraint Type
26066
+ IndexConstraintType constraint_type;
26067
+ //! The table to create the index on
26068
+ unique_ptr<BaseTableRef> table;
26069
+ //! Set of expressions to index by
26070
+ vector<unique_ptr<ParsedExpression>> expressions;
26071
+ vector<unique_ptr<ParsedExpression>> parsed_expressions;
26072
+
26073
+ vector<idx_t> column_ids;
26074
+
26075
+ public:
26076
+ unique_ptr<CreateInfo> Copy() const override {
26077
+ auto result = make_unique<CreateIndexInfo>();
26078
+ CopyProperties(*result);
26079
+ result->index_type = index_type;
26080
+ result->index_name = index_name;
26081
+ result->constraint_type = constraint_type;
26082
+ result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
26083
+ for (auto &expr : expressions) {
26084
+ result->expressions.push_back(expr->Copy());
26085
+ }
26086
+ result->column_ids = column_ids;
26087
+ return move(result);
26088
+ }
26089
+ };
26090
+
26091
+ } // namespace duckdb
26092
+ //===----------------------------------------------------------------------===//
26093
+ // DuckDB
26094
+ //
26095
+ // duckdb/parser/tableref/crossproductref.hpp
26096
+ //
26097
+ //
26098
+ //===----------------------------------------------------------------------===//
26099
+
26100
+
26101
+
26102
+
26103
+
26104
+ namespace duckdb {
26105
+ //! Represents a cross product
26106
+ class CrossProductRef : public TableRef {
26107
+ public:
26108
+ CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
26109
+ }
26110
+
26111
+ //! The left hand side of the cross product
26112
+ unique_ptr<TableRef> left;
26113
+ //! The right hand side of the cross product
26114
+ unique_ptr<TableRef> right;
26115
+
26116
+ public:
26117
+ string ToString() const override;
26118
+ bool Equals(const TableRef *other_p) const override;
26119
+
26120
+ unique_ptr<TableRef> Copy() override;
26121
+
26122
+ //! Serializes a blob into a CrossProductRef
26123
+ void Serialize(FieldWriter &serializer) const override;
26124
+ //! Deserializes a blob back into a CrossProductRef
26115
26125
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
26116
26126
  };
26117
26127
  } // namespace duckdb
@@ -26163,10 +26173,12 @@ public:
26163
26173
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
26164
26174
  };
26165
26175
  } // namespace duckdb
26176
+
26177
+
26166
26178
  //===----------------------------------------------------------------------===//
26167
26179
  // DuckDB
26168
26180
  //
26169
- // duckdb/parser/tableref/subqueryref.hpp
26181
+ // duckdb/parser/tableref/emptytableref.hpp
26170
26182
  //
26171
26183
  //
26172
26184
  //===----------------------------------------------------------------------===//
@@ -26175,17 +26187,12 @@ public:
26175
26187
 
26176
26188
 
26177
26189
 
26178
-
26179
26190
  namespace duckdb {
26180
- //! Represents a subquery
26181
- class SubqueryRef : public TableRef {
26191
+ //! Represents a cross product
26192
+ class EmptyTableRef : public TableRef {
26182
26193
  public:
26183
- explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
26184
-
26185
- //! The subquery
26186
- unique_ptr<SelectStatement> subquery;
26187
- //! Aliases for the column names
26188
- vector<string> column_name_alias;
26194
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
26195
+ }
26189
26196
 
26190
26197
  public:
26191
26198
  string ToString() const override;
@@ -26193,16 +26200,17 @@ public:
26193
26200
 
26194
26201
  unique_ptr<TableRef> Copy() override;
26195
26202
 
26196
- //! Serializes a blob into a SubqueryRef
26203
+ //! Serializes a blob into a DummyTableRef
26197
26204
  void Serialize(FieldWriter &serializer) const override;
26198
- //! Deserializes a blob back into a SubqueryRef
26205
+ //! Deserializes a blob back into a DummyTableRef
26199
26206
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
26200
26207
  };
26201
26208
  } // namespace duckdb
26209
+
26202
26210
  //===----------------------------------------------------------------------===//
26203
26211
  // DuckDB
26204
26212
  //
26205
- // duckdb/parser/tableref/emptytableref.hpp
26213
+ // duckdb/parser/tableref/expressionlistref.hpp
26206
26214
  //
26207
26215
  //
26208
26216
  //===----------------------------------------------------------------------===//
@@ -26211,29 +26219,41 @@ public:
26211
26219
 
26212
26220
 
26213
26221
 
26222
+
26223
+
26224
+
26214
26225
  namespace duckdb {
26215
- //! Represents a cross product
26216
- class EmptyTableRef : public TableRef {
26226
+ //! Represents an expression list as generated by a VALUES statement
26227
+ class ExpressionListRef : public TableRef {
26217
26228
  public:
26218
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
26229
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
26219
26230
  }
26220
26231
 
26232
+ //! Value list, only used for VALUES statement
26233
+ vector<vector<unique_ptr<ParsedExpression>>> values;
26234
+ //! Expected SQL types
26235
+ vector<LogicalType> expected_types;
26236
+ //! The set of expected names
26237
+ vector<string> expected_names;
26238
+
26221
26239
  public:
26222
26240
  string ToString() const override;
26223
26241
  bool Equals(const TableRef *other_p) const override;
26224
26242
 
26225
26243
  unique_ptr<TableRef> Copy() override;
26226
26244
 
26227
- //! Serializes a blob into a DummyTableRef
26245
+ //! Serializes a blob into a ExpressionListRef
26228
26246
  void Serialize(FieldWriter &serializer) const override;
26229
- //! Deserializes a blob back into a DummyTableRef
26247
+ //! Deserializes a blob back into a ExpressionListRef
26230
26248
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
26231
26249
  };
26232
26250
  } // namespace duckdb
26251
+
26252
+
26233
26253
  //===----------------------------------------------------------------------===//
26234
26254
  // DuckDB
26235
26255
  //
26236
- // duckdb/parser/tableref/table_function_ref.hpp
26256
+ // duckdb/parser/tableref/subqueryref.hpp
26237
26257
  //
26238
26258
  //
26239
26259
  //===----------------------------------------------------------------------===//
@@ -26243,41 +26263,34 @@ public:
26243
26263
 
26244
26264
 
26245
26265
 
26246
-
26247
-
26248
-
26249
26266
  namespace duckdb {
26250
- //! Represents a Table producing function
26251
- class TableFunctionRef : public TableRef {
26267
+ //! Represents a subquery
26268
+ class SubqueryRef : public TableRef {
26252
26269
  public:
26253
- DUCKDB_API TableFunctionRef();
26254
-
26255
- unique_ptr<ParsedExpression> function;
26256
- vector<string> column_name_alias;
26270
+ explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
26257
26271
 
26258
- // if the function takes a subquery as argument its in here
26272
+ //! The subquery
26259
26273
  unique_ptr<SelectStatement> subquery;
26260
-
26261
- // External dependencies of this table funcion
26262
- unique_ptr<ExternalDependency> external_dependency;
26274
+ //! Aliases for the column names
26275
+ vector<string> column_name_alias;
26263
26276
 
26264
26277
  public:
26265
26278
  string ToString() const override;
26266
-
26267
26279
  bool Equals(const TableRef *other_p) const override;
26268
26280
 
26269
26281
  unique_ptr<TableRef> Copy() override;
26270
26282
 
26271
- //! Serializes a blob into a BaseTableRef
26283
+ //! Serializes a blob into a SubqueryRef
26272
26284
  void Serialize(FieldWriter &serializer) const override;
26273
- //! Deserializes a blob back into a BaseTableRef
26285
+ //! Deserializes a blob back into a SubqueryRef
26274
26286
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
26275
26287
  };
26276
26288
  } // namespace duckdb
26289
+
26277
26290
  //===----------------------------------------------------------------------===//
26278
26291
  // DuckDB
26279
26292
  //
26280
- // duckdb/parser/tableref/crossproductref.hpp
26293
+ // duckdb/parser/tableref/table_function_ref.hpp
26281
26294
  //
26282
26295
  //
26283
26296
  //===----------------------------------------------------------------------===//
@@ -26286,34 +26299,36 @@ public:
26286
26299
 
26287
26300
 
26288
26301
 
26302
+
26303
+
26304
+
26305
+
26289
26306
  namespace duckdb {
26290
- //! Represents a cross product
26291
- class CrossProductRef : public TableRef {
26307
+ //! Represents a Table producing function
26308
+ class TableFunctionRef : public TableRef {
26292
26309
  public:
26293
- CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
26294
- }
26310
+ DUCKDB_API TableFunctionRef();
26295
26311
 
26296
- //! The left hand side of the cross product
26297
- unique_ptr<TableRef> left;
26298
- //! The right hand side of the cross product
26299
- unique_ptr<TableRef> right;
26312
+ unique_ptr<ParsedExpression> function;
26313
+ vector<string> column_name_alias;
26314
+
26315
+ // if the function takes a subquery as argument its in here
26316
+ unique_ptr<SelectStatement> subquery;
26317
+
26318
+ // External dependencies of this table funcion
26319
+ unique_ptr<ExternalDependency> external_dependency;
26300
26320
 
26301
26321
  public:
26302
26322
  string ToString() const override;
26323
+
26303
26324
  bool Equals(const TableRef *other_p) const override;
26304
26325
 
26305
26326
  unique_ptr<TableRef> Copy() override;
26306
26327
 
26307
- //! Serializes a blob into a CrossProductRef
26328
+ //! Serializes a blob into a BaseTableRef
26308
26329
  void Serialize(FieldWriter &serializer) const override;
26309
- //! Deserializes a blob back into a CrossProductRef
26330
+ //! Deserializes a blob back into a BaseTableRef
26310
26331
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
26311
26332
  };
26312
26333
  } // namespace duckdb
26313
26334
 
26314
-
26315
-
26316
-
26317
-
26318
-
26319
-