duckdb 0.3.5-dev396.0 → 0.3.5-dev411.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 "8eb9779e6"
15
- #define DUCKDB_VERSION "v0.3.5-dev396"
14
+ #define DUCKDB_SOURCE_ID "43bb9d9ea"
15
+ #define DUCKDB_VERSION "v0.3.5-dev411"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -9830,7 +9830,10 @@ public:
9830
9830
  }
9831
9831
  }
9832
9832
 
9833
- DUCKDB_API static void ToArrowSchema(ArrowSchema *out_schema, vector<LogicalType> &types, vector<string> &names);
9833
+ DUCKDB_API static void ToArrowSchema(ArrowSchema *out_schema, vector<LogicalType> &types, vector<string> &names,
9834
+ string &config_timezone);
9835
+
9836
+ static string GetConfigTimezone(QueryResult &query_result);
9834
9837
 
9835
9838
  private:
9836
9839
  //! The current chunk used by the iterator
@@ -9908,16 +9911,25 @@ private:
9908
9911
 
9909
9912
  namespace duckdb {
9910
9913
 
9914
+ class ClientContext;
9915
+
9911
9916
  class MaterializedQueryResult : public QueryResult {
9912
9917
  public:
9918
+ friend class ClientContext;
9919
+ //! Creates an empty successful query result
9920
+ DUCKDB_API explicit MaterializedQueryResult(StatementType statement_type);
9913
9921
  //! Creates a successful query result with the specified names and types
9914
9922
  DUCKDB_API MaterializedQueryResult(StatementType statement_type, StatementProperties properties,
9915
- vector<LogicalType> types, vector<string> names);
9923
+ vector<LogicalType> types, vector<string> names,
9924
+ const shared_ptr<ClientContext> &context);
9916
9925
  //! Creates an unsuccessful query result with error condition
9917
9926
  DUCKDB_API explicit MaterializedQueryResult(string error);
9918
9927
 
9919
9928
  ChunkCollection collection;
9920
9929
 
9930
+ //! The client context this MaterializedQueryResult belongs to
9931
+ std::weak_ptr<ClientContext> context;
9932
+
9921
9933
  public:
9922
9934
  //! Fetches a DataChunk from the query result.
9923
9935
  //! This will consume the result (i.e. the chunks are taken directly from the ChunkCollection).
@@ -17064,7 +17076,6 @@ public:
17064
17076
  //! Closes the StreamQueryResult
17065
17077
  DUCKDB_API void Close();
17066
17078
 
17067
- private:
17068
17079
  //! The client context this StreamQueryResult belongs to
17069
17080
  shared_ptr<ClientContext> context;
17070
17081
 
@@ -17244,6 +17255,8 @@ struct ClientConfig {
17244
17255
 
17245
17256
  public:
17246
17257
  static ClientConfig &GetConfig(ClientContext &context);
17258
+
17259
+ static string ExtractTimezoneFromConfig(ClientConfig &config);
17247
17260
  };
17248
17261
 
17249
17262
  } // namespace duckdb
@@ -22469,114 +22482,6 @@ private:
22469
22482
  unique_ptr<StreamWrapper> stream_wrapper;
22470
22483
  };
22471
22484
 
22472
- } // namespace duckdb
22473
- //===----------------------------------------------------------------------===//
22474
- // DuckDB
22475
- //
22476
- // duckdb/parser/expression/lambda_expression.hpp
22477
- //
22478
- //
22479
- //===----------------------------------------------------------------------===//
22480
-
22481
-
22482
-
22483
-
22484
-
22485
-
22486
- namespace duckdb {
22487
-
22488
- //! LambdaExpression represents either:
22489
- //! 1. A lambda operator that can be used for e.g. mapping an expression to a list
22490
- //! 2. An OperatorExpression with the "->" operator
22491
- //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
22492
- class LambdaExpression : public ParsedExpression {
22493
- public:
22494
- LambdaExpression(unique_ptr<ParsedExpression> lhs, unique_ptr<ParsedExpression> rhs);
22495
-
22496
- unique_ptr<ParsedExpression> lhs;
22497
- unique_ptr<ParsedExpression> rhs;
22498
-
22499
- public:
22500
- string ToString() const override;
22501
-
22502
- static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
22503
- hash_t Hash() const override;
22504
-
22505
- unique_ptr<ParsedExpression> Copy() const override;
22506
-
22507
- void Serialize(FieldWriter &writer) const override;
22508
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22509
- };
22510
-
22511
- } // namespace duckdb
22512
- //===----------------------------------------------------------------------===//
22513
- // DuckDB
22514
- //
22515
- // duckdb/parser/expression/star_expression.hpp
22516
- //
22517
- //
22518
- //===----------------------------------------------------------------------===//
22519
-
22520
-
22521
-
22522
-
22523
-
22524
-
22525
- namespace duckdb {
22526
-
22527
- //! Represents a * expression in the SELECT clause
22528
- class StarExpression : public ParsedExpression {
22529
- public:
22530
- StarExpression(string relation_name = string());
22531
-
22532
- //! The relation name in case of tbl.*, or empty if this is a normal *
22533
- string relation_name;
22534
- //! List of columns to exclude from the STAR expression
22535
- case_insensitive_set_t exclude_list;
22536
- //! List of columns to replace with another expression
22537
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
22538
-
22539
- public:
22540
- string ToString() const override;
22541
-
22542
- static bool Equals(const StarExpression *a, const StarExpression *b);
22543
-
22544
- unique_ptr<ParsedExpression> Copy() const override;
22545
-
22546
- void Serialize(FieldWriter &writer) const override;
22547
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22548
- };
22549
- } // namespace duckdb
22550
- //===----------------------------------------------------------------------===//
22551
- // DuckDB
22552
- //
22553
- // duckdb/parser/expression/default_expression.hpp
22554
- //
22555
- //
22556
- //===----------------------------------------------------------------------===//
22557
-
22558
-
22559
-
22560
-
22561
-
22562
- namespace duckdb {
22563
- //! Represents the default value of a column
22564
- class DefaultExpression : public ParsedExpression {
22565
- public:
22566
- DefaultExpression();
22567
-
22568
- public:
22569
- bool IsScalar() const override {
22570
- return false;
22571
- }
22572
-
22573
- string ToString() const override;
22574
-
22575
- unique_ptr<ParsedExpression> Copy() const override;
22576
-
22577
- void Serialize(FieldWriter &writer) const override;
22578
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22579
- };
22580
22485
  } // namespace duckdb
22581
22486
  //===----------------------------------------------------------------------===//
22582
22487
  // DuckDB
@@ -22681,7 +22586,7 @@ public:
22681
22586
  //===----------------------------------------------------------------------===//
22682
22587
  // DuckDB
22683
22588
  //
22684
- // duckdb/parser/expression/conjunction_expression.hpp
22589
+ // duckdb/parser/expression/star_expression.hpp
22685
22590
  //
22686
22591
  //
22687
22592
  //===----------------------------------------------------------------------===//
@@ -22693,43 +22598,33 @@ public:
22693
22598
 
