duckdb 0.6.2-dev570.0 → 0.6.2-dev576.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 "48030413a9"
15
- #define DUCKDB_VERSION "v0.6.2-dev570"
14
+ #define DUCKDB_SOURCE_ID "6292ced174"
15
+ #define DUCKDB_VERSION "v0.6.2-dev576"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -18483,6 +18483,9 @@ struct ClientConfig {
18483
18483
  bool force_external = false;
18484
18484
  //! Force disable cross product generation when hyper graph isn't connected, used for testing
18485
18485
  bool force_no_cross_product = false;
18486
+ //! If this context should also try to use the available replacement scans
18487
+ //! True by default
18488
+ bool use_replacement_scans = true;
18486
18489
  //! Maximum bits allowed for using a perfect hash table (i.e. the perfect HT can hold up to 2^perfect_ht_threshold
18487
18490
  //! elements)
18488
18491
  idx_t perfect_ht_threshold = 12;
@@ -31371,7 +31374,7 @@ private:
31371
31374
  //===----------------------------------------------------------------------===//
31372
31375
  // DuckDB
31373
31376
  //
31374
- // duckdb/parser/expression/between_expression.hpp
31377
+ // duckdb/parser/expression/cast_expression.hpp
31375
31378
  //
31376
31379
  //
31377
31380
  //===----------------------------------------------------------------------===//
@@ -31380,21 +31383,25 @@ private:
31380
31383
 
31381
31384
 
31382
31385
 
31386
+
31383
31387
  namespace duckdb {
31384
31388
 
31385
- class BetweenExpression : public ParsedExpression {
31389
+ //! CastExpression represents a type cast from one SQL type to another SQL type
31390
+ class CastExpression : public ParsedExpression {
31386
31391
  public:
31387
- DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
31388
- unique_ptr<ParsedExpression> upper);
31392
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
31389
31393
 
31390
- unique_ptr<ParsedExpression> input;
31391
- unique_ptr<ParsedExpression> lower;
31392
- unique_ptr<ParsedExpression> upper;
31394
+ //! The child of the cast expression
31395
+ unique_ptr<ParsedExpression> child;
31396
+ //! The type to cast to
31397
+ LogicalType cast_type;
31398
+ //! Whether or not this is a try_cast expression
31399
+ bool try_cast;
31393
31400
 
31394
31401
  public:
31395
31402
  string ToString() const override;
31396
31403
 
31397
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
31404
+ static bool Equals(const CastExpression *a, const CastExpression *b);
31398
31405
 
31399
31406
  unique_ptr<ParsedExpression> Copy() const override;
31400
31407
 
@@ -31404,13 +31411,98 @@ public:
31404
31411
  public:
31405
31412
  template <class T, class BASE>
31406
31413
  static string ToString(const T &entry) {
31407
- return "(" + entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " +
31408
- entry.upper->ToString() + ")";
31414
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
31415
+ entry.cast_type.ToString() + ")";
31416
+ }
31417
+ };
31418
+ } // namespace duckdb
31419
+ //===----------------------------------------------------------------------===//
31420
+ // DuckDB
31421
+ //
31422
+ // duckdb/parser/expression/parameter_expression.hpp
31423
+ //
31424
+ //
31425
+ //===----------------------------------------------------------------------===//
31426
+
31427
+
31428
+
31429
+
31430
+
31431
+ namespace duckdb {
31432
+ class ParameterExpression : public ParsedExpression {
31433
+ public:
31434
+ ParameterExpression();
31435
+
31436
+ idx_t parameter_nr;
31437
+
31438
+ public:
31439
+ bool IsScalar() const override {
31440
+ return true;
31441
+ }
31442
+ bool HasParameter() const override {
31443
+ return true;
31409
31444
  }
31445
+
31446
+ string ToString() const override;
31447
+
31448
+ static bool Equals(const ParameterExpression *a, const ParameterExpression *b);
31449
+
31450
+ unique_ptr<ParsedExpression> Copy() const override;
31451
+ hash_t Hash() const override;
31452
+
31453
+ void Serialize(FieldWriter &writer) const override;
31454
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31410
31455
  };
31411
31456
  } // namespace duckdb
31457
+ //===----------------------------------------------------------------------===//
31458
+ // DuckDB
31459
+ //
31460
+ // duckdb/parser/expression/subquery_expression.hpp
31461
+ //
31462
+ //
31463
+ //===----------------------------------------------------------------------===//
31464
+
31465
+
31466
+
31467
+
31468
+
31469
+
31470
+
31471
+ namespace duckdb {
31472
+
31473
+ //! Represents a subquery
31474
+ class SubqueryExpression : public ParsedExpression {
31475
+ public:
31476
+ SubqueryExpression();
31477
+
31478
+ //! The actual subquery
31479
+ unique_ptr<SelectStatement> subquery;
31480
+ //! The subquery type
31481
+ SubqueryType subquery_type;
31482
+ //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
31483
+ //! subquery)
31484
+ unique_ptr<ParsedExpression> child;
31485
+ //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
31486
+ ExpressionType comparison_type;
31487
+
31488
+ public:
31489
+ bool HasSubquery() const override {
31490
+ return true;
31491
+ }
31492
+ bool IsScalar() const override {
31493
+ return false;
31494
+ }
31495
+
31496
+ string ToString() const override;
31497
+
31498
+ static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
31412
31499
 
31500
+ unique_ptr<ParsedExpression> Copy() const override;
31413
31501
 
31502
+ void Serialize(FieldWriter &writer) const override;
31503
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31504
+ };
31505
+ } // namespace duckdb
31414
31506
  //===----------------------------------------------------------------------===//
31415
31507
  // DuckDB
31416
31508
  //
@@ -31463,11 +31555,10 @@ public:
31463
31555
  }
31464
31556
  };
31465
31557
  } // namespace duckdb
31466
-
31467
31558
  //===----------------------------------------------------------------------===//
31468
31559
  // DuckDB
31469
31560
  //
31470
- // duckdb/parser/expression/cast_expression.hpp
31561
+ // duckdb/parser/expression/collate_expression.hpp
31471
31562
  //
31472
31563
  //
31473
31564
  //===----------------------------------------------------------------------===//
@@ -31476,25 +31567,60 @@ public:
31476
31567
 
31477
31568
 
31478
31569
 
