duckdb 0.3.5-dev164.0 → 0.3.5-dev167.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 "e4ba94a4f"
15
- #define DUCKDB_VERSION "v0.3.5-dev164"
14
+ #define DUCKDB_SOURCE_ID "0a6b26232"
15
+ #define DUCKDB_VERSION "v0.3.5-dev167"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -22484,7 +22484,7 @@ public:
22484
22484
  //===----------------------------------------------------------------------===//
22485
22485
  // DuckDB
22486
22486
  //
22487
- // duckdb/parser/expression/collate_expression.hpp
22487
+ // duckdb/parser/expression/star_expression.hpp
22488
22488
  //
22489
22489
  //
22490
22490
  //===----------------------------------------------------------------------===//
@@ -22493,22 +22493,25 @@ public:
22493
22493
 
22494
22494
 
22495
22495
 
22496
+
22496
22497
  namespace duckdb {
22497
22498
 
22498
- //! CollateExpression represents a COLLATE statement
22499
- class CollateExpression : public ParsedExpression {
22499
+ //! Represents a * expression in the SELECT clause
22500
+ class StarExpression : public ParsedExpression {
22500
22501
  public:
22501
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
22502
+ StarExpression(string relation_name = string());
22502
22503
 
22503
- //! The child of the cast expression
22504
- unique_ptr<ParsedExpression> child;
22505
- //! The collation clause
22506
- string collation;
22504
+ //! The relation name in case of tbl.*, or empty if this is a normal *
22505
+ string relation_name;
22506
+ //! List of columns to exclude from the STAR expression
22507
+ case_insensitive_set_t exclude_list;
22508
+ //! List of columns to replace with another expression
22509
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
22507
22510
 
22508
22511
  public:
22509
22512
  string ToString() const override;
22510
22513
 
22511
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
22514
+ static bool Equals(const StarExpression *a, const StarExpression *b);
22512
22515
 
22513
22516
  unique_ptr<ParsedExpression> Copy() const override;
22514
22517
 
@@ -22519,7 +22522,7 @@ public:
22519
22522
  //===----------------------------------------------------------------------===//
22520
22523
  // DuckDB
22521
22524
  //
22522
- // duckdb/parser/expression/between_expression.hpp
22525
+ // duckdb/parser/expression/default_expression.hpp
22523
22526
  //
22524
22527
  //
22525
22528
  //===----------------------------------------------------------------------===//
@@ -22529,20 +22532,53 @@ public:
22529
22532
 
22530
22533
 
22531
22534
  namespace duckdb {
22535
+ //! Represents the default value of a column
22536
+ class DefaultExpression : public ParsedExpression {
22537
+ public:
22538
+ DefaultExpression();
22532
22539
 
22533
- class BetweenExpression : public ParsedExpression {
22534
22540
  public:
22535
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22536
- unique_ptr<ParsedExpression> upper);
22541
+ bool IsScalar() const override {
22542
+ return false;
22543
+ }
22537
22544
 
22538
- unique_ptr<ParsedExpression> input;
22539
- unique_ptr<ParsedExpression> lower;
22540
- unique_ptr<ParsedExpression> upper;
22545
+ string ToString() const override;
22546
+
22547
+ unique_ptr<ParsedExpression> Copy() const override;
22548
+
22549
+ void Serialize(FieldWriter &writer) const override;
22550
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22551
+ };
22552
+ } // namespace duckdb
22553
+ //===----------------------------------------------------------------------===//
22554
+ // DuckDB
22555
+ //
22556
+ // duckdb/parser/expression/operator_expression.hpp
22557
+ //
22558
+ //
22559
+ //===----------------------------------------------------------------------===//
22560
+
22561
+
22562
+
22563
+
22564
+
22565
+
22566
+
22567
+
22568
+ namespace duckdb {
22569
+ //! Represents a built-in operator expression
22570
+ class OperatorExpression : public ParsedExpression {
22571
+ public:
22572
+ DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
22573
+ unique_ptr<ParsedExpression> right = nullptr);
22574
+ DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22575
+
22576
+ vector<unique_ptr<ParsedExpression>> children;
22541
22577
 
22542
22578
  public:
22543
22579
  string ToString() const override;
22544
22580
 
22545
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22581
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
22546
22582
 
22547
22583
  unique_ptr<ParsedExpression> Copy() const override;
22548
22584
 
@@ -22552,16 +22588,72 @@ public:
22552
22588
  public:
22553
22589
  template <class T, class BASE>
22554
22590
  static string ToString(const T &entry) {
22555
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22591
+ auto op = ExpressionTypeToOperator(entry.type);
22592
+ if (!op.empty()) {
22593
+ // use the operator string to represent the operator
22594
+ D_ASSERT(entry.children.size() == 2);
22595
+ return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
22596
+ }
22597
+ switch (entry.type) {
22598
+ case ExpressionType::COMPARE_IN:
22599
+ case ExpressionType::COMPARE_NOT_IN: {
22600
+ string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
22601
+ string in_child = entry.children[0]->ToString();
22602
+ string child_list = "(";
22603
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22604
+ if (i > 1) {
22605
+ child_list += ", ";
22606
+ }
22607
+ child_list += entry.children[i]->ToString();
22608
+ }
22609
+ child_list += ")";
22610
+ return "(" + in_child + op_type + child_list + ")";
22611
+ }
22612
+ case ExpressionType::OPERATOR_NOT:
22613
+ case ExpressionType::GROUPING_FUNCTION:
22614
+ case ExpressionType::OPERATOR_COALESCE: {
22615
+ string result = ExpressionTypeToString(entry.type);
22616
+ result += "(";
22617
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22618
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
22619
+ result += ")";
22620
+ return result;
22621
+ }
22622
+ case ExpressionType::OPERATOR_IS_NULL:
22623
+ return "(" + entry.children[0]->ToString() + " IS NULL)";
22624
+ case ExpressionType::OPERATOR_IS_NOT_NULL:
22625
+ return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
22626
+ case ExpressionType::ARRAY_EXTRACT:
22627
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
22628
+ case ExpressionType::ARRAY_SLICE:
22629
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
22630
+ entry.children[2]->ToString() + "]";
22631
+ case ExpressionType::STRUCT_EXTRACT: {
22632
+ D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
22633
+ auto child_string = entry.children[1]->ToString();
22634
+ D_ASSERT(child_string.size() >= 3);
22635
+ D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
22636
+ return "(" + entry.children[0]->ToString() + ")." +
22637
+ KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
22638
+ }
22639
+ case ExpressionType::ARRAY_CONSTRUCTOR: {
22640
+ string result = "(ARRAY[";
22641
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22642
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
22643
+ result += "])";
22644
+ return result;
22645
+ }
22646
+ default:
22647
+ throw InternalException("Unrecognized operator type");
22648
+ }
22556
22649
  }
22557
22650
  };
22558
- } // namespace duckdb
22559
-
22560
22651
 
22652
+ } // namespace duckdb
22561
22653
  //===----------------------------------------------------------------------===//