22694
22599
  namespace duckdb {
22695
22600
 
22696
- //! Represents a conjunction (AND/OR)
22697
- class ConjunctionExpression : public ParsedExpression {
22601
+ //! Represents a * expression in the SELECT clause
22602
+ class StarExpression : public ParsedExpression {
22698
22603
  public:
22699
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22700
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22701
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22702
- unique_ptr<ParsedExpression> right);
22604
+ StarExpression(string relation_name = string());
22703
22605
 
22704
- vector<unique_ptr<ParsedExpression>> children;
22606
+ //! The relation name in case of tbl.*, or empty if this is a normal *
22607
+ string relation_name;
22608
+ //! List of columns to exclude from the STAR expression
22609
+ case_insensitive_set_t exclude_list;
22610
+ //! List of columns to replace with another expression
22611
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
22705
22612
 
22706
22613
  public:
22707
- void AddExpression(unique_ptr<ParsedExpression> expr);
22708
-
22709
22614
  string ToString() const override;
22710
22615
 
22711
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22616
+ static bool Equals(const StarExpression *a, const StarExpression *b);
22712
22617
 
22713
22618
  unique_ptr<ParsedExpression> Copy() const override;
22714
22619
 
22715
22620
  void Serialize(FieldWriter &writer) const override;
22716
22621
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22717
-
22718
- public:
22719
- template <class T, class BASE>
22720
- static string ToString(const T &entry) {
22721
- string result = "(" + entry.children[0]->ToString();
22722
- for (idx_t i = 1; i < entry.children.size(); i++) {
22723
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22724
- }
22725
- return result + ")";
22726
- }
22727
22622
  };
22728
22623
  } // namespace duckdb
22729
22624
  //===----------------------------------------------------------------------===//
22730
22625
  // DuckDB
22731
22626
  //
22732
- // duckdb/parser/expression/constant_expression.hpp
22627
+ // duckdb/parser/expression/cast_expression.hpp
22733
22628
  //
22734
22629
  //
22735
22630
  //===----------------------------------------------------------------------===//
@@ -22741,31 +22636,40 @@ public:
22741
22636
 
22742
22637
  namespace duckdb {
22743
22638
 
22744
- //! ConstantExpression represents a constant value in the query
22745
- class ConstantExpression : public ParsedExpression {
22639
+ //! CastExpression represents a type cast from one SQL type to another SQL type
22640
+ class CastExpression : public ParsedExpression {
22746
22641
  public:
22747
- DUCKDB_API explicit ConstantExpression(Value val);
22642
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22748
22643
 
22749
- //! The constant value referenced
22750
- Value value;
22644
+ //! The child of the cast expression
22645
+ unique_ptr<ParsedExpression> child;
22646
+ //! The type to cast to
22647
+ LogicalType cast_type;
22648
+ //! Whether or not this is a try_cast expression
22649
+ bool try_cast;
22751
22650
 
22752
22651
  public:
22753
22652
  string ToString() const override;
22754
22653
 
22755
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22756
- hash_t Hash() const override;
22654
+ static bool Equals(const CastExpression *a, const CastExpression *b);
22757
22655
 
22758
22656
  unique_ptr<ParsedExpression> Copy() const override;
22759
22657
 
22760
22658
  void Serialize(FieldWriter &writer) const override;
22761
22659
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22762
- };
22763
22660
 
22661
+ public:
22662
+ template <class T, class BASE>
22663
+ static string ToString(const T &entry) {
22664
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22665
+ entry.cast_type.ToString() + ")";
22666
+ }
22667
+ };
22764
22668
  } // namespace duckdb
22765
22669
  //===----------------------------------------------------------------------===//
22766
22670
  // DuckDB
22767
22671
  //
22768
- // duckdb/parser/expression/case_expression.hpp
22672
+ // duckdb/parser/expression/positional_reference_expression.hpp
22769
22673
  //
22770
22674
  //
22771
22675
  //===----------------------------------------------------------------------===//
@@ -22774,50 +22678,32 @@ public:
22774
22678
 
22775
22679
 
22776
22680
 
22777
-
22778
22681
  namespace duckdb {
22779
-
22780
- struct CaseCheck {
22781
- unique_ptr<ParsedExpression> when_expr;
22782
- unique_ptr<ParsedExpression> then_expr;
22783
- };
22784
-
22785
- //! The CaseExpression represents a CASE expression in the query
22786
- class CaseExpression : public ParsedExpression {
22682
+ class PositionalReferenceExpression : public ParsedExpression {
22787
22683
  public:
22788
- DUCKDB_API CaseExpression();
22684
+ DUCKDB_API PositionalReferenceExpression(idx_t index);
22789
22685
 
22790
- vector<CaseCheck> case_checks;
22791
- unique_ptr<ParsedExpression> else_expr;
22686
+ idx_t index;
22792
22687
 
22793
22688
  public:
22794
- string ToString() const override;
22689
+ bool IsScalar() const override {
22690
+ return false;
22691
+ }
22795
22692
 
22796
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
22693
+ string ToString() const override;
22797
22694
 
22695
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
22798
22696
  unique_ptr<ParsedExpression> Copy() const override;
22697
+ hash_t Hash() const override;
22799
22698
 
22800
22699
  void Serialize(FieldWriter &writer) const override;
22801
22700
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22802
-
22803
- public:
22804
- template <class T, class BASE>
22805
- static string ToString(const T &entry) {
22806
- string case_str = "CASE ";
22807
- for (auto &check : entry.case_checks) {
22808
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
22809
- case_str += " THEN (" + check.then_expr->ToString() + ")";
22810
- }
22811
- case_str += " ELSE " + entry.else_expr->ToString();
22812
- case_str += " END";
22813
- return case_str;
22814
- }
22815
22701
  };
22816
22702
  } // namespace duckdb
22817
22703
  //===----------------------------------------------------------------------===//
22818
22704
  // DuckDB
22819
22705
  //
22820
- // duckdb/parser/expression/between_expression.hpp
22706
+ // duckdb/parser/expression/conjunction_expression.hpp
22821
22707
  //
22822
22708
  //
22823
22709
  //===----------------------------------------------------------------------===//
@@ -22826,21 +22712,25 @@ public:
22826
22712
 
22827
22713
 
22828
22714
 
22715
+
22829
22716
  namespace duckdb {
22830
22717
 
22831
- class BetweenExpression : public ParsedExpression {
22718
+ //! Represents a conjunction (AND/OR)
22719
+ class ConjunctionExpression : public ParsedExpression {
22832
22720
  public:
22833
- DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22834
- unique_ptr<ParsedExpression> upper);
22721
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22722
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22723
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22724
+ unique_ptr<ParsedExpression> right);
22835
22725
 
22836
- unique_ptr<ParsedExpression> input;
22837
- unique_ptr<ParsedExpression> lower;
22838
- unique_ptr<ParsedExpression> upper;
22726
+ vector<unique_ptr<ParsedExpression>> children;
22839
22727
 
22840
22728
  public:
22729
+ void AddExpression(unique_ptr<ParsedExpression> expr);
22730
+
22841
22731
  string ToString() const override;
22842
22732
 
22843
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22733
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22844
22734
 
22845
22735
  unique_ptr<ParsedExpression> Copy() const override;
22846
22736
 
@@ -22850,17 +22740,18 @@ public:
22850
22740
  public:
22851
22741
  template <class T, class BASE>
22852
22742
  static string ToString(const T &entry) {
22853
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22743
+ string result = "(" + entry.children[0]->ToString();
22744
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22745
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22746
+ }
22747
+ return result + ")";
22854
22748
  }
22855
22749
  };
22856
22750
  } // namespace duckdb
22857
-
22858
-
22859
-
22860
22751
  //===----------------------------------------------------------------------===//