31479
-
31480
31570
  namespace duckdb {
31481
31571
 
31482
- //! CastExpression represents a type cast from one SQL type to another SQL type
31483
- class CastExpression : public ParsedExpression {
31572
+ //! CollateExpression represents a COLLATE statement
31573
+ class CollateExpression : public ParsedExpression {
31484
31574
  public:
31485
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
31575
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
31486
31576
 
31487
31577
  //! The child of the cast expression
31488
31578
  unique_ptr<ParsedExpression> child;
31489
- //! The type to cast to
31490
- LogicalType cast_type;
31491
- //! Whether or not this is a try_cast expression
31492
- bool try_cast;
31579
+ //! The collation clause
31580
+ string collation;
31493
31581
 
31494
31582
  public:
31495
31583
  string ToString() const override;
31496
31584
 
31497
- static bool Equals(const CastExpression *a, const CastExpression *b);
31585
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
31586
+
31587
+ unique_ptr<ParsedExpression> Copy() const override;
31588
+
31589
+ void Serialize(FieldWriter &writer) const override;
31590
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31591
+ };
31592
+ } // namespace duckdb
31593
+ //===----------------------------------------------------------------------===//
31594
+ // DuckDB
31595
+ //
31596
+ // duckdb/parser/expression/conjunction_expression.hpp
31597
+ //
31598
+ //
31599
+ //===----------------------------------------------------------------------===//
31600
+
31601
+
31602
+
31603
+
31604
+
31605
+
31606
+ namespace duckdb {
31607
+
31608
+ //! Represents a conjunction (AND/OR)
31609
+ class ConjunctionExpression : public ParsedExpression {
31610
+ public:
31611
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
31612
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
31613
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
31614
+ unique_ptr<ParsedExpression> right);
31615
+
31616
+ vector<unique_ptr<ParsedExpression>> children;
31617
+
31618
+ public:
31619
+ void AddExpression(unique_ptr<ParsedExpression> expr);
31620
+
31621
+ string ToString() const override;
31622
+
31623
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
31498
31624
 
31499
31625
  unique_ptr<ParsedExpression> Copy() const override;
31500
31626
 
@@ -31504,16 +31630,18 @@ public:
31504
31630
  public:
31505
31631
  template <class T, class BASE>
31506
31632
  static string ToString(const T &entry) {
31507
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
31508
- entry.cast_type.ToString() + ")";
31633
+ string result = "(" + entry.children[0]->ToString();
31634
+ for (idx_t i = 1; i < entry.children.size(); i++) {
31635
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
31636
+ }
31637
+ return result + ")";
31509
31638
  }
31510
31639
  };
31511
31640
  } // namespace duckdb
31512
-
31513
31641
  //===----------------------------------------------------------------------===//
31514
31642
  // DuckDB
31515
31643
  //
31516
- // duckdb/parser/expression/collate_expression.hpp
31644
+ // duckdb/parser/expression/positional_reference_expression.hpp
31517
31645
  //
31518
31646
  //
31519
31647
  //===----------------------------------------------------------------------===//
@@ -31523,30 +31651,27 @@ public:
31523
31651
 
31524
31652
 
31525
31653
  namespace duckdb {
31526
-
31527
- //! CollateExpression represents a COLLATE statement
31528
- class CollateExpression : public ParsedExpression {
31654
+ class PositionalReferenceExpression : public ParsedExpression {
31529
31655
  public:
31530
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
31656
+ DUCKDB_API PositionalReferenceExpression(idx_t index);
31531
31657
 
31532
- //! The child of the cast expression
31533
- unique_ptr<ParsedExpression> child;
31534
- //! The collation clause
31535
- string collation;
31658
+ idx_t index;
31536
31659
 
31537
31660
  public:
31538
- string ToString() const override;
31661
+ bool IsScalar() const override {
31662
+ return false;
31663
+ }
31539
31664
 
31540
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
31665
+ string ToString() const override;
31541
31666
 
31667
+ static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
31542
31668
  unique_ptr<ParsedExpression> Copy() const override;
31669
+ hash_t Hash() const override;
31543
31670
 
31544
31671
  void Serialize(FieldWriter &writer) const override;
31545
31672
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31546
31673
  };
31547
31674
  } // namespace duckdb
31548
-
31549
-
31550
31675
  //===----------------------------------------------------------------------===//
31551
31676
  // DuckDB
31552
31677
  //
@@ -31588,11 +31713,10 @@ public:
31588
31713
  }
31589
31714
  };
31590
31715
  } // namespace duckdb
31591
-
31592
31716
  //===----------------------------------------------------------------------===//
31593
31717
  // DuckDB
31594
31718
  //
31595
- // duckdb/parser/expression/conjunction_expression.hpp
31719
+ // duckdb/parser/expression/between_expression.hpp
31596
31720
  //
31597
31721
  //
31598
31722
  //===----------------------------------------------------------------------===//
@@ -31601,25 +31725,21 @@ public:
31601
31725
 
31602
31726
 
31603
31727
 
31604
-
31605
31728
  namespace duckdb {
31606
31729
 
31607
- //! Represents a conjunction (AND/OR)
31608
- class ConjunctionExpression : public ParsedExpression {
31730
+ class BetweenExpression : public ParsedExpression {
31609
31731
  public:
31610
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
31611
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
31612
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
31613
- unique_ptr<ParsedExpression> right);
31732
+ DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
31733
+ unique_ptr<ParsedExpression> upper);
31614
31734
 
31615
- vector<unique_ptr<ParsedExpression>> children;
31735
+ unique_ptr<ParsedExpression> input;
31736
+ unique_ptr<ParsedExpression> lower;
31737
+ unique_ptr<ParsedExpression> upper;
31616
31738
 
31617
31739
  public:
31618
- void AddExpression(unique_ptr<ParsedExpression> expr);
31619
-
31620
31740
  string ToString() const override;
31621
31741
 
31622
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
31742
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
31623
31743
 
31624
31744
  unique_ptr<ParsedExpression> Copy() const override;
31625
31745
 
@@ -31629,15 +31749,11 @@ public:
31629
31749
  public:
31630
31750
  template <class T, class BASE>
31631
31751
  static string ToString(const T &entry) {
31632
- string result = "(" + entry.children[0]->ToString();
31633
- for (idx_t i = 1; i < entry.children.size(); i++) {
31634
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
31635
- }
31636
- return result + ")";
31752
+ return "(" + entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " +
31753
+ entry.upper->ToString() + ")";
31637
31754
  }
31638
31755
  };
31639
31756
  } // namespace duckdb
31640
-
31641
31757
  //===----------------------------------------------------------------------===//
31642
31758
  // DuckDB
31643
31759
  //
@@ -31674,39 +31790,6 @@ public:
31674
31790
  };
31675
31791
 
31676
31792
  } // namespace duckdb
31677
-
31678
- //===----------------------------------------------------------------------===//
31679
- // DuckDB
31680
- //
31681
- // duckdb/parser/expression/default_expression.hpp
31682
- //
31683
- //
31684
- //===----------------------------------------------------------------------===//
31685
-
31686
-
31687
-
31688
-
31689
-
31690
- namespace duckdb {
31691
- //! Represents the default value of a column
31692
- class DefaultExpression : public ParsedExpression {
31693
- public:
31694
- DefaultExpression();
31695
-
31696
- public:
31697
- bool IsScalar() const override {
31698
- return false;
31699
- }
31700
-
31701
- string ToString() const override;
31702
-
31703
- unique_ptr<ParsedExpression> Copy() const override;
31704
-
31705
- void Serialize(FieldWriter &writer) const override;
31706
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31707
- };
31708
- } // namespace duckdb
31709
-
31710
31793
  //===----------------------------------------------------------------------===//
31711
31794
  // DuckDB
31712
31795
  //
@@ -31824,8 +31907,37 @@ public:
31824
31907
  }
31825
31908
  };
31826
31909
  } // namespace duckdb
31910
+ //===----------------------------------------------------------------------===//
31911
+ // DuckDB
31912
+ //
31913
+ // duckdb/parser/expression/default_expression.hpp
31914
+ //
31915
+ //
31916
+ //===----------------------------------------------------------------------===//
31917
+
31918
+
31919
+
31920
+
31921
+
31922
+ namespace duckdb {
31923
+ //! Represents the default value of a column
31924
+ class DefaultExpression : public ParsedExpression {
31925
+ public:
31926
+ DefaultExpression();
31927
+
31928
+ public:
31929
+ bool IsScalar() const override {
31930
+ return false;
31931
+ }
31827
31932
 
31933
+ string ToString() const override;
31934
+
31935
+ unique_ptr<ParsedExpression> Copy() const override;
31828
31936
 
31937
+ void Serialize(FieldWriter &writer) const override;
31938
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31939
+ };
31940
+ } // namespace duckdb
31829
31941
  //===----------------------------------------------------------------------===//