22562
22654
  // DuckDB
22563
22655
  //
22564
- // duckdb/parser/expression/case_expression.hpp
22656
+ // duckdb/parser/expression/conjunction_expression.hpp
22565
22657
  //
22566
22658
  //
22567
22659
  //===----------------------------------------------------------------------===//
@@ -22573,23 +22665,22 @@ public:
22573
22665
 
22574
22666
  namespace duckdb {
22575
22667
 
22576
- struct CaseCheck {
22577
- unique_ptr<ParsedExpression> when_expr;
22578
- unique_ptr<ParsedExpression> then_expr;
22579
- };
22580
-
22581
- //! The CaseExpression represents a CASE expression in the query
22582
- class CaseExpression : public ParsedExpression {
22668
+ //! Represents a conjunction (AND/OR)
22669
+ class ConjunctionExpression : public ParsedExpression {
22583
22670
  public:
22584
- DUCKDB_API CaseExpression();
22671
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22672
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22673
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22674
+ unique_ptr<ParsedExpression> right);
22585
22675
 
22586
- vector<CaseCheck> case_checks;
22587
- unique_ptr<ParsedExpression> else_expr;
22676
+ vector<unique_ptr<ParsedExpression>> children;
22588
22677
 
22589
22678
  public:
22679
+ void AddExpression(unique_ptr<ParsedExpression> expr);
22680
+
22590
22681
  string ToString() const override;
22591
22682
 
22592
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
22683
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22593
22684
 
22594
22685
  unique_ptr<ParsedExpression> Copy() const override;
22595
22686
 
@@ -22599,22 +22690,54 @@ public:
22599
22690
  public:
22600
22691
  template <class T, class BASE>
22601
22692
  static string ToString(const T &entry) {
22602
- string case_str = "CASE ";
22603
- for (auto &check : entry.case_checks) {
22604
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
22605
- case_str += " THEN (" + check.then_expr->ToString() + ")";
22693
+ string result = "(" + entry.children[0]->ToString();
22694
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22695
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22606
22696
  }
22607
- case_str += " ELSE " + entry.else_expr->ToString();
22608
- case_str += " END";
22609
- return case_str;
22697
+ return result + ")";
22610
22698
  }
22611
22699
  };
22612
22700
  } // namespace duckdb
22701
+ //===----------------------------------------------------------------------===//
22702
+ // DuckDB
22703
+ //
22704
+ // duckdb/parser/expression/constant_expression.hpp
22705
+ //
22706
+ //
22707
+ //===----------------------------------------------------------------------===//
22708
+
22709
+
22710
+
22711
+
22712
+
22713
+
22714
+ namespace duckdb {
22613
22715
 
22716
+ //! ConstantExpression represents a constant value in the query
22717
+ class ConstantExpression : public ParsedExpression {
22718
+ public:
22719
+ DUCKDB_API explicit ConstantExpression(Value val);
22720
+
22721
+ //! The constant value referenced
22722
+ Value value;
22723
+
22724
+ public:
22725
+ string ToString() const override;
22726
+
22727
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22728
+ hash_t Hash() const override;
22729
+
22730
+ unique_ptr<ParsedExpression> Copy() const override;
22731
+
22732
+ void Serialize(FieldWriter &writer) const override;
22733
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22734
+ };
22735
+
22736
+ } // namespace duckdb
22614
22737
  //===----------------------------------------------------------------------===//
22615
22738
  // DuckDB
22616
22739
  //
22617
- // duckdb/parser/expression/cast_expression.hpp
22740
+ // duckdb/parser/expression/case_expression.hpp
22618
22741
  //
22619
22742
  //
22620
22743
  //===----------------------------------------------------------------------===//
@@ -22626,22 +22749,23 @@ public:
22626
22749
 