22861
22752
  // DuckDB
22862
22753
  //
22863
- // duckdb/parser/expression/cast_expression.hpp
22754
+ // duckdb/parser/expression/parameter_expression.hpp
22864
22755
  //
22865
22756
  //
22866
22757
  //===----------------------------------------------------------------------===//
@@ -22869,40 +22760,30 @@ public:
22869
22760
 
22870
22761
 
22871
22762
 
22872
-
22873
22763
  namespace duckdb {
22874
-
22875
- //! CastExpression represents a type cast from one SQL type to another SQL type
22876
- class CastExpression : public ParsedExpression {
22764
+ class ParameterExpression : public ParsedExpression {
22877
22765
  public:
22878
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22766
+ ParameterExpression();
22879
22767
 
22880
- //! The child of the cast expression
22881
- unique_ptr<ParsedExpression> child;
22882
- //! The type to cast to
22883
- LogicalType cast_type;
22884
- //! Whether or not this is a try_cast expression
22885
- bool try_cast;
22768
+ idx_t parameter_nr;
22886
22769
 
22887
22770
  public:
22888
- string ToString() const override;
22771
+ bool IsScalar() const override {
22772
+ return true;
22773
+ }
22774
+ bool HasParameter() const override {
22775
+ return true;
22776
+ }
22889
22777
 
22890
- static bool Equals(const CastExpression *a, const CastExpression *b);
22778
+ string ToString() const override;
22891
22779
 
22892
22780
  unique_ptr<ParsedExpression> Copy() const override;
22781
+ hash_t Hash() const override;
22893
22782
 
22894
22783
  void Serialize(FieldWriter &writer) const override;
22895
22784
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22896
-
22897
- public:
22898
- template <class T, class BASE>
22899
- static string ToString(const T &entry) {
22900
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22901
- entry.cast_type.ToString() + ")";
22902
- }
22903
22785
  };
22904
22786
  } // namespace duckdb
22905
-
22906
22787
  //===----------------------------------------------------------------------===//
22907
22788
  // DuckDB
22908
22789
  //
@@ -22938,12 +22819,59 @@ public:
22938
22819
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22939
22820
  };
22940
22821
  } // namespace duckdb
22822
+ //===----------------------------------------------------------------------===//
22823
+ // DuckDB
22824
+ //
22825
+ // duckdb/parser/expression/subquery_expression.hpp
22826
+ //
22827
+ //
22828
+ //===----------------------------------------------------------------------===//
22829
+
22830
+
22831
+
22832
+
22833
+
22834
+
22941
22835
 
22836
+ namespace duckdb {
22837
+
22838
+ //! Represents a subquery
22839
+ class SubqueryExpression : public ParsedExpression {
22840
+ public:
22841
+ SubqueryExpression();
22842
+
22843
+ //! The actual subquery
22844
+ unique_ptr<SelectStatement> subquery;
22845
+ //! The subquery type
22846
+ SubqueryType subquery_type;
22847
+ //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
22848
+ //! subquery)
22849
+ unique_ptr<ParsedExpression> child;
22850
+ //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
22851
+ ExpressionType comparison_type;
22942
22852
 
22853
+ public:
22854
+ bool HasSubquery() const override {
22855
+ return true;
22856
+ }
22857
+ bool IsScalar() const override {
22858
+ return false;
22859
+ }
22860
+
22861
+ string ToString() const override;
22862
+
22863
+ static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
22864
+
22865
+ unique_ptr<ParsedExpression> Copy() const override;
22866
+
22867
+ void Serialize(FieldWriter &writer) const override;
22868
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22869
+ };
22870
+ } // namespace duckdb
22943
22871
  //===----------------------------------------------------------------------===//
22944
22872
  // DuckDB
22945
22873
  //
22946
- // duckdb/parser/expression/comparison_expression.hpp
22874
+ // duckdb/parser/expression/between_expression.hpp
22947
22875
  //
22948
22876
  //
22949
22877
  //===----------------------------------------------------------------------===//
@@ -22953,20 +22881,20 @@ public:
22953
22881
 
22954
22882
 
22955
22883
  namespace duckdb {
22956
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22957
- //! and has two children.
22958
- class ComparisonExpression : public ParsedExpression {
22884
+
22885
+ class BetweenExpression : public ParsedExpression {
22959
22886
  public:
22960
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22961
- unique_ptr<ParsedExpression> right);
22887
+ DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22888
+ unique_ptr<ParsedExpression> upper);
22962
22889
 
22963
- unique_ptr<ParsedExpression> left;
22964
- unique_ptr<ParsedExpression> right;
22890
+ unique_ptr<ParsedExpression> input;
22891
+ unique_ptr<ParsedExpression> lower;
22892
+ unique_ptr<ParsedExpression> upper;
22965
22893
 
22966
22894
  public:
22967
22895
  string ToString() const override;
22968
22896
 
22969
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22897
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22970
22898
 
22971
22899
  unique_ptr<ParsedExpression> Copy() const override;
22972
22900
 
@@ -22976,14 +22904,98 @@ public:
22976
22904
  public:
22977
22905
  template <class T, class BASE>
22978
22906
  static string ToString(const T &entry) {
22979
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22907
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22908
+ }
22909
+ };
22910
+ } // namespace duckdb
22911
+ //===----------------------------------------------------------------------===//
22912
+ // DuckDB
22913
+ //
22914
+ // duckdb/parser/expression/case_expression.hpp
22915
+ //
22916
+ //
22917
+ //===----------------------------------------------------------------------===//
22918
+
22919
+
22920
+
22921
+
22922
+
22923
+
22924
+ namespace duckdb {
22925
+
22926
+ struct CaseCheck {
22927
+ unique_ptr<ParsedExpression> when_expr;
22928
+ unique_ptr<ParsedExpression> then_expr;
22929
+ };
22930
+
22931
+ //! The CaseExpression represents a CASE expression in the query
22932
+ class CaseExpression : public ParsedExpression {
22933
+ public:
22934
+ DUCKDB_API CaseExpression();
22935
+
22936
+ vector<CaseCheck> case_checks;
22937
+ unique_ptr<ParsedExpression> else_expr;
22938
+
22939
+ public:
22940
+ string ToString() const override;
22941
+
22942
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
22943
+
22944
+ unique_ptr<ParsedExpression> Copy() const override;
22945
+
22946
+ void Serialize(FieldWriter &writer) const override;
22947
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22948
+
22949
+ public:
22950
+ template <class T, class BASE>
22951
+ static string ToString(const T &entry) {
22952
+ string case_str = "CASE ";
22953
+ for (auto &check : entry.case_checks) {
22954
+ case_str += " WHEN (" + check.when_expr->ToString() + ")";
22955
+ case_str += " THEN (" + check.then_expr->ToString() + ")";
22956
+ }
22957
+ case_str += " ELSE " + entry.else_expr->ToString();
22958
+ case_str += " END";
22959
+ return case_str;
22980
22960
  }
22981
22961
  };
22982
22962
  } // namespace duckdb
