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