22627
22750
  namespace duckdb {
22628
22751
 
22629
- //! CastExpression represents a type cast from one SQL type to another SQL type
22630
- class CastExpression : public ParsedExpression {
22752
+ struct CaseCheck {
22753
+ unique_ptr<ParsedExpression> when_expr;
22754
+ unique_ptr<ParsedExpression> then_expr;
22755
+ };
22756
+
22757
+ //! The CaseExpression represents a CASE expression in the query
22758
+ class CaseExpression : public ParsedExpression {
22631
22759
  public:
22632
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22760
+ DUCKDB_API CaseExpression();
22633
22761
 
22634
- //! The child of the cast expression
22635
- unique_ptr<ParsedExpression> child;
22636
- //! The type to cast to
22637
- LogicalType cast_type;
22638
- //! Whether or not this is a try_cast expression
22639
- bool try_cast;
22762
+ vector<CaseCheck> case_checks;
22763
+ unique_ptr<ParsedExpression> else_expr;
22640
22764
 
22641
22765
  public:
22642
22766
  string ToString() const override;
22643
22767
 
22644
- static bool Equals(const CastExpression *a, const CastExpression *b);
22768
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
22645
22769
 
22646
22770
  unique_ptr<ParsedExpression> Copy() const override;
22647
22771
 
@@ -22651,18 +22775,21 @@ public:
22651
22775
  public:
22652
22776
  template <class T, class BASE>
22653
22777
  static string ToString(const T &entry) {
22654
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22655
- entry.cast_type.ToString() + ")";
22778
+ string case_str = "CASE ";
22779
+ for (auto &check : entry.case_checks) {
22780
+ case_str += " WHEN (" + check.when_expr->ToString() + ")";
22781
+ case_str += " THEN (" + check.then_expr->ToString() + ")";
22782
+ }
22783
+ case_str += " ELSE " + entry.else_expr->ToString();
22784
+ case_str += " END";
22785
+ return case_str;
22656
22786
  }
22657
22787
  };
22658
22788
  } // namespace duckdb
22659
-
22660
-
22661
-
22662
22789
  //===----------------------------------------------------------------------===//
22663
22790
  // DuckDB
22664
22791
  //
22665
- // duckdb/parser/expression/comparison_expression.hpp
22792
+ // duckdb/parser/expression/between_expression.hpp
22666
22793
  //
22667
22794
  //
22668
22795
  //===----------------------------------------------------------------------===//
@@ -22672,20 +22799,20 @@ public:
22672
22799
 
22673
22800
 
22674
22801
  namespace duckdb {
22675
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22676
- //! and has two children.
22677
- class ComparisonExpression : public ParsedExpression {
22802
+
22803
+ class BetweenExpression : public ParsedExpression {
22678
22804
  public:
22679
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22680
- unique_ptr<ParsedExpression> right);
22805
+ BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22806
+ unique_ptr<ParsedExpression> upper);
22681
22807
 
22682
- unique_ptr<ParsedExpression> left;
22683
- unique_ptr<ParsedExpression> right;
22808
+ unique_ptr<ParsedExpression> input;
22809
+ unique_ptr<ParsedExpression> lower;
22810
+ unique_ptr<ParsedExpression> upper;
22684
22811
 
22685
22812
  public:
22686
22813
  string ToString() const override;
22687
22814
 
22688
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22815
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22689
22816
 
22690
22817
  unique_ptr<ParsedExpression> Copy() const override;
22691
22818
 
@@ -22695,15 +22822,17 @@ public:
22695
22822
  public:
22696
22823
  template <class T, class BASE>
22697
22824
  static string ToString(const T &entry) {
22698
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22825
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22699
22826
  }
22700
22827
  };
22701
22828
  } // namespace duckdb
22702
22829
 
22830
+
22831
+
22703
22832
  //===----------------------------------------------------------------------===//
22704
22833
  // DuckDB
22705
22834
  //
22706
- // duckdb/parser/expression/conjunction_expression.hpp
22835
+ // duckdb/parser/expression/cast_expression.hpp
22707
22836
  //
22708
22837
  //
22709
22838
  //===----------------------------------------------------------------------===//
@@ -22715,22 +22844,22 @@ public:
22715
22844
 
22716
22845
  namespace duckdb {
22717
22846
 
22718
- //! Represents a conjunction (AND/OR)
22719
- class ConjunctionExpression : public ParsedExpression {
22847
+ //! CastExpression represents a type cast from one SQL type to another SQL type
22848
+ class CastExpression : public ParsedExpression {
22720
22849
  public:
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);
22850
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22725
22851
 
22726
- vector<unique_ptr<ParsedExpression>> children;
22852
+ //! The child of the cast expression
22853
+ unique_ptr<ParsedExpression> child;
22854
+ //! The type to cast to
22855
+ LogicalType cast_type;
22856
+ //! Whether or not this is a try_cast expression
22857
+ bool try_cast;
22727
22858
 
22728
22859
  public:
22729
- void AddExpression(unique_ptr<ParsedExpression> expr);
22730
-
22731
22860
  string ToString() const override;
22732
22861
 
22733
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22862
+ static bool Equals(const CastExpression *a, const CastExpression *b);
22734
22863
 
22735
22864
  unique_ptr<ParsedExpression> Copy() const override;
22736
22865
 
@@ -22740,11 +22869,8 @@ public:
22740
22869
  public:
22741
22870
  template <class T, class BASE>
22742
22871
  static string ToString(const T &entry) {
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 + ")";
22872
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22873
+ entry.cast_type.ToString() + ")";
22748
22874
  }
22749
22875
  };
22750
22876
  } // namespace duckdb
@@ -22752,7 +22878,7 @@ public:
22752
22878
  //===----------------------------------------------------------------------===//
22753
22879
  // DuckDB
22754
22880
  //
22755
- // duckdb/parser/expression/constant_expression.hpp
22881
+ // duckdb/parser/expression/collate_expression.hpp
22756
22882
  //
22757
22883
  //
22758
22884
  //===----------------------------------------------------------------------===//
@@ -22761,35 +22887,35 @@ public:
22761
22887
 
22762
22888
 
22763
22889
 
22764
-
22765
22890
  namespace duckdb {
22766
22891
 
22767
- //! ConstantExpression represents a constant value in the query
22768
- class ConstantExpression : public ParsedExpression {
22892
+ //! CollateExpression represents a COLLATE statement
22893
+ class CollateExpression : public ParsedExpression {
22769
22894
  public:
22770
- DUCKDB_API explicit ConstantExpression(Value val);
22895
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
22771
22896
 
22772
- //! The constant value referenced
22773
- Value value;
22897
+ //! The child of the cast expression
22898
+ unique_ptr<ParsedExpression> child;
22899
+ //! The collation clause
22900
+ string collation;
22774
22901
 
22775
22902
  public:
22776
22903
  string ToString() const override;
22777
22904
 
22778
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22779
- hash_t Hash() const override;
22905
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
22780
22906
 
22781
22907
  unique_ptr<ParsedExpression> Copy() const override;
22782
22908
 
22783
22909
  void Serialize(FieldWriter &writer) const override;
22784
22910
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22785
22911
  };
22786
-
22787
22912
  } // namespace duckdb
22788
22913
 
22914
+
22789
22915
  //===----------------------------------------------------------------------===//
22790
22916
  // DuckDB
22791
22917
  //
22792
- // duckdb/parser/expression/default_expression.hpp
22918
+ // duckdb/parser/expression/comparison_expression.hpp
22793
22919
  //
22794
22920
  //
22795
22921
  //===----------------------------------------------------------------------===//
@@ -22799,25 +22925,37 @@ public:
22799
22925
 
22800
22926
 
22801
22927
  namespace duckdb {
22802
- //! Represents the default value of a column
22803
- class DefaultExpression : public ParsedExpression {
22928
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22929
+ //! and has two children.
22930
+ class ComparisonExpression : public ParsedExpression {
22804
22931
  public:
22805
- DefaultExpression();
22932
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22933
+ unique_ptr<ParsedExpression> right);
22806
22934
 
22807
- public:
22808
- bool IsScalar() const override {
22809
- return false;
22810
- }
22935
+ unique_ptr<ParsedExpression> left;
22936
+ unique_ptr<ParsedExpression> right;
22811
22937
 
22938
+ public:
22812
22939
  string ToString() const override;
22813
22940
 
22941
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22942
+
22814
22943
  unique_ptr<ParsedExpression> Copy() const override;
22815
22944
 
22816
22945
  void Serialize(FieldWriter &writer) const override;
22817
22946
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22947
+
22948
+ public:
22949
+ template <class T, class BASE>
22950
+ static string ToString(const T &entry) {
22951
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22952
+ }
22818
22953
  };
22819
22954
  } // namespace duckdb
22820
22955
 
22956
+
22957
+
22958
+
22821
22959
  //===----------------------------------------------------------------------===//
22822
22960
  // DuckDB
22823
22961
  //
@@ -22937,106 +23075,6 @@ public:
22937
23075
  } // namespace duckdb