31830
31942
  // DuckDB
31831
31943
  //
@@ -31937,79 +32049,19 @@ public:
31937
32049
 
31938
32050
  } // namespace duckdb
31939
32051
 
31940
- //===----------------------------------------------------------------------===//
31941
- // DuckDB
31942
- //
31943
- // duckdb/parser/expression/parameter_expression.hpp
31944
- //
31945
- //
31946
- //===----------------------------------------------------------------------===//
31947
-
31948
-
31949
-
31950
-
31951
-
31952
- namespace duckdb {
31953
- class ParameterExpression : public ParsedExpression {
31954
- public:
31955
- ParameterExpression();
31956
-
31957
- idx_t parameter_nr;
31958
-
31959
- public:
31960
- bool IsScalar() const override {
31961
- return true;
31962
- }
31963
- bool HasParameter() const override {
31964
- return true;
31965
- }
31966
-
31967
- string ToString() const override;
31968
-
31969
- static bool Equals(const ParameterExpression *a, const ParameterExpression *b);
31970
32052
 
31971
- unique_ptr<ParsedExpression> Copy() const override;
31972
- hash_t Hash() const override;
31973
32053
 
31974
- void Serialize(FieldWriter &writer) const override;
31975
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
31976
- };
31977
- } // namespace duckdb
31978
32054
 
31979
- //===----------------------------------------------------------------------===//
31980
- // DuckDB
31981
- //
31982
- // duckdb/parser/expression/positional_reference_expression.hpp
31983
- //
31984
- //
31985
- //===----------------------------------------------------------------------===//
31986
32055
 
31987
32056
 
31988
32057
 
31989
32058
 
31990
32059
 
31991
- namespace duckdb {
31992
- class PositionalReferenceExpression : public ParsedExpression {
31993
- public:
31994
- DUCKDB_API PositionalReferenceExpression(idx_t index);
31995
32060
 
31996
- idx_t index;
31997
32061
 
31998
- public:
31999
- bool IsScalar() const override {
32000
- return false;
32001
- }
32002
32062
 
32003
- string ToString() const override;
32004
32063
 
32005
- static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
32006
- unique_ptr<ParsedExpression> Copy() const override;
32007
- hash_t Hash() const override;
32008
32064
 
32009
- void Serialize(FieldWriter &writer) const override;
32010
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
32011
- };
32012
- } // namespace duckdb
32013
32065
 
32014
32066
  //===----------------------------------------------------------------------===//
32015
32067
  // DuckDB
@@ -32054,61 +32106,12 @@ public:
32054
32106
  };
32055
32107
  } // namespace duckdb
32056
32108
 
32057
- //===----------------------------------------------------------------------===//
32058
- // DuckDB
32059
- //
32060
- // duckdb/parser/expression/subquery_expression.hpp
32061
- //
32062
- //
32063
- //===----------------------------------------------------------------------===//
32064
-
32065
-
32066
-
32067
-
32068
-
32069
-
32070
-
32071
- namespace duckdb {
32072
-
32073
- //! Represents a subquery
32074
- class SubqueryExpression : public ParsedExpression {
32075
- public:
32076
- SubqueryExpression();
32077
-
32078
- //! The actual subquery
32079
- unique_ptr<SelectStatement> subquery;
32080
- //! The subquery type
32081
- SubqueryType subquery_type;
32082
- //! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
32083
- //! subquery)
32084
- unique_ptr<ParsedExpression> child;
32085
- //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
32086
- ExpressionType comparison_type;
32087
-
32088
- public:
32089
- bool HasSubquery() const override {
32090
- return true;
32091
- }
32092
- bool IsScalar() const override {
32093
- return false;
32094
- }
32095
-
32096
- string ToString() const override;
32097
-
32098
- static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
32099
-
32100
- unique_ptr<ParsedExpression> Copy() const override;
32101
-
32102
- void Serialize(FieldWriter &writer) const override;
32103
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
32104
- };
32105
- } // namespace duckdb
32106
32109
 
32107
32110
 
32108
32111
  //===----------------------------------------------------------------------===//
32109
32112
  // DuckDB
32110
32113
  //
32111
- // duckdb/parser/parsed_data/create_view_info.hpp
32114
+ // duckdb/parser/parsed_data/create_schema_info.hpp
32112
32115
  //
32113
32116
  //
32114
32117
  //===----------------------------------------------------------------------===//
@@ -32117,57 +32120,27 @@ public:
32117
32120
 
32118
32121
 
32119
32122
 
