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