22938
23076
 
22939
23077
 
22940
- //===----------------------------------------------------------------------===//
22941
- // DuckDB
22942
- //
22943
- // duckdb/parser/expression/operator_expression.hpp
22944
- //
22945
- //
22946
- //===----------------------------------------------------------------------===//
22947
-
22948
-
22949
-
22950
-
22951
-
22952
-
22953
-
22954
-
22955
- namespace duckdb {
22956
- //! Represents a built-in operator expression
22957
- class OperatorExpression : public ParsedExpression {
22958
- public:
22959
- DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
22960
- unique_ptr<ParsedExpression> right = nullptr);
22961
- DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22962
-
22963
- vector<unique_ptr<ParsedExpression>> children;
22964
-
22965
- public:
22966
- string ToString() const override;
22967
-
22968
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
22969
-
22970
- unique_ptr<ParsedExpression> Copy() const override;
22971
-
22972
- void Serialize(FieldWriter &writer) const override;
22973
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22974
-
22975
- public:
22976
- template <class T, class BASE>
22977
- static string ToString(const T &entry) {
22978
- auto op = ExpressionTypeToOperator(entry.type);
22979
- if (!op.empty()) {
22980
- // use the operator string to represent the operator
22981
- D_ASSERT(entry.children.size() == 2);
22982
- return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
22983
- }
22984
- switch (entry.type) {
22985
- case ExpressionType::COMPARE_IN:
22986
- case ExpressionType::COMPARE_NOT_IN: {
22987
- string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
22988
- string in_child = entry.children[0]->ToString();
22989
- string child_list = "(";
22990
- for (idx_t i = 1; i < entry.children.size(); i++) {
22991
- if (i > 1) {
22992
- child_list += ", ";
22993
- }
22994
- child_list += entry.children[i]->ToString();
22995
- }
22996
- child_list += ")";
22997
- return "(" + in_child + op_type + child_list + ")";
22998
- }
22999
- case ExpressionType::OPERATOR_NOT:
23000
- case ExpressionType::GROUPING_FUNCTION:
23001
- case ExpressionType::OPERATOR_COALESCE: {
23002
- string result = ExpressionTypeToString(entry.type);
23003
- result += "(";
23004
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
23005
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
23006
- result += ")";
23007
- return result;
23008
- }
23009
- case ExpressionType::OPERATOR_IS_NULL:
23010
- return "(" + entry.children[0]->ToString() + " IS NULL)";
23011
- case ExpressionType::OPERATOR_IS_NOT_NULL:
23012
- return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
23013
- case ExpressionType::ARRAY_EXTRACT:
23014
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
23015
- case ExpressionType::ARRAY_SLICE:
23016
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
23017
- entry.children[2]->ToString() + "]";
23018
- case ExpressionType::STRUCT_EXTRACT: {
23019
- D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
23020
- auto child_string = entry.children[1]->ToString();
23021
- D_ASSERT(child_string.size() >= 3);
23022
- D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
23023
- return "(" + entry.children[0]->ToString() + ")." +
23024
- KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
23025
- }
23026
- case ExpressionType::ARRAY_CONSTRUCTOR: {
23027
- string result = "(ARRAY[";
23028
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
23029
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
23030
- result += "])";
23031
- return result;
23032
- }
23033
- default:
23034
- throw InternalException("Unrecognized operator type");
23035
- }
23036
- }
23037
- };
23038
-
23039
- } // namespace duckdb
23040
23078
 
23041
23079
  //===----------------------------------------------------------------------===//
23042
23080
  // DuckDB
@@ -23092,63 +23130,25 @@ class PositionalReferenceExpression : public ParsedExpression {
23092
23130
  public:
23093
23131
  DUCKDB_API PositionalReferenceExpression(idx_t index);
23094
23132
 
23095
- idx_t index;
23096
-
23097
- public:
23098
- bool IsScalar() const override {
23099
- return false;
23100
- }
23101
-
23102
- string ToString() const override;
23103
-
23104
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
23105
- unique_ptr<ParsedExpression> Copy() const override;
23106
- hash_t Hash() const override;
23107
-
23108
- void Serialize(FieldWriter &writer) const override;
23109
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23110
- };
23111
- } // namespace duckdb
23112
-
23113
- //===----------------------------------------------------------------------===//
23114
- // DuckDB
23115
- //
23116
- // duckdb/parser/expression/star_expression.hpp
23117
- //
23118
- //
23119
- //===----------------------------------------------------------------------===//
23120
-
23121
-
23122
-
23123
-
23124
-
23125
-
23126
- namespace duckdb {
23127
-
23128
- //! Represents a * expression in the SELECT clause
23129
- class StarExpression : public ParsedExpression {
23130
- public:
23131
- StarExpression(string relation_name = string());
23132
-
23133
- //! The relation name in case of tbl.*, or empty if this is a normal *
23134
- string relation_name;
23135
- //! List of columns to exclude from the STAR expression
23136
- case_insensitive_set_t exclude_list;
23137
- //! List of columns to replace with another expression
23138
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
23133
+ idx_t index;
23139
23134
 
23140
23135
  public:
23141
- string ToString() const override;
23136
+ bool IsScalar() const override {
23137
+ return false;
23138
+ }
23142
23139
 
23143
- static bool Equals(const StarExpression *a, const StarExpression *b);
23140
+ string ToString() const override;
23144
23141
 
23142
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
23145
23143
  unique_ptr<ParsedExpression> Copy() const override;
23144
+ hash_t Hash() const override;
23146
23145
 
23147
23146
  void Serialize(FieldWriter &writer) const override;
23148
23147
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23149
23148
  };
23150
23149
  } // namespace duckdb