32120
-
32121
32123
  namespace duckdb {
32122
32124
 
32123
- struct CreateViewInfo : public CreateInfo {
32124
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
32125
- }
32126
- CreateViewInfo(string schema, string view_name)
32127
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
32125
+ struct CreateSchemaInfo : public CreateInfo {
32126
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
32128
32127
  }
32129
32128
 
32130
- //! Table name to insert to
32131
- string view_name;
32132
- //! Aliases of the view
32133
- vector<string> aliases;
32134
- //! Return types
32135
- vector<LogicalType> types;
32136
- //! The SelectStatement of the view
32137
- unique_ptr<SelectStatement> query;
32138
-
32139
32129
  public:
32140
32130
  unique_ptr<CreateInfo> Copy() const override {
32141
- auto result = make_unique<CreateViewInfo>(schema, view_name);
32131
+ auto result = make_unique<CreateSchemaInfo>();
32142
32132
  CopyProperties(*result);
32143
- result->aliases = aliases;
32144
- result->types = types;
32145
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
32146
32133
  return move(result);
32147
32134
  }
32148
32135
 
32149
- static unique_ptr<CreateViewInfo> Deserialize(Deserializer &deserializer) {
32150
- auto result = make_unique<CreateViewInfo>();
32136
+ static unique_ptr<CreateSchemaInfo> Deserialize(Deserializer &deserializer) {
32137
+ auto result = make_unique<CreateSchemaInfo>();
32151
32138
  result->DeserializeBase(deserializer);
32152
-
32153
- FieldReader reader(deserializer);
32154
- result->view_name = reader.ReadRequired<string>();
32155
- result->aliases = reader.ReadRequiredList<string>();
32156
- result->types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
32157
- result->query = reader.ReadOptional<SelectStatement>(nullptr);
32158
- reader.Finalize();
32159
-
32160
32139
  return result;
32161
32140
  }
32162
32141
 
32163
32142
  protected:
32164
- void SerializeInternal(Serializer &serializer) const override {
32165
- FieldWriter writer(serializer);
32166
- writer.WriteString(view_name);
32167
- writer.WriteList<string>(aliases);
32168
- writer.WriteRegularSerializableList(types);
32169
- writer.WriteOptional(query);
32170
- writer.Finalize();
32143
+ void SerializeInternal(Serializer &) const override {
32171
32144
  }
32172
32145
  };
32173
32146
 
@@ -32175,7 +32148,7 @@ protected:
32175
32148
  //===----------------------------------------------------------------------===//
32176
32149
  // DuckDB
32177
32150
  //
32178
- // duckdb/parser/parsed_data/alter_function_info.hpp
32151
+ // duckdb/parser/parsed_data/vacuum_info.hpp
32179
32152
  //
32180
32153
  //
32181
32154
  //===----------------------------------------------------------------------===//
@@ -32184,38 +32157,21 @@ protected:
32184
32157
 
32185
32158
 
32186
32159
 
32187
-
32188
-
32189
32160
  namespace duckdb {
32190
32161
 
32191
- //===--------------------------------------------------------------------===//
32192
- // Alter Table
32193
- //===--------------------------------------------------------------------===//
32194
- enum class AlterFunctionType : uint8_t { INVALID = 0, ADD_FUNCTION_OVERLOADS = 1 };
32195
-
32196
- struct AlterFunctionInfo : public AlterInfo {
32197
- AlterFunctionInfo(AlterFunctionType type, string schema, string name, bool if_exists);
32198
- virtual ~AlterFunctionInfo() override;
32199
-
32200
- AlterFunctionType alter_function_type;
32201
-
32202
- public:
32203
- CatalogType GetCatalogType() const override;
32204
- void Serialize(FieldWriter &writer) const override;
32205
- static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
32206
- };
32207
-
32208
- //===--------------------------------------------------------------------===//
32209
- // AddFunctionOverloadInfo
32210
- //===--------------------------------------------------------------------===//
32211
- struct AddFunctionOverloadInfo : public AlterFunctionInfo {
32212
- AddFunctionOverloadInfo(string schema, string name, bool if_exists, ScalarFunctionSet new_overloads);
32213
- ~AddFunctionOverloadInfo() override;
32162
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
32214
32163
 
32215
- ScalarFunctionSet new_overloads;
32164
+ struct LoadInfo : public ParseInfo {
32165
+ std::string filename;
32166
+ LoadType load_type;
32216
32167
 
32217
32168
  public:
32218
- unique_ptr<AlterInfo> Copy() const override;
32169
+ unique_ptr<LoadInfo> Copy() const {
32170
+ auto result = make_unique<LoadInfo>();
32171
+ result->filename = filename;
32172
+ result->load_type = load_type;
32173
+ return result;
32174
+ }
32219
32175
  };
32220
32176
 
32221
32177
  } // namespace duckdb
@@ -32269,7 +32225,7 @@ public:
32269
32225
  //===----------------------------------------------------------------------===//
32270
32226
  // DuckDB
32271
32227
  //
32272
- // duckdb/parser/parsed_data/show_select_info.hpp
32228
+ // duckdb/parser/parsed_data/create_macro_info.hpp
32273
32229
  //
32274
32230
  //
32275
32231
  //===----------------------------------------------------------------------===//
@@ -32277,35 +32233,10 @@ public:
32277
32233
 
32278
32234
 
32279
32235
 
32280
-
32281
-
32282
- namespace duckdb {
32283
-
32284
- struct ShowSelectInfo : public ParseInfo {
32285
- //! Types of projected columns
32286
- vector<LogicalType> types;
32287
- //! The QueryNode of select query
32288
- unique_ptr<QueryNode> query;
32289
- //! Aliases of projected columns
32290
- vector<string> aliases;
32291
- //! Whether or not we are requesting a summary or a describe
32292
- bool is_summary;
32293
-
32294
- unique_ptr<ShowSelectInfo> Copy() {
32295
- auto result = make_unique<ShowSelectInfo>();
32296
- result->types = types;
32297
- result->query = query->Copy();
32298
- result->aliases = aliases;
32299
- result->is_summary = is_summary;
32300
- return result;
32301
- }
32302
- };
32303
-
32304
- } // namespace duckdb
32305
32236
  //===----------------------------------------------------------------------===//
32306
32237
  // DuckDB
32307
32238
  //
32308
- // duckdb/parser/parsed_data/create_index_info.hpp
32239
+ // duckdb/function/macro_function.hpp
32309
32240
  //
32310
32241
  //
32311
32242
  //===----------------------------------------------------------------------===//
@@ -32315,88 +32246,120 @@ struct ShowSelectInfo : public ParseInfo {
32315
32246
 
32316
32247
 
32317
32248
 
32318
- //===----------------------------------------------------------------------===//
32319
- // DuckDB
32320
- //
32321
- // duckdb/parser/tableref/basetableref.hpp
32322
- //
32323
- //
32324
- //===----------------------------------------------------------------------===//
32325
32249
 
32326
32250
 
32327
32251
 
32328
32252
 
32253
+ namespace duckdb {
32329
32254
 
32255
+ enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
32330
32256
 
32331
- namespace duckdb {
32332
- //! Represents a TableReference to a base table in the schema
32333
- class BaseTableRef : public TableRef {
32257
+ class MacroFunction {
32334
32258
  public:
32335
- BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
32336
- }
32259
+ MacroFunction(MacroType type);
32337
32260
 
32338
- //! Schema name
32339
- string schema_name;
32340
- //! Table name
32341
- string table_name;
32342
- //! Aliases for the column names
32343
- vector<string> column_name_alias;
32261
+ //! The type
32262
+ MacroType type;
32263
+ //! The positional parameters
32264
+ vector<unique_ptr<ParsedExpression>> parameters;
32265
+ //! The default parameters and their associated values
32266
+ unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
32344
32267
 
32345
32268
  public:
32346
- string ToString() const override;
32347
- bool Equals(const TableRef *other_p) const override;
32269
+ virtual ~MacroFunction() {
32270
+ }
32348
32271
 
32349
- unique_ptr<TableRef> Copy() override;
32272
+ void CopyProperties(MacroFunction &other);
32350
32273
 
32351
- //! Serializes a blob into a BaseTableRef
32352
- void Serialize(FieldWriter &serializer) const override;
32353
- //! Deserializes a blob back into a BaseTableRef
32354
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
32274
+ virtual unique_ptr<MacroFunction> Copy() = 0;
32275
+
32276
+ static string ValidateArguments(MacroFunction &macro_function, const string &name,
32277
+ FunctionExpression &function_expr,
32278
+ vector<unique_ptr<ParsedExpression>> &positionals,
32279
+ unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
32280
+
32281
+ virtual string ToSQL(const string &schema, const string &name);
32355
32282
  };
32283
+
32356
32284
  } // namespace duckdb
32357
32285
 
32358
32286
 
32287
+ namespace duckdb {
32359
32288
 
32289
+ struct CreateMacroInfo : public CreateFunctionInfo {
32290
+ CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
32291
+ }
32360
32292
 
32361
- namespace duckdb {
32293
+ CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
32294
+ }
32362
32295
 
32363
- struct CreateIndexInfo : public CreateInfo {
32364
- CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
32296
+ unique_ptr<MacroFunction> function;
32297
+
32298
+ public:
32299
+ unique_ptr<CreateInfo> Copy() const override {
32300
+ auto result = make_unique<CreateMacroInfo>();
32301
+ result->function = function->Copy();
32302
+ result->name = name;
32303
+ CopyProperties(*result);
32304
+ return move(result);
32365
32305
  }
32306
+ };
32307
+
32308
+ } // namespace duckdb
32309
+ //===----------------------------------------------------------------------===//
32310
+ // DuckDB
32311
+ //
32312
+ // duckdb/parser/parsed_data/create_type_info.hpp
32313
+ //
32314
+ //
32315
+ //===----------------------------------------------------------------------===//
32316
+
32317
+
32366
32318
 
32367
- //! Index Type (e.g., B+-tree, Skip-List, ...)
32368
- IndexType index_type;
32369
- //! Name of the Index
32370
- string index_name;
32371
- //! Index Constraint Type
32372
- IndexConstraintType constraint_type;
32373
- //! The table to create the index on
32374
- unique_ptr<BaseTableRef> table;
32375
- //! Set of expressions to index by
32376
- vector<unique_ptr<ParsedExpression>> expressions;
32377
- vector<unique_ptr<ParsedExpression>> parsed_expressions;
32378
32319
 
32379
- //! Types used for the CREATE INDEX scan
32380
- vector<LogicalType> scan_types;
32381
- //! The names of the columns, used for the CREATE INDEX scan
32382
- vector<string> names;
32383
- //! Column IDs needed for index creation
32384
- vector<column_t> column_ids;
32385
32320
 
32386
- protected:
32387
- void SerializeInternal(Serializer &serializer) const override;
32321
+
32322
+
32323
+
32324
+ namespace duckdb {
32325
+
32326
+ struct CreateTypeInfo : public CreateInfo {
32327
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
32328
+ }
32329
+ CreateTypeInfo(string name_p, LogicalType type_p)
32330
+ : CreateInfo(CatalogType::TYPE_ENTRY), name(move(name_p)), type(move(type_p)) {
32331
+ }
32332
+
32333
+ //! Name of the Type
32334
+ string name;
32335
+ //! Logical Type
32336
+ LogicalType type;
32337
+ //! Used by create enum from query
32338
+ unique_ptr<SQLStatement> query;
32388
32339
 
32389
32340
  public:
32390
- unique_ptr<CreateInfo> Copy() const override;
32341
+ unique_ptr<CreateInfo> Copy() const override {
32342
+ auto result = make_unique<CreateTypeInfo>();
32343
+ CopyProperties(*result);
32344
+ result->name = name;
32345
+ result->type = type;
32346
+ if (query) {
32347
+ result->query = query->Copy();
32348
+ }
32349
+ return move(result);
32350
+ }
32391
32351
 
32392
- static unique_ptr<CreateIndexInfo> Deserialize(Deserializer &deserializer);
32352
+ protected:
32353
+ void SerializeInternal(Serializer &) const override {
32354
+ throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(CreateInfo::type));
32355
+ }
32393
32356
  };
32394
32357
 
32395
32358
  } // namespace duckdb
32396
32359
  //===----------------------------------------------------------------------===//
32397
32360
  // DuckDB
32398
32361
  //
32399
- // duckdb/parser/parsed_data/transaction_info.hpp
32362
+ // duckdb/parser/parsed_data/create_view_info.hpp
32400
32363
  //
32401
32364
  //
32402
32365
  //===----------------------------------------------------------------------===//
@@ -32405,23 +32368,65 @@ public:
32405
32368
 
32406
32369
 
32407
32370
 
32371
+
32408
32372
  namespace duckdb {
32409
32373
 
32410
- enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
32374
+ struct CreateViewInfo : public CreateInfo {
32375
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
32376
+ }
32377
+ CreateViewInfo(string schema, string view_name)
32378
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
32379
+ }
32411
32380
 
32412
- struct TransactionInfo : public ParseInfo {
32413
- explicit TransactionInfo(TransactionType type) : type(type) {
32381
+ //! Table name to insert to
32382
+ string view_name;
32383
+ //! Aliases of the view
32384
+ vector<string> aliases;
32385
+ //! Return types
32386
+ vector<LogicalType> types;
32387
+ //! The SelectStatement of the view
32388
+ unique_ptr<SelectStatement> query;
32389
+
32390
+ public:
32391
+ unique_ptr<CreateInfo> Copy() const override {
32392
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
32393
+ CopyProperties(*result);
32394
+ result->aliases = aliases;
32395
+ result->types = types;
32396
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
32397
+ return move(result);
32414
32398
  }
32415
32399
 
32416
- //! The type of transaction statement
32417
- TransactionType type;
32400
+ static unique_ptr<CreateViewInfo> Deserialize(Deserializer &deserializer) {
32401
+ auto result = make_unique<CreateViewInfo>();
32402
+ result->DeserializeBase(deserializer);
32403
+
32404
+ FieldReader reader(deserializer);
32405
+ result->view_name = reader.ReadRequired<string>();
32406
+ result->aliases = reader.ReadRequiredList<string>();
32407
+ result->types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
32408
+ result->query = reader.ReadOptional<SelectStatement>(nullptr);
32409
+ reader.Finalize();
32410
+
32411
+ return result;
32412
+ }
32413
+
32414
+ protected:
32415
+ void SerializeInternal(Serializer &serializer) const override {
32416
+ FieldWriter writer(serializer);
32417
+ writer.WriteString(view_name);
32418
+ writer.WriteList<string>(aliases);
32419
+ writer.WriteRegularSerializableList(types);
32420
+ writer.WriteOptional(query);
32421
+ writer.Finalize();
32422
+ }
32418
32423
  };
32419
32424
 
32420
32425
  } // namespace duckdb
32421
32426
  //===----------------------------------------------------------------------===//
32422
32427
  // DuckDB
32423
32428
  //
32424
- // duckdb/parser/parsed_data/vacuum_info.hpp
32429
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
32425
32430
  //
32426
32431
  //
32427
32432
  //===----------------------------------------------------------------------===//
@@ -32430,21 +32435,54 @@ struct TransactionInfo : public ParseInfo {
32430
32435
 
32431
32436
 
32432
32437
 
32438
+
32439
+
32433
32440
  namespace duckdb {
32434
32441
 
32435
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
32442
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
32443
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
32444
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(function.name) {
32445
+ name = function.name;
32446
+ functions.AddFunction(move(function));
32447
+ }
32448
+ CreatePragmaFunctionInfo(string name, PragmaFunctionSet functions_)
32449
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(functions_) {
32450
+ this->name = name;
32451
+ }
32436
32452
 
32437
- struct LoadInfo : public ParseInfo {
32438
- std::string filename;
32439
- LoadType load_type;
32453
+ PragmaFunctionSet functions;
32440
32454
 
32441
32455
  public:
32442
- unique_ptr<LoadInfo> Copy() const {
32443
- auto result = make_unique<LoadInfo>();
32444
- result->filename = filename;
32445
- result->load_type = load_type;
32446
- return result;
32456
+ unique_ptr<CreateInfo> Copy() const override {
32457
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions.name, functions);
32458
+ CopyProperties(*result);
32459
+ return move(result);
32460
+ }
32461
+ };
32462
+
32463
+ } // namespace duckdb
32464
+ //===----------------------------------------------------------------------===//
32465
+ // DuckDB
32466
+ //
32467
+ // duckdb/parser/parsed_data/transaction_info.hpp
32468
+ //
32469
+ //
32470
+ //===----------------------------------------------------------------------===//
32471
+
32472
+
32473
+
32474
+
32475
+
32476
+ namespace duckdb {
32477
+
32478
+ enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
32479
+
32480
+ struct TransactionInfo : public ParseInfo {
32481
+ explicit TransactionInfo(TransactionType type) : type(type) {
32447
32482
  }
32483
+
32484
+ //! The type of transaction statement
32485
+ TransactionType type;
32448
32486
  };
32449
32487
 
32450
32488
  } // namespace duckdb
@@ -32488,7 +32526,7 @@ struct BoundExportData : public ParseInfo {
32488
32526
  //===----------------------------------------------------------------------===//
32489
32527
  // DuckDB
32490
32528
  //
32491
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
32529
+ // duckdb/parser/parsed_data/show_select_info.hpp
32492
32530
  //
32493
32531
  //
32494
32532
  //===----------------------------------------------------------------------===//
@@ -32500,28 +32538,23 @@ struct BoundExportData : public ParseInfo {
32500
32538
 
32501
32539
  namespace duckdb {
32502
32540
 
32503
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
32504
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
32505
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
32506
- name = function.name;
32507
- functions.AddFunction(move(function));
32508
- }
32509
-
32510
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
32511
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
32512
- name = functions.name;
32513
- for (auto &func : functions.functions) {
32514
- func.name = functions.name;
32515
- }
32516
- }
32517
-
32518
- AggregateFunctionSet functions;
32541
+ struct ShowSelectInfo : public ParseInfo {
32542
+ //! Types of projected columns
32543
+ vector<LogicalType> types;
32544
+ //! The QueryNode of select query
32545
+ unique_ptr<QueryNode> query;
32546
+ //! Aliases of projected columns
32547
+ vector<string> aliases;
32548
+ //! Whether or not we are requesting a summary or a describe
32549
+ bool is_summary;
32519
32550
 
32520
- public:
32521
- unique_ptr<CreateInfo> Copy() const override {
32522
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
32523
- CopyProperties(*result);
32524
- return move(result);
32551
+ unique_ptr<ShowSelectInfo> Copy() {
32552
+ auto result = make_unique<ShowSelectInfo>();
32553
+ result->types = types;
32554
+ result->query = query->Copy();
32555
+ result->aliases = aliases;
32556
+ result->is_summary = is_summary;
32557
+ return result;
32525
32558
  }
32526
32559
  };
32527
32560
 
@@ -32529,7 +32562,7 @@ public:
32529
32562
  //===----------------------------------------------------------------------===//
32530
32563
  // DuckDB
32531
32564
  //
32532
- // duckdb/parser/parsed_data/create_macro_info.hpp
32565
+ // duckdb/parser/parsed_data/create_index_info.hpp
32533
32566
  //
32534
32567
  //
32535
32568
  //===----------------------------------------------------------------------===//
@@ -32537,10 +32570,12 @@ public:
32537
32570
 
32538
32571
 
32539
32572
 
32573
+
32574
+
32540
32575
  //===----------------------------------------------------------------------===//
32541
32576
  // DuckDB
32542
32577
  //
32543
- // duckdb/function/macro_function.hpp
32578
+ // duckdb/parser/tableref/basetableref.hpp
32544
32579
  //
32545
32580
  //
32546
32581
  //===----------------------------------------------------------------------===//
@@ -32550,70 +32585,75 @@ public:
32550
32585
 
32551
32586
 
32552
32587
 
32553
-
32554
-
32555
-
32556
-
32557
32588
  namespace duckdb {
32558
-
32559
- enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
32560
-
32561
- class MacroFunction {
32562
- public:
32563
- MacroFunction(MacroType type);
32564
-
32565
- //! The type
32566
- MacroType type;
32567
- //! The positional parameters
32568
- vector<unique_ptr<ParsedExpression>> parameters;
32569
- //! The default parameters and their associated values
32570
- unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
32571
-
32589
+ //! Represents a TableReference to a base table in the schema
32590
+ class BaseTableRef : public TableRef {
32572
32591
  public:
32573
- virtual ~MacroFunction() {
32592
+ BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
32574
32593
  }
32575
32594
 
32576
- void CopyProperties(MacroFunction &other);
32595
+ //! Schema name
32596
+ string schema_name;
32597
+ //! Table name
32598
+ string table_name;
32599
+ //! Aliases for the column names
32600
+ vector<string> column_name_alias;
32577
32601
 
32578
- virtual unique_ptr<MacroFunction> Copy() = 0;
32602
+ public:
32603
+ string ToString() const override;
32604
+ bool Equals(const TableRef *other_p) const override;
32579
32605
 
32580
- static string ValidateArguments(MacroFunction &macro_function, const string &name,
32581
- FunctionExpression &function_expr,
32582
- vector<unique_ptr<ParsedExpression>> &positionals,
32583
- unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
32606
+ unique_ptr<TableRef> Copy() override;
32584
32607
 
32585
- virtual string ToSQL(const string &schema, const string &name);
32608
+ //! Serializes a blob into a BaseTableRef
32609
+ void Serialize(FieldWriter &serializer) const override;
32610
+ //! Deserializes a blob back into a BaseTableRef
32611
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
32586
32612
  };
32587
-
32588
32613
  } // namespace duckdb
32589
32614
 
32590
32615
 
32616
+
32617
+
32591
32618
  namespace duckdb {
32592
32619
 
32593
- struct CreateMacroInfo : public CreateFunctionInfo {
32594
- CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
32620
+ struct CreateIndexInfo : public CreateInfo {
32621
+ CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
32595
32622
  }
32596
32623
 
32597
- CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
32598
- }
32624
+ //! Index Type (e.g., B+-tree, Skip-List, ...)
32625
+ IndexType index_type;
32626
+ //! Name of the Index
32627
+ string index_name;
32628
+ //! Index Constraint Type
32629
+ IndexConstraintType constraint_type;
32630
+ //! The table to create the index on
32631
+ unique_ptr<BaseTableRef> table;
32632
+ //! Set of expressions to index by
32633
+ vector<unique_ptr<ParsedExpression>> expressions;
32634
+ vector<unique_ptr<ParsedExpression>> parsed_expressions;
32599
32635
 
32600
- unique_ptr<MacroFunction> function;
32636
+ //! Types used for the CREATE INDEX scan
32637
+ vector<LogicalType> scan_types;
32638
+ //! The names of the columns, used for the CREATE INDEX scan
32639
+ vector<string> names;
32640
+ //! Column IDs needed for index creation
32641
+ vector<column_t> column_ids;
32642
+
32643
+ protected:
32644
+ void SerializeInternal(Serializer &serializer) const override;
32601
32645
 
32602
32646
  public:
32603
- unique_ptr<CreateInfo> Copy() const override {
32604
- auto result = make_unique<CreateMacroInfo>();
32605
- result->function = function->Copy();
32606
- result->name = name;
32607
- CopyProperties(*result);
32608
- return move(result);
32609
- }
32647
+ unique_ptr<CreateInfo> Copy() const override;
32648
+
32649
+ static unique_ptr<CreateIndexInfo> Deserialize(Deserializer &deserializer);
32610
32650
  };
32611
32651
 
32612
32652
  } // namespace duckdb
32613
32653
  //===----------------------------------------------------------------------===//
32614
32654
  // DuckDB
32615
32655
  //
32616
- // duckdb/parser/parsed_data/create_schema_info.hpp
32656
+ // duckdb/parser/parsed_data/drop_info.hpp
32617
32657
  //
32618
32658
  //
32619
32659
  //===----------------------------------------------------------------------===//
@@ -32622,35 +32662,42 @@ public:
32622
32662
 
32623
32663
 
32624
32664
 
32665
+
32625
32666
  namespace duckdb {
32626
32667
 
32627
- struct CreateSchemaInfo : public CreateInfo {
32628
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
32668
+ struct DropInfo : public ParseInfo {
32669
+ DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
32629
32670
  }
32630
32671
 
32631
- public:
32632
- unique_ptr<CreateInfo> Copy() const override {
32633
- auto result = make_unique<CreateSchemaInfo>();
32634
- CopyProperties(*result);
32635
- return move(result);
32636
- }
32672
+ //! The catalog type to drop
32673
+ CatalogType type;
32674
+ //! Schema name to drop from, if any
32675
+ string schema;
32676
+ //! Element name to drop
32677
+ string name;
32678
+ //! Ignore if the entry does not exist instead of failing
32679
+ bool if_exists = false;
32680
+ //! Cascade drop (drop all dependents instead of throwing an error if there
32681
+ //! are any)
32682
+ bool cascade = false;
32637
32683
 
32638
- static unique_ptr<CreateSchemaInfo> Deserialize(Deserializer &deserializer) {
32639
- auto result = make_unique<CreateSchemaInfo>();
32640
- result->DeserializeBase(deserializer);
32684
+ public:
32685
+ unique_ptr<DropInfo> Copy() const {
32686
+ auto result = make_unique<DropInfo>();
32687
+ result->type = type;
32688
+ result->schema = schema;
32689
+ result->name = name;
32690
+ result->if_exists = if_exists;
32691
+ result->cascade = cascade;
32641
32692
  return result;
32642
32693
  }
32643
-
32644
- protected:
32645
- void SerializeInternal(Serializer &) const override {
32646
- }
32647
32694
  };
32648
32695
 
32649
32696
  } // namespace duckdb
32650
32697
  //===----------------------------------------------------------------------===//
32651
32698
  // DuckDB
32652
32699
  //
32653
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
32700
+ // duckdb/parser/parsed_data/alter_function_info.hpp
32654
32701
  //
32655
32702
  //
32656
32703
  //===----------------------------------------------------------------------===//
@@ -32663,25 +32710,34 @@ protected:
32663
32710
 
32664
32711
  namespace duckdb {
32665
32712
 
32666
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
32667
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
32668
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(function.name) {
32669
- name = function.name;
32670
- functions.AddFunction(move(function));
32671
- }
32672
- CreatePragmaFunctionInfo(string name, PragmaFunctionSet functions_)
32673
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(functions_) {
32674
- this->name = name;
32675
- }
32713
+ //===--------------------------------------------------------------------===//
32714
+ // Alter Table
32715
+ //===--------------------------------------------------------------------===//
32716
+ enum class AlterFunctionType : uint8_t { INVALID = 0, ADD_FUNCTION_OVERLOADS = 1 };
32676
32717
 
32677
- PragmaFunctionSet functions;
32718
+ struct AlterFunctionInfo : public AlterInfo {
32719
+ AlterFunctionInfo(AlterFunctionType type, string schema, string name, bool if_exists);
32720
+ virtual ~AlterFunctionInfo() override;
32721
+
32722
+ AlterFunctionType alter_function_type;
32678
32723
 
32679
32724
  public:
32680
- unique_ptr<CreateInfo> Copy() const override {
32681
- auto result = make_unique<CreatePragmaFunctionInfo>(functions.name, functions);
32682
- CopyProperties(*result);
32683
- return move(result);
32684
- }
32725
+ CatalogType GetCatalogType() const override;
32726
+ void Serialize(FieldWriter &writer) const override;
32727
+ static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
32728
+ };
32729
+
32730
+ //===--------------------------------------------------------------------===//
32731
+ // AddFunctionOverloadInfo
32732
+ //===--------------------------------------------------------------------===//
32733
+ struct AddFunctionOverloadInfo : public AlterFunctionInfo {
32734
+ AddFunctionOverloadInfo(string schema, string name, bool if_exists, ScalarFunctionSet new_overloads);
32735
+ ~AddFunctionOverloadInfo() override;
32736
+
32737
+ ScalarFunctionSet new_overloads;
32738
+
32739
+ public:
32740
+ unique_ptr<AlterInfo> Copy() const override;
32685
32741
  };
32686
32742
 
32687
32743
  } // namespace duckdb
@@ -32790,7 +32846,7 @@ public:
32790
32846
  //===----------------------------------------------------------------------===//
32791
32847
  // DuckDB
32792
32848
  //
32793
- // duckdb/parser/parsed_data/drop_info.hpp
32849
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
32794
32850
  //
32795
32851
  //
32796
32852
  //===----------------------------------------------------------------------===//
@@ -32802,31 +32858,28 @@ public:
32802
32858
 
32803
32859
  namespace duckdb {
32804
32860
 
32805
- struct DropInfo : public ParseInfo {
32806
- DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
32861
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
32862
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
32863
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
32864
+ name = function.name;
32865
+ functions.AddFunction(move(function));
32807
32866
  }
32808
32867
 
32809
- //! The catalog type to drop
32810
- CatalogType type;
32811
- //! Schema name to drop from, if any
32812
- string schema;
32813
- //! Element name to drop
32814
- string name;
32815
- //! Ignore if the entry does not exist instead of failing
32816
- bool if_exists = false;
32817
- //! Cascade drop (drop all dependents instead of throwing an error if there
32818
- //! are any)
32819
- bool cascade = false;
32868
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
32869
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
32870
+ name = functions.name;
32871
+ for (auto &func : functions.functions) {
32872
+ func.name = functions.name;
32873
+ }
32874
+ }
32875
+
32876
+ AggregateFunctionSet functions;
32820
32877
 
32821
32878
  public:
32822
- unique_ptr<DropInfo> Copy() const {
32823
- auto result = make_unique<DropInfo>();
32824
- result->type = type;
32825
- result->schema = schema;
32826
- result->name = name;
32827
- result->if_exists = if_exists;
32828
- result->cascade = cascade;
32829
- return result;
32879
+ unique_ptr<CreateInfo> Copy() const override {
32880
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
32881
+ CopyProperties(*result);
32882
+ return move(result);
32830
32883
  }
32831
32884
  };
32832
32885
 
@@ -32834,7 +32887,7 @@ public:
32834
32887
  //===----------------------------------------------------------------------===//
32835
32888
  // DuckDB
32836
32889
  //
32837
- // duckdb/parser/parsed_data/create_type_info.hpp
32890
+ // duckdb/parser/tableref/crossproductref.hpp
32838
32891
  //
32839
32892
  //
32840
32893
  //===----------------------------------------------------------------------===//
@@ -32843,43 +32896,29 @@ public:
32843
32896
 
32844
32897
 
32845
32898
 
32846
-
32847
-
32848
-
32849
32899
  namespace duckdb {
32850
-
32851
- struct CreateTypeInfo : public CreateInfo {
32852
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
32853
- }
32854
- CreateTypeInfo(string name_p, LogicalType type_p)
32855
- : CreateInfo(CatalogType::TYPE_ENTRY), name(move(name_p)), type(move(type_p)) {
32900
+ //! Represents a cross product
32901
+ class CrossProductRef : public TableRef {
32902
+ public:
32903
+ CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
32856
32904
  }
32857
32905
 
32858
- //! Name of the Type
32859
- string name;
32860
- //! Logical Type
32861
- LogicalType type;
32862
- //! Used by create enum from query
32863
- unique_ptr<SQLStatement> query;
32906
+ //! The left hand side of the cross product
32907
+ unique_ptr<TableRef> left;
32908
+ //! The right hand side of the cross product
32909
+ unique_ptr<TableRef> right;
32864
32910
 
32865
32911
  public:
32866
- unique_ptr<CreateInfo> Copy() const override {
32867
- auto result = make_unique<CreateTypeInfo>();
32868
- CopyProperties(*result);
32869
- result->name = name;
32870
- result->type = type;
32871
- if (query) {
32872
- result->query = query->Copy();
32873
- }
32874
- return move(result);
32875
- }
32912
+ string ToString() const override;
32913
+ bool Equals(const TableRef *other_p) const override;
32876
32914
 
32877
- protected:
32878
- void SerializeInternal(Serializer &) const override {
32879
- throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(CreateInfo::type));
32880
- }
32881
- };
32915
+ unique_ptr<TableRef> Copy() override;
32882
32916
 
32917
+ //! Serializes a blob into a CrossProductRef
32918
+ void Serialize(FieldWriter &serializer) const override;
32919
+ //! Deserializes a blob back into a CrossProductRef
32920
+ static unique_ptr<TableRef> Deserialize(FieldReader &source);
32921
+ };
32883
32922
  } // namespace duckdb
32884
32923
  //===----------------------------------------------------------------------===//
32885
32924
  // DuckDB
@@ -32925,11 +32964,10 @@ public:
32925
32964
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
32926
32965
  };
32927
32966
  } // namespace duckdb
32928
-
32929
32967
  //===----------------------------------------------------------------------===//
32930
32968
  // DuckDB
32931
32969
  //
32932
- // duckdb/parser/tableref/crossproductref.hpp
32970
+ // duckdb/parser/tableref/joinref.hpp
32933
32971
  //
32934
32972
  //
32935
32973
  //===----------------------------------------------------------------------===//
@@ -32938,63 +32976,42 @@ public:
32938
32976
 
32939
32977
 
32940
32978
 
32941
- namespace duckdb {
32942
- //! Represents a cross product
32943
- class CrossProductRef : public TableRef {
32944
- public:
32945
- CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
32946
- }
32947
-
32948
- //! The left hand side of the cross product
32949
- unique_ptr<TableRef> left;
32950
- //! The right hand side of the cross product
32951
- unique_ptr<TableRef> right;
32952
-
32953
- public:
32954
- string ToString() const override;
32955
- bool Equals(const TableRef *other_p) const override;
32956
-
32957
- unique_ptr<TableRef> Copy() override;
32958
-
32959
- //! Serializes a blob into a CrossProductRef
32960
- void Serialize(FieldWriter &serializer) const override;
32961
- //! Deserializes a blob back into a CrossProductRef
32962
- static unique_ptr<TableRef> Deserialize(FieldReader &source);
32963
- };
32964
- } // namespace duckdb
32965
-
32966
- //===----------------------------------------------------------------------===//
32967
- // DuckDB
32968
- //
32969
- // duckdb/parser/tableref/emptytableref.hpp
32970
- //
32971
- //
32972
- //===----------------------------------------------------------------------===//
32973
-
32974
32979
 
32975
32980
 
32976
32981
 
32977
32982
 
32978
32983
  namespace duckdb {
32979
- //! Represents a cross product
32980
- class EmptyTableRef : public TableRef {
32984
+ //! Represents a JOIN between two expressions
32985
+ class JoinRef : public TableRef {
32981
32986
  public:
32982
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
32987
+ JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
32983
32988
  }
32984
32989
 
32990
+ //! The left hand side of the join
32991
+ unique_ptr<TableRef> left;
32992
+ //! The right hand side of the join
32993
+ unique_ptr<TableRef> right;
32994
+ //! The join condition
32995
+ unique_ptr<ParsedExpression> condition;
32996
+ //! The join type
32997
+ JoinType type;
32998
+ //! Natural join
32999
+ bool is_natural;
33000
+ //! The set of USING columns (if any)
33001
+ vector<string> using_columns;
33002
+
32985
33003
  public:
32986
33004
  string ToString() const override;
32987
33005
  bool Equals(const TableRef *other_p) const override;
32988
33006
 
32989
33007
  unique_ptr<TableRef> Copy() override;
32990
33008
 
32991
- //! Serializes a blob into a DummyTableRef
33009
+ //! Serializes a blob into a JoinRef
32992
33010
  void Serialize(FieldWriter &serializer) const override;
32993
- //! Deserializes a blob back into a DummyTableRef
33011
+ //! Deserializes a blob back into a JoinRef
32994
33012
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
32995
33013
  };
32996
33014
  } // namespace duckdb
32997
-
32998
33015
  //===----------------------------------------------------------------------===//
32999
33016
  // DuckDB
33000
33017
  //
@@ -33036,11 +33053,10 @@ public:
33036
33053
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
33037
33054
  };
33038
33055
  } // namespace duckdb
33039
-
33040
33056
  //===----------------------------------------------------------------------===//
33041
33057
  // DuckDB
33042
33058
  //
33043
- // duckdb/parser/tableref/joinref.hpp
33059
+ // duckdb/parser/tableref/subqueryref.hpp
33044
33060
  //
33045
33061
  //
33046
33062
  //===----------------------------------------------------------------------===//
@@ -33050,28 +33066,16 @@ public:
33050
33066
 
33051
33067
 
33052
33068
 
33053
-
33054
-
33055
-
33056
33069
  namespace duckdb {
33057
- //! Represents a JOIN between two expressions
33058
- class JoinRef : public TableRef {
33070
+ //! Represents a subquery
33071
+ class SubqueryRef : public TableRef {
33059
33072
  public:
33060
- JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
33061
- }
33073
+ explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
33062
33074
 
33063
- //! The left hand side of the join
33064
- unique_ptr<TableRef> left;
33065
- //! The right hand side of the join
33066
- unique_ptr<TableRef> right;
33067
- //! The join condition
33068
- unique_ptr<ParsedExpression> condition;
33069
- //! The join type
33070
- JoinType type;
33071
- //! Natural join
33072
- bool is_natural;
33073
- //! The set of USING columns (if any)
33074
- vector<string> using_columns;
33075
+ //! The subquery
33076
+ unique_ptr<SelectStatement> subquery;
33077
+ //! Aliases for the column names
33078
+ vector<string> column_name_alias;
33075
33079
 
33076
33080
  public:
33077
33081
  string ToString() const override;
@@ -33079,17 +33083,18 @@ public:
33079
33083
 
33080
33084
  unique_ptr<TableRef> Copy() override;
33081
33085
 
33082
- //! Serializes a blob into a JoinRef
33086
+ //! Serializes a blob into a SubqueryRef
33083
33087
  void Serialize(FieldWriter &serializer) const override;
33084
- //! Deserializes a blob back into a JoinRef
33088
+ //! Deserializes a blob back into a SubqueryRef
33085
33089
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
33086
33090
  };
33087
33091
  } // namespace duckdb
33088
33092
 
33093
+
33089
33094
  //===----------------------------------------------------------------------===//
33090
33095
  // DuckDB
33091
33096
  //
33092
- // duckdb/parser/tableref/subqueryref.hpp
33097
+ // duckdb/parser/tableref/emptytableref.hpp
33093
33098
  //
33094
33099
  //
33095
33100
  //===----------------------------------------------------------------------===//
@@ -33098,17 +33103,12 @@ public:
33098
33103
 
33099
33104
 
33100
33105
 
33101
-
33102
33106
  namespace duckdb {
33103
- //! Represents a subquery
33104
- class SubqueryRef : public TableRef {
33107
+ //! Represents a cross product
33108
+ class EmptyTableRef : public TableRef {
33105
33109
  public:
33106
- explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
33107
-
33108
- //! The subquery
33109
- unique_ptr<SelectStatement> subquery;
33110
- //! Aliases for the column names
33111
- vector<string> column_name_alias;
33110
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
33111
+ }
33112
33112
 
33113
33113
  public:
33114
33114
  string ToString() const override;
@@ -33116,11 +33116,14 @@ public:
33116
33116
 
33117
33117
  unique_ptr<TableRef> Copy() override;
33118
33118
 
33119
- //! Serializes a blob into a SubqueryRef
33119
+ //! Serializes a blob into a DummyTableRef
33120
33120
  void Serialize(FieldWriter &serializer) const override;
33121
- //! Deserializes a blob back into a SubqueryRef
33121
+ //! Deserializes a blob back into a DummyTableRef
33122
33122
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
33123
33123
  };
33124
33124
  } // namespace duckdb
33125
33125
 
33126
33126
 
33127
+
33128
+
33129
+