22963
+ //===----------------------------------------------------------------------===//
22964
+ // DuckDB
22965
+ //
22966
+ // duckdb/parser/expression/constant_expression.hpp
22967
+ //
22968
+ //
22969
+ //===----------------------------------------------------------------------===//
22970
+
22971
+
22972
+
22973
+
22974
+
22975
+
22976
+ namespace duckdb {
22977
+
22978
+ //! ConstantExpression represents a constant value in the query
22979
+ class ConstantExpression : public ParsedExpression {
22980
+ public:
22981
+ DUCKDB_API explicit ConstantExpression(Value val);
22982
+
22983
+ //! The constant value referenced
22984
+ Value value;
22983
22985
 
22986
+ public:
22987
+ string ToString() const override;
22988
+
22989
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22990
+ hash_t Hash() const override;
22984
22991
 
22992
+ unique_ptr<ParsedExpression> Copy() const override;
22985
22993
 
22994
+ void Serialize(FieldWriter &writer) const override;
22995
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22996
+ };
22986
22997
 
22998
+ } // namespace duckdb
22987
22999
  //===----------------------------------------------------------------------===//
22988
23000
  // DuckDB
22989
23001
  //
@@ -23104,10 +23116,13 @@ public:
23104
23116
 
23105
23117
 
23106
23118
 
23119
+
23120
+
23121
+
23107
23122
  //===----------------------------------------------------------------------===//
23108
23123
  // DuckDB
23109
23124
  //
23110
- // duckdb/parser/expression/parameter_expression.hpp
23125
+ // duckdb/parser/expression/comparison_expression.hpp
23111
23126
  //
23112
23127
  //
23113
23128
  //===----------------------------------------------------------------------===//
@@ -23117,34 +23132,40 @@ public:
23117
23132
 
23118
23133
 
23119
23134
  namespace duckdb {
23120
- class ParameterExpression : public ParsedExpression {
23135
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
23136
+ //! and has two children.
23137
+ class ComparisonExpression : public ParsedExpression {
23121
23138
  public:
23122
- ParameterExpression();
23139
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
23140
+ unique_ptr<ParsedExpression> right);
23123
23141
 
23124
- idx_t parameter_nr;
23142
+ unique_ptr<ParsedExpression> left;
23143
+ unique_ptr<ParsedExpression> right;
23125
23144
 
23126
23145
  public:
23127
- bool IsScalar() const override {
23128
- return true;
23129
- }
23130
- bool HasParameter() const override {
23131
- return true;
23132
- }
23133
-
23134
23146
  string ToString() const override;
23135
23147
 
23148
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
23149
+
23136
23150
  unique_ptr<ParsedExpression> Copy() const override;
23137
- hash_t Hash() const override;
23138
23151
 
23139
23152
  void Serialize(FieldWriter &writer) const override;
23140
23153
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23154
+
23155
+ public:
23156
+ template <class T, class BASE>
23157
+ static string ToString(const T &entry) {
23158
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
23159
+ }
23141
23160
  };
23142
23161
  } // namespace duckdb
23143
23162
 
23163
+
23164
+
23144
23165
  //===----------------------------------------------------------------------===//
23145
23166
  // DuckDB
23146
23167
  //
23147
- // duckdb/parser/expression/positional_reference_expression.hpp
23168
+ // duckdb/parser/expression/default_expression.hpp
23148
23169
  //
23149
23170
  //
23150
23171
  //===----------------------------------------------------------------------===//
@@ -23154,11 +23175,10 @@ public:
23154
23175
 
23155
23176
 