23151
23150
 
23151
+
23152
23152
  //===----------------------------------------------------------------------===//
23153
23153
  // DuckDB
23154
23154
  //
@@ -23203,7 +23203,7 @@ public:
23203
23203
  //===----------------------------------------------------------------------===//
23204
23204
  // DuckDB
23205
23205
  //
23206
- // duckdb/parser/parsed_data/create_collation_info.hpp
23206
+ // duckdb/parser/parsed_data/export_table_data.hpp
23207
23207
  //
23208
23208
  //
23209
23209
  //===----------------------------------------------------------------------===//
@@ -23215,112 +23215,24 @@ public:
23215
23215
 
23216
23216
  namespace duckdb {
23217
23217
 
23218
- struct CreateCollationInfo : public CreateInfo {
23219
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23220
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23221
- not_required_for_equality(not_required_for_equality_p) {
23222
- this->name = move(name_p);
23223
- }
23224
-
23225
- //! The name of the collation
23226
- string name;
23227
- //! The collation function to push in case collation is required
23228
- ScalarFunction function;
23229
- //! Whether or not the collation can be combined with other collations.
23230
- bool combinable;
23231
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23232
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23233
- //! speeds up processing.
23234
- bool not_required_for_equality;
23235
-
23236
- public:
23237
- unique_ptr<CreateInfo> Copy() const override {
23238
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23239
- CopyProperties(*result);
23240
- return move(result);
23241
- }
23242
- };
23243
-
23244
- } // namespace duckdb
23245
- //===----------------------------------------------------------------------===//
23246
- // DuckDB
23247
- //
23248
- // duckdb/parser/parsed_data/create_schema_info.hpp
23249
- //
23250
- //
23251
- //===----------------------------------------------------------------------===//
23252
-
23253
-
23254
-
23255
-
23256
-
23257
- namespace duckdb {
23218
+ struct ExportedTableData {
23219
+ //! Name of the exported table
23220
+ string table_name;
23258
23221
 
23259
- struct CreateSchemaInfo : public CreateInfo {
23260
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23261
- }
23222
+ //! Name of the schema
23223
+ string schema_name;
23262
23224
 
23263
- public:
23264
- unique_ptr<CreateInfo> Copy() const override {
23265
- auto result = make_unique<CreateSchemaInfo>();
23266
- CopyProperties(*result);
23267
- return move(result);
23268
- }
23225
+ //! Path to be exported
23226
+ string file_path;
23269
23227
  };
23270
23228
 
23271
- } // namespace duckdb
23272
- //===----------------------------------------------------------------------===//
23273
- // DuckDB
23274
- //
23275
- // duckdb/parser/parsed_data/show_select_info.hpp
23276
- //
23277
- //
23278
- //===----------------------------------------------------------------------===//
23279
-
23280
-
23281
-
23282
-
23283
-
23284
-
23285
- namespace duckdb {
23286
-
23287
- struct ShowSelectInfo : public ParseInfo {
23288
- //! Types of projected columns
23289
- vector<LogicalType> types;
23290
- //! The QueryNode of select query
23291
- unique_ptr<QueryNode> query;
23292
- //! Aliases of projected columns
23293
- vector<string> aliases;
23294
- //! Whether or not we are requesting a summary or a describe
23295
- bool is_summary;
23296
-
23297
- unique_ptr<ShowSelectInfo> Copy() {
23298
- auto result = make_unique<ShowSelectInfo>();
23299
- result->types = types;
23300
- result->query = query->Copy();
23301
- result->aliases = aliases;
23302
- result->is_summary = is_summary;
23303
- return result;
23304
- }
23229
+ struct ExportedTableInfo {
23230
+ TableCatalogEntry *entry;
23231
+ ExportedTableData table_data;
23305
23232
  };
23306
23233
 
23307
- } // namespace duckdb
23308
- //===----------------------------------------------------------------------===//
23309
- // DuckDB
23310
- //
23311
- // duckdb/parser/parsed_data/vacuum_info.hpp
23312
- //
23313
- //
23314
- //===----------------------------------------------------------------------===//
23315
-
23316
-
23317
-
23318
-
23319
-
23320
- namespace duckdb {
23321
-
23322
- struct VacuumInfo : public ParseInfo {
23323
- // nothing for now
23234
+ struct BoundExportData : public ParseInfo {
23235
+ std::vector<ExportedTableInfo> data;
23324
23236
  };
23325
23237
 
23326
23238
  } // namespace duckdb
@@ -23411,6 +23323,129 @@ public:
23411
23323
  }
23412
23324
  };
23413
23325
 
23326
+ } // namespace duckdb
23327
+ //===----------------------------------------------------------------------===//
23328
+ // DuckDB
23329
+ //
23330
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23331
+ //
23332
+ //
23333
+ //===----------------------------------------------------------------------===//
23334
+
23335
+
23336
+
23337
+
23338
+
23339
+
23340
+ namespace duckdb {
23341
+
23342
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23343
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
23344
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23345
+ this->name = function.name;
23346
+ functions.AddFunction(move(function));
23347
+ }
23348
+
23349
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23350
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23351
+ this->name = functions.name;
23352
+ for (auto &func : functions.functions) {
23353
+ func.name = functions.name;
23354
+ }
23355
+ }
23356
+
23357
+ AggregateFunctionSet functions;
23358
+
23359
+ public:
23360
+ unique_ptr<CreateInfo> Copy() const override {
23361
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23362
+ CopyProperties(*result);
23363
+ return move(result);
23364
+ }
23365
+ };
23366
+
23367
+ } // namespace duckdb
23368
+ //===----------------------------------------------------------------------===//
23369
+ // DuckDB
23370
+ //
23371
+ // duckdb/parser/parsed_data/create_collation_info.hpp
23372
+ //
23373
+ //
23374
+ //===----------------------------------------------------------------------===//
23375
+
23376
+
23377
+
23378
+
23379
+
23380
+
23381
+ namespace duckdb {
23382
+
23383
+ struct CreateCollationInfo : public CreateInfo {
23384
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23385
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23386
+ not_required_for_equality(not_required_for_equality_p) {
23387
+ this->name = move(name_p);
23388
+ }
23389
+
23390
+ //! The name of the collation
23391
+ string name;
23392
+ //! The collation function to push in case collation is required
23393
+ ScalarFunction function;
23394
+ //! Whether or not the collation can be combined with other collations.
23395
+ bool combinable;
23396
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23397
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23398
+ //! speeds up processing.
23399
+ bool not_required_for_equality;
23400
+
23401
+ public:
23402
+ unique_ptr<CreateInfo> Copy() const override {
23403
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23404
+ CopyProperties(*result);
23405
+ return move(result);
23406
+ }
23407
+ };
23408
+
23409
+ } // namespace duckdb
23410
+ //===----------------------------------------------------------------------===//
23411
+ // DuckDB
23412
+ //
23413
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23414
+ //
23415
+ //
23416
+ //===----------------------------------------------------------------------===//
23417
+
23418
+
23419
+
23420
+
23421
+
23422
+
23423
+ namespace duckdb {
23424
+
23425
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23426
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
23427
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23428
+ functions.push_back(move(function));
23429
+ this->name = function.name;
23430
+ }
23431
+ CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23432
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23433
+ this->name = name;
23434
+ for (auto &function : functions) {
23435
+ function.name = name;
23436
+ }
23437
+ }
23438
+
23439
+ vector<PragmaFunction> functions;
23440
+
23441
+ public:
23442
+ unique_ptr<CreateInfo> Copy() const override {
23443
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23444
+ CopyProperties(*result);
23445
+ return move(result);
23446
+ }
23447
+ };
23448
+
23414
23449
  } // namespace duckdb
23415
23450
  //===----------------------------------------------------------------------===//
23416
23451
  // DuckDB