23156
23177
  namespace duckdb {
23157
- class PositionalReferenceExpression : public ParsedExpression {
23178
+ //! Represents the default value of a column
23179
+ class DefaultExpression : public ParsedExpression {
23158
23180
  public:
23159
- DUCKDB_API PositionalReferenceExpression(idx_t index);
23160
-
23161
- idx_t index;
23181
+ DefaultExpression();
23162
23182
 
23163
23183
  public:
23164
23184
  bool IsScalar() const override {
@@ -23167,9 +23187,7 @@ public:
23167
23187
 
23168
23188
  string ToString() const override;
23169
23189
 
23170
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
23171
23190
  unique_ptr<ParsedExpression> Copy() const override;
23172
- hash_t Hash() const override;
23173
23191
 
23174
23192
  void Serialize(FieldWriter &writer) const override;
23175
23193
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
@@ -23180,7 +23198,7 @@ public:
23180
23198
  //===----------------------------------------------------------------------===//
23181
23199
  // DuckDB
23182
23200
  //
23183
- // duckdb/parser/expression/subquery_expression.hpp
23201
+ // duckdb/parser/expression/lambda_expression.hpp
23184
23202
  //
23185
23203
  //
23186
23204
  //===----------------------------------------------------------------------===//
@@ -23190,48 +23208,43 @@ public:
23190
23208
 
23191
23209
 
23192
23210
 
23193
-
23194
23211
  namespace duckdb {
23195
23212
 
23196
- //! Represents a subquery
23197
- class SubqueryExpression : public ParsedExpression {
23213
+ //! LambdaExpression represents either:
23214
+ //! 1. A lambda operator that can be used for e.g. mapping an expression to a list
23215
+ //! 2. An OperatorExpression with the "->" operator
23216
+ //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
23217
+ class LambdaExpression : public ParsedExpression {
23198
23218
  public:
23199
- SubqueryExpression();
23219
+ LambdaExpression(unique_ptr<ParsedExpression> lhs, unique_ptr<ParsedExpression> rhs);
23200
23220
 
23201
- //! The actual subquery
23202
- unique_ptr<SelectStatement> subquery;
23203
- //! The subquery type
23204
- SubqueryType subquery_type;
23205
- //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
23206
- //! subquery)
23207
- unique_ptr<ParsedExpression> child;
23208
- //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
23209
- ExpressionType comparison_type;
23221
+ unique_ptr<ParsedExpression> lhs;
23222
+ unique_ptr<ParsedExpression> rhs;
23210
23223
 
23211
23224
  public:
23212
- bool HasSubquery() const override {
23213
- return true;
23214
- }
23215
- bool IsScalar() const override {
23216
- return false;
23217
- }
23218
-
23219
23225
  string ToString() const override;
23220
23226
 
23221
- static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
23227
+ static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
23228
+ hash_t Hash() const override;
23222
23229
 
23223
23230
  unique_ptr<ParsedExpression> Copy() const override;
23224
23231
 
23225
23232
  void Serialize(FieldWriter &writer) const override;
23226
23233
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23227
23234
  };
23235
+
23228
23236
  } // namespace duckdb
23229
23237
 
23230
23238
 
23239
+
23240
+
23241
+
23242
+
23243
+
23231
23244
  //===----------------------------------------------------------------------===//
23232
23245
  // DuckDB
23233
23246
  //
23234
- // duckdb/parser/parsed_data/export_table_data.hpp
23247
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23235
23248
  //
23236
23249
  //
23237
23250
  //===----------------------------------------------------------------------===//
@@ -23243,31 +23256,36 @@ public:
23243
23256
 
23244
23257
  namespace duckdb {
23245
23258
 
23246
- struct ExportedTableData {
23247
- //! Name of the exported table
23248
- string table_name;
23249
-
23250
- //! Name of the schema
23251
- string schema_name;
23259
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23260
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
23261
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23262
+ this->name = function.name;
23263
+ functions.AddFunction(move(function));
23264
+ }
23252
23265
 
23253
- //! Path to be exported
23254
- string file_path;
23255
- };
23266
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23267
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23268
+ this->name = functions.name;
23269
+ for (auto &func : functions.functions) {
23270
+ func.name = functions.name;
23271
+ }
23272
+ }
23256
23273
 
23257
- struct ExportedTableInfo {
23258
- TableCatalogEntry *entry;
23259
- ExportedTableData table_data;
23260
- };
23274
+ AggregateFunctionSet functions;
23261
23275
 
23262
- struct BoundExportData : public ParseInfo {
23263
- std::vector<ExportedTableInfo> data;
23276
+ public:
23277
+ unique_ptr<CreateInfo> Copy() const override {
23278
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23279
+ CopyProperties(*result);
23280
+ return move(result);
23281
+ }
23264
23282
  };
23265
23283
 
23266
23284
  } // namespace duckdb
23267
23285
  //===----------------------------------------------------------------------===//
23268
23286
  // DuckDB
23269
23287
  //
23270
- // duckdb/parser/parsed_data/create_index_info.hpp
23288
+ // duckdb/parser/parsed_data/drop_info.hpp
23271
23289
  //
23272
23290
  //
23273
23291
  //===----------------------------------------------------------------------===//
@@ -23277,10 +23295,41 @@ struct BoundExportData : public ParseInfo {
23277
23295
 
23278
23296
 
23279
23297
 
23298
+ namespace duckdb {
23299
+
23300
+ struct DropInfo : public ParseInfo {
23301
+ DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23302
+ }
23303
+
23304
+ //! The catalog type to drop
23305
+ CatalogType type;
23306
+ //! Schema name to drop from, if any
23307
+ string schema;
23308
+ //! Element name to drop
23309
+ string name;
23310
+ //! Ignore if the entry does not exist instead of failing
23311
+ bool if_exists = false;
23312
+ //! Cascade drop (drop all dependents instead of throwing an error if there
23313
+ //! are any)
23314
+ bool cascade = false;
23315
+
23316
+ public:
23317
+ unique_ptr<DropInfo> Copy() const {
23318
+ auto result = make_unique<DropInfo>();
23319
+ result->type = type;
23320
+ result->schema = schema;
23321
+ result->name = name;
23322
+ result->if_exists = if_exists;
23323
+ result->cascade = cascade;
23324
+ return result;
23325
+ }
23326
+ };
23327
+
23328
+ } // namespace duckdb
23280
23329
  //===----------------------------------------------------------------------===//
23281
23330
  // DuckDB
23282
23331
  //
23283
- // duckdb/parser/tableref/basetableref.hpp
23332
+ // duckdb/parser/parsed_data/create_collation_info.hpp
23284
23333
  //
23285
23334
  //
23286
23335
  //===----------------------------------------------------------------------===//
@@ -23291,63 +23340,66 @@ struct BoundExportData : public ParseInfo {
23291
23340
 
23292
23341
 
23293
23342
  namespace duckdb {
23294
- //! Represents a TableReference to a base table in the schema
23295
- class BaseTableRef : public TableRef {
23296
- public:
23297
- BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
23343
+
23344
+ struct CreateCollationInfo : public CreateInfo {
23345
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23346
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23347
+ not_required_for_equality(not_required_for_equality_p) {
23348
+ this->name = move(name_p);
23298
23349
  }
23299
23350
 
23300
- //! Schema name
23301
- string schema_name;
23302
- //! Table name
23303
- string table_name;
23304
- //! Aliases for the column names
23305
- vector<string> column_name_alias;
23351
+ //! The name of the collation
23352
+ string name;
23353
+ //! The collation function to push in case collation is required
23354
+ ScalarFunction function;
23355
+ //! Whether or not the collation can be combined with other collations.
23356
+ bool combinable;
23357
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23358
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23359
+ //! speeds up processing.
23360
+ bool not_required_for_equality;
23306
23361
 
23307
23362
  public:
23308
- string ToString() const override;
23309
- bool Equals(const TableRef *other_p) const override;
23310
-
23311
- unique_ptr<TableRef> Copy() override;
23312
-
23313
- //! Serializes a blob into a BaseTableRef
23314
- void Serialize(FieldWriter &serializer) const override;
23315
- //! Deserializes a blob back into a BaseTableRef
23316
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
23363
+ unique_ptr<CreateInfo> Copy() const override {
23364
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23365
+ CopyProperties(*result);
23366
+ return move(result);
23367
+ }
23317
23368
  };
23369
+
23318
23370
  } // namespace duckdb
23371
+ //===----------------------------------------------------------------------===//
23372
+ // DuckDB
23373
+ //
23374
+ // duckdb/parser/parsed_data/show_select_info.hpp
23375
+ //
23376
+ //
23377
+ //===----------------------------------------------------------------------===//
23319
23378
 
23320
23379
 
23321
23380
 
23322
- namespace duckdb {
23323
23381
 
23324
- struct CreateIndexInfo : public CreateInfo {
23325
- CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
23326
- }
23327
23382
 
23328
- //! Index Type (e.g., B+-tree, Skip-List, ...)
23329
- IndexType index_type;
23330
- //! Name of the Index
23331
- string index_name;
23332
- //! If it is an unique index
23333
- bool unique = false;
23334
- //! The table to create the index on
23335
- unique_ptr<BaseTableRef> table;
23336
- //! Set of expressions to index by
23337
- vector<unique_ptr<ParsedExpression>> expressions;
23338
23383
 
23339
- public:
23340
- unique_ptr<CreateInfo> Copy() const override {
23341
- auto result = make_unique<CreateIndexInfo>();
23342
- CopyProperties(*result);
23343
- result->index_type = index_type;
23344
- result->index_name = index_name;
23345
- result->unique = unique;
23346
- result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
23347
- for (auto &expr : expressions) {
23348
- result->expressions.push_back(expr->Copy());
23349
- }
23350
- return move(result);
23384
+ namespace duckdb {
23385
+
23386
+ struct ShowSelectInfo : public ParseInfo {
23387
+ //! Types of projected columns
23388
+ vector<LogicalType> types;
23389
+ //! The QueryNode of select query
23390
+ unique_ptr<QueryNode> query;
23391
+ //! Aliases of projected columns
23392
+ vector<string> aliases;
23393
+ //! Whether or not we are requesting a summary or a describe
23394
+ bool is_summary;
23395
+
23396
+ unique_ptr<ShowSelectInfo> Copy() {
23397
+ auto result = make_unique<ShowSelectInfo>();
23398
+ result->types = types;
23399
+ result->query = query->Copy();
23400
+ result->aliases = aliases;
23401
+ result->is_summary = is_summary;
23402
+ return result;
23351
23403
  }
23352
23404
  };
23353
23405
 
@@ -23355,7 +23407,7 @@ public:
23355
23407
  //===----------------------------------------------------------------------===//
23356
23408
  // DuckDB
23357
23409
  //
23358
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23410
+ // duckdb/parser/parsed_data/transaction_info.hpp
23359
23411
  //
23360
23412
  //
23361
23413
  //===----------------------------------------------------------------------===//
@@ -23364,31 +23416,45 @@ public:
23364
23416
 
23365
23417
 
23366
23418
 
23367
-
23368
23419
  namespace duckdb {
23369
23420
 
23370
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23371
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
23372
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23373
- this->name = function.name;
23374
- functions.AddFunction(move(function));
23375
- }
23421
+ enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
23376
23422
 
23377
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23378
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23379
- this->name = functions.name;
23380
- for (auto &func : functions.functions) {
23381
- func.name = functions.name;
23382
- }
23423
+ struct TransactionInfo : public ParseInfo {
23424
+ explicit TransactionInfo(TransactionType type) : type(type) {
23383
23425
  }
23384
23426
 
23385
- AggregateFunctionSet functions;
23427
+ //! The type of transaction statement
23428
+ TransactionType type;
23429
+ };
23430
+
23431
+ } // namespace duckdb
23432
+ //===----------------------------------------------------------------------===//
23433
+ // DuckDB
23434
+ //
23435
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23436
+ //
23437
+ //
23438
+ //===----------------------------------------------------------------------===//
23439
+
23440
+
23441
+
23442
+
23443
+
23444
+ namespace duckdb {
23445
+
23446
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23447
+
23448
+ struct LoadInfo : public ParseInfo {
23449
+ std::string filename;
23450
+ LoadType load_type;
23386
23451
 
23387
23452
  public:
23388
- unique_ptr<CreateInfo> Copy() const override {
23389
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23390
- CopyProperties(*result);
23391
- return move(result);
23453
+ unique_ptr<LoadInfo> Copy() const {
23454
+ auto result = make_unique<LoadInfo>();
23455
+ result->filename = filename;
23456
+ result->load_type = load_type;
23457
+ return result;
23392
23458
  }
23393
23459
  };
23394
23460
 
@@ -23396,7 +23462,7 @@ public:
23396
23462
  //===----------------------------------------------------------------------===//
23397
23463
  // DuckDB
23398
23464
  //
23399
- // duckdb/parser/parsed_data/create_collation_info.hpp
23465
+ // duckdb/parser/parsed_data/create_type_info.hpp
23400
23466
  //
23401
23467
  //
23402
23468
  //===----------------------------------------------------------------------===//
@@ -23406,30 +23472,26 @@ public:
23406
23472
 
23407
23473
 
23408
23474
 
23475
+
23476
+
23409
23477
  namespace duckdb {
23410
23478
 
23411
- struct CreateCollationInfo : public CreateInfo {
23412
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23413
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23414
- not_required_for_equality(not_required_for_equality_p) {
23415
- this->name = move(name_p);
23479
+ struct CreateTypeInfo : public CreateInfo {
23480
+
23481
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23416
23482
  }
23417
23483
 
23418
- //! The name of the collation
23484
+ //! Name of the Type
23419
23485
  string name;
23420
- //! The collation function to push in case collation is required
23421
- ScalarFunction function;
23422
- //! Whether or not the collation can be combined with other collations.
23423
- bool combinable;
23424
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23425
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23426
- //! speeds up processing.
23427
- bool not_required_for_equality;
23486
+ //! Logical Type
23487
+ LogicalType type;
23428
23488
 
23429
23489
  public:
23430
23490
  unique_ptr<CreateInfo> Copy() const override {
23431
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23491
+ auto result = make_unique<CreateTypeInfo>();
23432
23492
  CopyProperties(*result);
23493
+ result->name = name;
23494
+ result->type = type;
23433
23495
  return move(result);
23434
23496
  }
23435
23497
  };
@@ -23438,7 +23500,7 @@ public:
23438
23500
  //===----------------------------------------------------------------------===//
23439
23501
  // DuckDB
23440
23502
  //
23441
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23503
+ // duckdb/parser/parsed_data/create_schema_info.hpp
23442
23504
  //
23443
23505
  //
23444
23506
  //===----------------------------------------------------------------------===//
@@ -23447,28 +23509,15 @@ public:
23447
23509
 
23448
23510
 
23449
23511
 
23450
-
23451
23512
  namespace duckdb {
23452
23513
 
23453
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23454
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
23455
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23456
- functions.push_back(move(function));
23457
- this->name = function.name;
23458
- }
23459
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23460
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23461
- this->name = name;
23462
- for (auto &function : functions) {
23463
- function.name = name;
23464
- }
23514
+ struct CreateSchemaInfo : public CreateInfo {
23515
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23465
23516
  }
23466
23517
 
23467
- vector<PragmaFunction> functions;
23468
-
23469
23518
  public:
23470
23519
  unique_ptr<CreateInfo> Copy() const override {
23471
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23520
+ auto result = make_unique<CreateSchemaInfo>();
23472
23521
  CopyProperties(*result);
23473
23522
  return move(result);
23474
23523
  }
@@ -23478,7 +23527,7 @@ public:
23478
23527
  //===----------------------------------------------------------------------===//
23479
23528
  // DuckDB
23480
23529
  //
23481
- // duckdb/parser/parsed_data/transaction_info.hpp
23530
+ // duckdb/parser/parsed_data/create_index_info.hpp
23482
23531
  //
23483
23532
  //
23484
23533
  //===----------------------------------------------------------------------===//
@@ -23487,23 +23536,11 @@ public:
23487
23536
 
23488
23537
 
23489
23538
 
23490
- namespace duckdb {
23491
-
23492
- enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
23493
-
23494
- struct TransactionInfo : public ParseInfo {
23495
- explicit TransactionInfo(TransactionType type) : type(type) {
23496
- }
23497
23539
 
23498
- //! The type of transaction statement
23499
- TransactionType type;
23500
- };
23501
-
23502
- } // namespace duckdb
23503
23540
  //===----------------------------------------------------------------------===//
23504
23541
  // DuckDB
23505
23542
  //
23506
- // duckdb/parser/parsed_data/drop_info.hpp
23543
+ // duckdb/parser/tableref/basetableref.hpp
23507
23544
  //
23508
23545
  //
23509
23546
  //===----------------------------------------------------------------------===//
@@ -23514,32 +23551,63 @@ struct TransactionInfo : public ParseInfo {
23514
23551
 
23515
23552
 
23516
23553
  namespace duckdb {
23517
-
23518
- struct DropInfo : public ParseInfo {
23519
- DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23554
+ //! Represents a TableReference to a base table in the schema
23555
+ class BaseTableRef : public TableRef {
23556
+ public:
23557
+ BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
23520
23558
  }
23521
23559
 
23522
- //! The catalog type to drop
23523
- CatalogType type;
23524
- //! Schema name to drop from, if any
23525
- string schema;
23526
- //! Element name to drop
23527
- string name;
23528
- //! Ignore if the entry does not exist instead of failing
23529
- bool if_exists = false;
23530
- //! Cascade drop (drop all dependents instead of throwing an error if there
23531
- //! are any)
23532
- bool cascade = false;
23560
+ //! Schema name
23561
+ string schema_name;
23562
+ //! Table name
23563
+ string table_name;
23564
+ //! Aliases for the column names
23565
+ vector<string> column_name_alias;
23533
23566
 
23534
23567
  public:
23535
- unique_ptr<DropInfo> Copy() const {
23536
- auto result = make_unique<DropInfo>();
23537
- result->type = type;
23538
- result->schema = schema;
23539
- result->name = name;
23540
- result->if_exists = if_exists;
23541
- result->cascade = cascade;
23542
- return result;
23568
+ string ToString() const override;
23569
+ bool Equals(const TableRef *other_p) const override;
23570
+
23571
+ unique_ptr<TableRef> Copy() override;
23572
+
23573
+ //! Serializes a blob into a BaseTableRef
23574
+ void Serialize(FieldWriter &serializer) const override;
23575
+ //! Deserializes a blob back into a BaseTableRef
23576
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
23577
+ };
23578
+ } // namespace duckdb
23579
+
23580
+
23581
+
23582
+ namespace duckdb {
23583
+
23584
+ struct CreateIndexInfo : public CreateInfo {
23585
+ CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
23586
+ }
23587
+
23588
+ //! Index Type (e.g., B+-tree, Skip-List, ...)
23589
+ IndexType index_type;
23590
+ //! Name of the Index
23591
+ string index_name;
23592
+ //! If it is an unique index
23593
+ bool unique = false;
23594
+ //! The table to create the index on
23595
+ unique_ptr<BaseTableRef> table;
23596
+ //! Set of expressions to index by
23597
+ vector<unique_ptr<ParsedExpression>> expressions;
23598
+
23599
+ public:
23600
+ unique_ptr<CreateInfo> Copy() const override {
23601
+ auto result = make_unique<CreateIndexInfo>();
23602
+ CopyProperties(*result);
23603
+ result->index_type = index_type;
23604
+ result->index_name = index_name;
23605
+ result->unique = unique;
23606
+ result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
23607
+ for (auto &expr : expressions) {
23608
+ result->expressions.push_back(expr->Copy());
23609
+ }
23610
+ return move(result);
23543
23611
  }
23544
23612
  };
23545
23613
 
@@ -23547,7 +23615,7 @@ public:
23547
23615
  //===----------------------------------------------------------------------===//
23548
23616
  // DuckDB
23549
23617
  //
23550
- // duckdb/parser/parsed_data/create_schema_info.hpp
23618
+ // duckdb/parser/parsed_data/export_table_data.hpp
23551
23619
  //
23552
23620
  //
23553
23621
  //===----------------------------------------------------------------------===//
@@ -23556,18 +23624,27 @@ public:
23556
23624
 
23557
23625
 
23558
23626
 
23627
+
23559
23628
  namespace duckdb {
23560
23629
 
23561
- struct CreateSchemaInfo : public CreateInfo {
23562
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23563
- }
23630
+ struct ExportedTableData {
23631
+ //! Name of the exported table
23632
+ string table_name;
23564
23633
 
23565
- public:
23566
- unique_ptr<CreateInfo> Copy() const override {
23567
- auto result = make_unique<CreateSchemaInfo>();
23568
- CopyProperties(*result);
23569
- return move(result);
23570
- }
23634
+ //! Name of the schema
23635
+ string schema_name;
23636
+
23637
+ //! Path to be exported
23638
+ string file_path;
23639
+ };
23640
+
23641
+ struct ExportedTableInfo {
23642
+ TableCatalogEntry *entry;
23643
+ ExportedTableData table_data;
23644
+ };
23645
+
23646
+ struct BoundExportData : public ParseInfo {
23647
+ std::vector<ExportedTableInfo> data;
23571
23648
  };
23572
23649
 
23573
23650
  } // namespace duckdb
@@ -23658,37 +23735,7 @@ public:
23658
23735
  //===----------------------------------------------------------------------===//
23659
23736
  // DuckDB
23660
23737
  //
23661
- // duckdb/parser/parsed_data/vacuum_info.hpp
23662
- //
23663
- //
23664
- //===----------------------------------------------------------------------===//
23665
-
23666
-
23667
-
23668
-
23669
-
23670
- namespace duckdb {
23671
-
23672
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23673
-
23674
- struct LoadInfo : public ParseInfo {
23675
- std::string filename;
23676
- LoadType load_type;
23677
-
23678
- public:
23679
- unique_ptr<LoadInfo> Copy() const {
23680
- auto result = make_unique<LoadInfo>();
23681
- result->filename = filename;
23682
- result->load_type = load_type;
23683
- return result;
23684
- }
23685
- };
23686
-
23687
- } // namespace duckdb
23688
- //===----------------------------------------------------------------------===//
23689
- // DuckDB
23690
- //
23691
- // duckdb/parser/parsed_data/create_type_info.hpp
23738
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23692
23739
  //
23693
23740
  //
23694
23741
  //===----------------------------------------------------------------------===//
@@ -23698,26 +23745,28 @@ public:
23698
23745
 
23699
23746
 
23700
23747
 
23701
-
23702
-
23703
23748
  namespace duckdb {
23704
23749
 
23705
- struct CreateTypeInfo : public CreateInfo {
23706
-
23707
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23750
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23751
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
23752
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23753
+ functions.push_back(move(function));
23754
+ this->name = function.name;
23755
+ }
23756
+ CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23757
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23758
+ this->name = name;
23759
+ for (auto &function : functions) {
23760
+ function.name = name;
23761
+ }
23708
23762
  }
23709
23763
 
23710
- //! Name of the Type
23711
- string name;
23712
- //! Logical Type
23713
- LogicalType type;
23764
+ vector<PragmaFunction> functions;
23714
23765
 
23715
23766
  public:
23716
23767
  unique_ptr<CreateInfo> Copy() const override {
23717
- auto result = make_unique<CreateTypeInfo>();
23768
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23718
23769
  CopyProperties(*result);
23719
- result->name = name;
23720
- result->type = type;
23721
23770
  return move(result);
23722
23771
  }
23723
23772
  };
@@ -23784,42 +23833,6 @@ struct VacuumInfo : public ParseInfo {
23784
23833
  // nothing for now
23785
23834
  };
23786
23835
 
23787
- } // namespace duckdb
23788
- //===----------------------------------------------------------------------===//
23789
- // DuckDB
23790
- //
23791
- // duckdb/parser/parsed_data/show_select_info.hpp
23792
- //
23793
- //
23794
- //===----------------------------------------------------------------------===//
23795
-
23796
-
23797
-
23798
-
23799
-
23800
-
23801
- namespace duckdb {
23802
-
23803
- struct ShowSelectInfo : public ParseInfo {
23804
- //! Types of projected columns
23805
- vector<LogicalType> types;
23806
- //! The QueryNode of select query
23807
- unique_ptr<QueryNode> query;
23808
- //! Aliases of projected columns
23809
- vector<string> aliases;
23810
- //! Whether or not we are requesting a summary or a describe
23811
- bool is_summary;
23812
-
23813
- unique_ptr<ShowSelectInfo> Copy() {
23814
- auto result = make_unique<ShowSelectInfo>();
23815
- result->types = types;
23816
- result->query = query->Copy();
23817
- result->aliases = aliases;
23818
- result->is_summary = is_summary;
23819
- return result;
23820
- }
23821
- };
23822
-
23823
23836
  } // namespace duckdb
23824
23837
  //===----------------------------------------------------------------------===//
23825
23838
  // DuckDB
@@ -23855,7 +23868,7 @@ public:
23855
23868
  //===----------------------------------------------------------------------===//
23856
23869
  // DuckDB
23857
23870
  //
23858
- // duckdb/parser/tableref/crossproductref.hpp
23871
+ // duckdb/parser/tableref/table_function_ref.hpp
23859
23872
  //
23860
23873
  //
23861
23874
  //===----------------------------------------------------------------------===//
@@ -23864,33 +23877,34 @@ public:
23864
23877
 
23865
23878
 
23866
23879
 
23880
+
23881
+
23882
+
23867
23883
  namespace duckdb {
23868
- //! Represents a cross product
23869
- class CrossProductRef : public TableRef {
23884
+ //! Represents a Table producing function
23885
+ class TableFunctionRef : public TableRef {
23870
23886
  public:
23871
- CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
23872
- }
23887
+ DUCKDB_API TableFunctionRef();
23873
23888
 
23874
- //! The left hand side of the cross product
23875
- unique_ptr<TableRef> left;
23876
- //! The right hand side of the cross product
23877
- unique_ptr<TableRef> right;
23889
+ unique_ptr<ParsedExpression> function;
23890
+ vector<string> column_name_alias;
23891
+
23892
+ // if the function takes a subquery as argument its in here
23893
+ unique_ptr<SelectStatement> subquery;
23878
23894
 
23879
23895
  public:
23880
23896
  string ToString() const override;
23897
+
23881
23898
  bool Equals(const TableRef *other_p) const override;
23882
23899
 
23883
23900
  unique_ptr<TableRef> Copy() override;
23884
23901
 
23885
- //! Serializes a blob into a CrossProductRef
23902
+ //! Serializes a blob into a BaseTableRef
23886
23903
  void Serialize(FieldWriter &serializer) const override;
23887
- //! Deserializes a blob back into a CrossProductRef
23904
+ //! Deserializes a blob back into a BaseTableRef
23888
23905
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23889
23906
  };
23890
23907
  } // namespace duckdb
23891
-
23892
-
23893
-
23894
23908
  //===----------------------------------------------------------------------===//
23895
23909
  // DuckDB
23896
23910
  //
@@ -23932,11 +23946,10 @@ public:
23932
23946
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23933
23947
  };
23934
23948
  } // namespace duckdb
23935
-
23936
23949
  //===----------------------------------------------------------------------===//
23937
23950
  // DuckDB
23938
23951
  //
23939
- // duckdb/parser/tableref/joinref.hpp
23952
+ // duckdb/parser/tableref/subqueryref.hpp
23940
23953
  //
23941
23954
  //
23942
23955
  //===----------------------------------------------------------------------===//
@@ -23946,28 +23959,16 @@ public:
23946
23959
 
23947
23960
 
23948
23961
 
23949
-
23950
-
23951
-
23952
23962
  namespace duckdb {
23953
- //! Represents a JOIN between two expressions
23954
- class JoinRef : public TableRef {
23963
+ //! Represents a subquery
23964
+ class SubqueryRef : public TableRef {
23955
23965
  public:
23956
- JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
23957
- }
23966
+ explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
23958
23967
 
23959
- //! The left hand side of the join
23960
- unique_ptr<TableRef> left;
23961
- //! The right hand side of the join
23962
- unique_ptr<TableRef> right;
23963
- //! The join condition
23964
- unique_ptr<ParsedExpression> condition;
23965
- //! The join type
23966
- JoinType type;
23967
- //! Natural join
23968
- bool is_natural;
23969
- //! The set of USING columns (if any)
23970
- vector<string> using_columns;
23968
+ //! The subquery
23969
+ unique_ptr<SelectStatement> subquery;
23970
+ //! Aliases for the column names
23971
+ vector<string> column_name_alias;
23971
23972
 
23972
23973
  public:
23973
23974
  string ToString() const override;
@@ -23975,9 +23976,9 @@ public:
23975
23976
 
23976
23977
  unique_ptr<TableRef> Copy() override;
23977
23978
 
23978
- //! Serializes a blob into a JoinRef
23979
+ //! Serializes a blob into a SubqueryRef
23979
23980
  void Serialize(FieldWriter &serializer) const override;
23980
- //! Deserializes a blob back into a JoinRef
23981
+ //! Deserializes a blob back into a SubqueryRef
23981
23982
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23982
23983
  };
23983
23984
  } // namespace duckdb
@@ -23985,7 +23986,7 @@ public:
23985
23986
  //===----------------------------------------------------------------------===//
23986
23987
  // DuckDB
23987
23988
  //
23988
- // duckdb/parser/tableref/subqueryref.hpp
23989
+ // duckdb/parser/tableref/crossproductref.hpp
23989
23990
  //
23990
23991
  //
23991
23992
  //===----------------------------------------------------------------------===//
@@ -23994,17 +23995,17 @@ public:
23994
23995
 
23995
23996
 
23996
23997
 
23997
-
23998
23998
  namespace duckdb {
23999
- //! Represents a subquery
24000
- class SubqueryRef : public TableRef {
23999
+ //! Represents a cross product
24000
+ class CrossProductRef : public TableRef {
24001
24001
  public:
24002
- explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
24002
+ CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
24003
+ }
24003
24004
 
24004
- //! The subquery
24005
- unique_ptr<SelectStatement> subquery;
24006
- //! Aliases for the column names
24007
- vector<string> column_name_alias;
24005
+ //! The left hand side of the cross product
24006
+ unique_ptr<TableRef> left;
24007
+ //! The right hand side of the cross product
24008
+ unique_ptr<TableRef> right;
24008
24009
 
24009
24010
  public:
24010
24011
  string ToString() const override;
@@ -24012,17 +24013,19 @@ public:
24012
24013
 
24013
24014
  unique_ptr<TableRef> Copy() override;
24014
24015
 
24015
- //! Serializes a blob into a SubqueryRef
24016
+ //! Serializes a blob into a CrossProductRef
24016
24017
  void Serialize(FieldWriter &serializer) const override;
24017
- //! Deserializes a blob back into a SubqueryRef
24018
+ //! Deserializes a blob back into a CrossProductRef
24018
24019
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24019
24020
  };
24020
24021
  } // namespace duckdb
24021
24022
 
24023
+
24024
+
24022
24025
  //===----------------------------------------------------------------------===//
24023
24026
  // DuckDB
24024
24027
  //
24025
- // duckdb/parser/tableref/table_function_ref.hpp
24028
+ // duckdb/parser/tableref/joinref.hpp
24026
24029
  //
24027
24030
  //
24028
24031
  //===----------------------------------------------------------------------===//
@@ -24034,29 +24037,39 @@ public:
24034
24037
 
24035
24038
 
24036
24039
 
24040
+
24037
24041
  namespace duckdb {
24038
- //! Represents a Table producing function
24039
- class TableFunctionRef : public TableRef {
24042
+ //! Represents a JOIN between two expressions
24043
+ class JoinRef : public TableRef {
24040
24044
  public:
24041
- DUCKDB_API TableFunctionRef();
24042
-
24043
- unique_ptr<ParsedExpression> function;
24044
- vector<string> column_name_alias;
24045
+ JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
24046
+ }
24045
24047
 
24046
- // if the function takes a subquery as argument its in here
24047
- unique_ptr<SelectStatement> subquery;
24048
+ //! The left hand side of the join
24049
+ unique_ptr<TableRef> left;
24050
+ //! The right hand side of the join
24051
+ unique_ptr<TableRef> right;
24052
+ //! The join condition
24053
+ unique_ptr<ParsedExpression> condition;
24054
+ //! The join type
24055
+ JoinType type;
24056
+ //! Natural join
24057
+ bool is_natural;
24058
+ //! The set of USING columns (if any)
24059
+ vector<string> using_columns;
24048
24060
 
24049
24061
  public:
24050
24062
  string ToString() const override;
24051
-
24052
24063
  bool Equals(const TableRef *other_p) const override;
24053
24064
 
24054
24065
  unique_ptr<TableRef> Copy() override;
24055
24066
 
24056
- //! Serializes a blob into a BaseTableRef
24067
+ //! Serializes a blob into a JoinRef
24057
24068
  void Serialize(FieldWriter &serializer) const override;
24058
- //! Deserializes a blob back into a BaseTableRef
24069
+ //! Deserializes a blob back into a JoinRef
24059
24070
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
24060
24071
  };
24061
24072
  } // namespace duckdb
24062
24073
 
24074
+
24075
+