@@ -23440,7 +23475,7 @@ struct TransactionInfo : public ParseInfo {
23440
23475
  //===----------------------------------------------------------------------===//
23441
23476
  // DuckDB
23442
23477
  //
23443
- // duckdb/parser/parsed_data/create_type_info.hpp
23478
+ // duckdb/parser/parsed_data/drop_info.hpp
23444
23479
  //
23445
23480
  //
23446
23481
  //===----------------------------------------------------------------------===//
@@ -23450,27 +23485,33 @@ struct TransactionInfo : public ParseInfo {
23450
23485
 
23451
23486
 
23452
23487
 
23453
-
23454
-
23455
23488
  namespace duckdb {
23456
23489
 
23457
- struct CreateTypeInfo : public CreateInfo {
23458
-
23459
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23490
+ struct DropInfo : public ParseInfo {
23491
+ DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23460
23492
  }
23461
23493
 
23462
- //! Name of the Type
23494
+ //! The catalog type to drop
23495
+ CatalogType type;
23496
+ //! Schema name to drop from, if any
23497
+ string schema;
23498
+ //! Element name to drop
23463
23499
  string name;
23464
- //! Logical Type
23465
- LogicalType type;
23500
+ //! Ignore if the entry does not exist instead of failing
23501
+ bool if_exists = false;
23502
+ //! Cascade drop (drop all dependents instead of throwing an error if there
23503
+ //! are any)
23504
+ bool cascade = false;
23466
23505
 
23467
23506
  public:
23468
- unique_ptr<CreateInfo> Copy() const override {
23469
- auto result = make_unique<CreateTypeInfo>();
23470
- CopyProperties(*result);
23471
- result->name = name;
23507
+ unique_ptr<DropInfo> Copy() const {
23508
+ auto result = make_unique<DropInfo>();
23472
23509
  result->type = type;
23473
- return move(result);
23510
+ result->schema = schema;
23511
+ result->name = name;
23512
+ result->if_exists = if_exists;
23513
+ result->cascade = cascade;
23514
+ return result;
23474
23515
  }
23475
23516
  };
23476
23517
 
@@ -23478,7 +23519,7 @@ public:
23478
23519
  //===----------------------------------------------------------------------===//
23479
23520
  // DuckDB
23480
23521
  //
23481
- // duckdb/parser/parsed_data/create_view_info.hpp
23522
+ // duckdb/parser/parsed_data/create_schema_info.hpp
23482
23523
  //
23483
23524
  //
23484
23525
  //===----------------------------------------------------------------------===//
@@ -23487,32 +23528,16 @@ public:
23487
23528
 
23488
23529
 
23489
23530
 
23490
-
23491
23531
  namespace duckdb {
23492
23532
 
23493
- struct CreateViewInfo : public CreateInfo {
23494
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
23495
- }
23496
- CreateViewInfo(string schema, string view_name)
23497
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
23533
+ struct CreateSchemaInfo : public CreateInfo {
23534
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23498
23535
  }
23499
23536
 
23500
- //! Table name to insert to
23501
- string view_name;
23502
- //! Aliases of the view
23503
- vector<string> aliases;
23504
- //! Return types
23505
- vector<LogicalType> types;
23506
- //! The SelectStatement of the view
23507
- unique_ptr<SelectStatement> query;
23508
-
23509
23537
  public:
23510
23538
  unique_ptr<CreateInfo> Copy() const override {
23511
- auto result = make_unique<CreateViewInfo>(schema, view_name);
23539
+ auto result = make_unique<CreateSchemaInfo>();
23512
23540
  CopyProperties(*result);
23513
- result->aliases = aliases;
23514
- result->types = types;
23515
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
23516
23541
  return move(result);
23517
23542
  }
23518
23543
  };
@@ -23605,7 +23630,7 @@ public:
23605
23630
  //===----------------------------------------------------------------------===//
23606
23631
  // DuckDB
23607
23632
  //
23608
- // duckdb/parser/parsed_data/export_table_data.hpp
23633
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23609
23634
  //
23610
23635
  //
23611
23636
  //===----------------------------------------------------------------------===//
@@ -23614,34 +23639,28 @@ public:
23614
23639
 
23615
23640
 
23616
23641
 
23617
-
23618
23642
  namespace duckdb {
23619
23643
 
23620
- struct ExportedTableData {
23621
- //! Name of the exported table
23622
- string table_name;
23623
-
23624
- //! Name of the schema
23625
- string schema_name;
23626
-
23627
- //! Path to be exported
23628
- string file_path;
23629
- };
23644
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23630
23645
 
23631
- struct ExportedTableInfo {
23632
- TableCatalogEntry *entry;
23633
- ExportedTableData table_data;
23634
- };
23646
+ struct LoadInfo : public ParseInfo {
23647
+ std::string filename;
23648
+ LoadType load_type;
23635
23649
 
23636
- struct BoundExportData : public ParseInfo {
23637
- std::vector<ExportedTableInfo> data;
23650
+ public:
23651
+ unique_ptr<LoadInfo> Copy() const {
23652
+ auto result = make_unique<LoadInfo>();
23653
+ result->filename = filename;
23654
+ result->load_type = load_type;
23655
+ return result;
23656
+ }
23638
23657
  };
23639
23658
 
23640
23659
  } // namespace duckdb
23641
23660
  //===----------------------------------------------------------------------===//
23642
23661
  // DuckDB
23643
23662
  //
23644
- // duckdb/parser/parsed_data/vacuum_info.hpp
23663
+ // duckdb/parser/parsed_data/create_type_info.hpp
23645
23664
  //
23646
23665
  //
23647
23666
  //===----------------------------------------------------------------------===//
@@ -23650,20 +23669,28 @@ struct BoundExportData : public ParseInfo {
23650
23669
 
23651
23670
 
23652
23671
 
23672
+
23673
+
23674
+
23653
23675
  namespace duckdb {
23654
23676
 
23655
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23677
+ struct CreateTypeInfo : public CreateInfo {
23656
23678
 
23657
- struct LoadInfo : public ParseInfo {
23658
- std::string filename;
23659
- LoadType load_type;
23679
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23680
+ }
23681
+
23682
+ //! Name of the Type
23683
+ string name;
23684
+ //! Logical Type
23685
+ LogicalType type;
23660
23686
 
23661
23687
  public:
23662
- unique_ptr<LoadInfo> Copy() const {
23663
- auto result = make_unique<LoadInfo>();
23664
- result->filename = filename;
23665
- result->load_type = load_type;
23666
- return result;
23688
+ unique_ptr<CreateInfo> Copy() const override {
23689
+ auto result = make_unique<CreateTypeInfo>();
23690
+ CopyProperties(*result);
23691
+ result->name = name;
23692
+ result->type = type;
23693
+ return move(result);
23667
23694
  }
23668
23695
  };
23669
23696
 
@@ -23671,7 +23698,7 @@ public:
23671
23698
  //===----------------------------------------------------------------------===//
23672
23699
  // DuckDB
23673
23700
  //
23674
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23701
+ // duckdb/parser/parsed_data/create_view_info.hpp
23675
23702
  //
23676
23703
  //
23677
23704
  //===----------------------------------------------------------------------===//
@@ -23683,27 +23710,29 @@ public:
23683
23710
 
23684
23711
  namespace duckdb {
23685
23712
 
23686
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23687
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
23688
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23689
- this->name = function.name;
23690
- functions.AddFunction(move(function));
23713
+ struct CreateViewInfo : public CreateInfo {
23714
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
23691
23715
  }
23692
-
23693
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23694
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23695
- this->name = functions.name;
23696
- for (auto &func : functions.functions) {
23697
- func.name = functions.name;
23698
- }
23716
+ CreateViewInfo(string schema, string view_name)
23717
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
23699
23718
  }
23700
23719
 
23701
- AggregateFunctionSet functions;
23720
+ //! Table name to insert to
23721
+ string view_name;
23722
+ //! Aliases of the view
23723
+ vector<string> aliases;
23724
+ //! Return types
23725
+ vector<LogicalType> types;
23726
+ //! The SelectStatement of the view
23727
+ unique_ptr<SelectStatement> query;
23702
23728
 
23703
23729
  public:
23704
23730
  unique_ptr<CreateInfo> Copy() const override {
23705
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23731
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
23706
23732
  CopyProperties(*result);
23733
+ result->aliases = aliases;
23734
+ result->types = types;
23735
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
23707
23736
  return move(result);
23708
23737
  }
23709
23738
  };
@@ -23712,7 +23741,7 @@ public:
23712
23741
  //===----------------------------------------------------------------------===//
23713
23742
  // DuckDB
23714
23743
  //
23715
- // duckdb/parser/parsed_data/drop_info.hpp
23744
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23716
23745
  //
23717
23746
  //
23718
23747
  //===----------------------------------------------------------------------===//
@@ -23721,42 +23750,17 @@ public:
23721
23750
 
23722
23751
 
23723
23752
 
23724
-
23725
23753
  namespace duckdb {
23726
23754
 
23727
- struct DropInfo : public ParseInfo {
23728
- DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23729
- }
23730
-
23731
- //! The catalog type to drop
23732
- CatalogType type;
23733
- //! Schema name to drop from, if any
23734
- string schema;
23735
- //! Element name to drop
23736
- string name;
23737
- //! Ignore if the entry does not exist instead of failing
23738
- bool if_exists = false;
23739
- //! Cascade drop (drop all dependents instead of throwing an error if there
23740
- //! are any)
23741
- bool cascade = false;
23742
-
23743
- public:
23744
- unique_ptr<DropInfo> Copy() const {
23745
- auto result = make_unique<DropInfo>();
23746
- result->type = type;
23747
- result->schema = schema;
23748
- result->name = name;
23749
- result->if_exists = if_exists;
23750
- result->cascade = cascade;
23751
- return result;
23752
- }
23755
+ struct VacuumInfo : public ParseInfo {
23756
+ // nothing for now
23753
23757
  };
23754
23758
 
23755
23759
  } // namespace duckdb
23756
23760
  //===----------------------------------------------------------------------===//
23757
23761
  // DuckDB
23758
23762
  //
23759
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23763
+ // duckdb/parser/parsed_data/show_select_info.hpp
23760
23764
  //
23761
23765
  //
23762
23766
  //===----------------------------------------------------------------------===//
@@ -23768,27 +23772,23 @@ public:
23768
23772
 
23769
23773
  namespace duckdb {
23770
23774
 
23771
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23772
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
23773
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23774
- functions.push_back(move(function));
23775
- this->name = function.name;
23776
- }
23777
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23778
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23779
- this->name = name;
23780
- for (auto &function : functions) {
23781
- function.name = name;
23782
- }
23783
- }
23784
-
23785
- vector<PragmaFunction> functions;
23775
+ struct ShowSelectInfo : public ParseInfo {
23776
+ //! Types of projected columns
23777
+ vector<LogicalType> types;
23778
+ //! The QueryNode of select query
23779
+ unique_ptr<QueryNode> query;
23780
+ //! Aliases of projected columns
23781
+ vector<string> aliases;
23782
+ //! Whether or not we are requesting a summary or a describe
23783
+ bool is_summary;
23786
23784
 
23787
- public:
23788
- unique_ptr<CreateInfo> Copy() const override {
23789
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23790
- CopyProperties(*result);
23791
- return move(result);
23785
+ unique_ptr<ShowSelectInfo> Copy() {
23786
+ auto result = make_unique<ShowSelectInfo>();
23787
+ result->types = types;
23788
+ result->query = query->Copy();
23789
+ result->aliases = aliases;
23790
+ result->is_summary = is_summary;
23791
+ return result;
23792
23792
  }
23793
23793
  };
23794
23794
 
@@ -23796,7 +23796,7 @@ public:
23796
23796
  //===----------------------------------------------------------------------===//
23797
23797
  // DuckDB
23798
23798
  //
23799
- // duckdb/parser/tableref/expressionlistref.hpp
23799
+ // duckdb/parser/tableref/emptytableref.hpp
23800
23800
  //
23801
23801
  //
23802
23802
  //===----------------------------------------------------------------------===//
@@ -23805,36 +23805,25 @@ public:
23805
23805
 
23806
23806
 
23807
23807
 
23808
-
23809
-
23810
-
23811
23808
  namespace duckdb {
23812
- //! Represents an expression list as generated by a VALUES statement
23813
- class ExpressionListRef : public TableRef {
23809
+ //! Represents a cross product
23810
+ class EmptyTableRef : public TableRef {
23814
23811
  public:
23815
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
23812
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
23816
23813
  }
23817
23814
 
23818
- //! Value list, only used for VALUES statement
23819
- vector<vector<unique_ptr<ParsedExpression>>> values;
23820
- //! Expected SQL types
23821
- vector<LogicalType> expected_types;
23822
- //! The set of expected names
23823
- vector<string> expected_names;
23824
-
23825
23815
  public:
23826
23816
  string ToString() const override;
23827
23817
  bool Equals(const TableRef *other_p) const override;
23828
23818
 
23829
23819
  unique_ptr<TableRef> Copy() override;
23830
23820
 
23831
- //! Serializes a blob into a ExpressionListRef
23821
+ //! Serializes a blob into a DummyTableRef
23832
23822
  void Serialize(FieldWriter &serializer) const override;
23833
- //! Deserializes a blob back into a ExpressionListRef
23823
+ //! Deserializes a blob back into a DummyTableRef
23834
23824
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23835
23825
  };
23836
23826
  } // namespace duckdb
23837
-
23838
23827
  //===----------------------------------------------------------------------===//
23839
23828
  // DuckDB
23840
23829
  //
@@ -23872,10 +23861,12 @@ public:
23872
23861
  };
23873
23862
  } // namespace duckdb
23874
23863
 
23864
+
23865
+
23875
23866
  //===----------------------------------------------------------------------===//
23876
23867
  // DuckDB
23877
23868
  //
23878
- // duckdb/parser/tableref/emptytableref.hpp
23869
+ // duckdb/parser/tableref/expressionlistref.hpp
23879
23870
  //
23880
23871
  //
23881
23872
  //===----------------------------------------------------------------------===//
@@ -23884,27 +23875,36 @@ public:
23884
23875
 
23885
23876
 
23886
23877
 
23878
+
23879
+
23880
+
23887
23881
  namespace duckdb {
23888
- //! Represents a cross product
23889
- class EmptyTableRef : public TableRef {
23882
+ //! Represents an expression list as generated by a VALUES statement
23883
+ class ExpressionListRef : public TableRef {
23890
23884
  public:
23891
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
23885
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
23892
23886
  }
23893
23887
 
23888
+ //! Value list, only used for VALUES statement
23889
+ vector<vector<unique_ptr<ParsedExpression>>> values;
23890
+ //! Expected SQL types
23891
+ vector<LogicalType> expected_types;
23892
+ //! The set of expected names
23893
+ vector<string> expected_names;
23894
+
23894
23895
  public:
23895
23896
  string ToString() const override;
23896
23897
  bool Equals(const TableRef *other_p) const override;
23897
23898
 
23898
23899
  unique_ptr<TableRef> Copy() override;
23899
23900
 
23900
- //! Serializes a blob into a DummyTableRef
23901
+ //! Serializes a blob into a ExpressionListRef
23901
23902
  void Serialize(FieldWriter &serializer) const override;
23902
- //! Deserializes a blob back into a DummyTableRef
23903
+ //! Deserializes a blob back into a ExpressionListRef
23903
23904
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23904
23905
  };
23905
23906
  } // namespace duckdb
23906
23907
 
23907
-
23908
23908
  //===----------------------------------------------------------------------===//
23909
23909
  // DuckDB
23910
23910
  //