duckdb 0.3.5-dev16.0 → 0.3.5-dev167.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "67c1e0ee0"
15
- #define DUCKDB_VERSION "v0.3.5-dev16"
14
+ #define DUCKDB_SOURCE_ID "0a6b26232"
15
+ #define DUCKDB_VERSION "v0.3.5-dev167"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -2882,6 +2882,8 @@ public:
2882
2882
  //! Returns true if the values are (approximately) equivalent. Note this is NOT the SQL equivalence. For this
2883
2883
  //! function, NULL values are equivalent and floating point values that are close are equivalent.
2884
2884
  DUCKDB_API static bool ValuesAreEqual(const Value &result_value, const Value &value);
2885
+ //! Returns true if the values are not distinct from each other, following SQL semantics for NOT DISTINCT FROM.
2886
+ DUCKDB_API static bool NotDistinctFrom(const Value &lvalue, const Value &rvalue);
2885
2887
 
2886
2888
  friend std::ostream &operator<<(std::ostream &out, const Value &val) {
2887
2889
  out << val.ToString();
@@ -3094,6 +3096,8 @@ template <>
3094
3096
  DUCKDB_API timestamp_t Value::GetValue() const;
3095
3097
  template <>
3096
3098
  DUCKDB_API interval_t Value::GetValue() const;
3099
+ template <>
3100
+ DUCKDB_API Value Value::GetValue() const;
3097
3101
 
3098
3102
  template <>
3099
3103
  DUCKDB_API bool Value::GetValueUnsafe() const;
@@ -6137,7 +6141,7 @@ public:
6137
6141
  static bool RequiresQuotes(const string &text);
6138
6142
 
6139
6143
  //! Writes a string that is optionally quoted + escaped so it can be used as an identifier
6140
- static string WriteOptionallyQuoted(const string &text);
6144
+ static string WriteOptionallyQuoted(const string &text, char quote = '"');
6141
6145
  };
6142
6146
 
6143
6147
  } // namespace duckdb
@@ -6390,14 +6394,19 @@ struct PragmaInfo;
6390
6394
  struct FunctionData {
6391
6395
  DUCKDB_API virtual ~FunctionData();
6392
6396
 
6393
- DUCKDB_API virtual unique_ptr<FunctionData> Copy();
6394
- DUCKDB_API virtual bool Equals(FunctionData &other);
6395
- DUCKDB_API static bool Equals(FunctionData *left, FunctionData *right);
6397
+ DUCKDB_API virtual unique_ptr<FunctionData> Copy() const = 0;
6398
+ DUCKDB_API virtual bool Equals(const FunctionData &other) const = 0;
6399
+ DUCKDB_API static bool Equals(const FunctionData *left, const FunctionData *right);
6396
6400
  };
6397
6401
 
6398
6402
  struct TableFunctionData : public FunctionData {
6399
6403
  // used to pass on projections to table functions that support them. NB, can contain COLUMN_IDENTIFIER_ROW_ID
6400
6404
  vector<idx_t> column_ids;
6405
+
6406
+ DUCKDB_API virtual ~TableFunctionData();
6407
+
6408
+ DUCKDB_API unique_ptr<FunctionData> Copy() const override;
6409
+ DUCKDB_API bool Equals(const FunctionData &other) const override;
6401
6410
  };
6402
6411
 
6403
6412
  struct FunctionParameters {
@@ -6477,10 +6486,6 @@ public:
6477
6486
  public:
6478
6487
  DUCKDB_API string ToString() override;
6479
6488
  DUCKDB_API bool HasNamedParameters();
6480
-
6481
- DUCKDB_API void EvaluateInputParameters(vector<LogicalType> &arguments, vector<Value> &parameters,
6482
- named_parameter_map_t &named_parameters,
6483
- vector<unique_ptr<ParsedExpression>> &children);
6484
6489
  };
6485
6490
 
6486
6491
  class BaseScalarFunction : public SimpleFunction {
@@ -6574,6 +6579,7 @@ namespace duckdb {
6574
6579
  class Expression;
6575
6580
  class ExpressionExecutor;
6576
6581
  struct ExpressionExecutorState;
6582
+ struct FunctionLocalState;
6577
6583
 
6578
6584
  struct ExpressionState {
6579
6585
  ExpressionState(const Expression &expr, ExpressionExecutorState &root);
@@ -6594,13 +6600,13 @@ public:
6594
6600
  };
6595
6601
 
6596
6602
  struct ExecuteFunctionState : public ExpressionState {
6597
- ExecuteFunctionState(const Expression &expr, ExpressionExecutorState &root) : ExpressionState(expr, root) {
6598
- }
6603
+ ExecuteFunctionState(const Expression &expr, ExpressionExecutorState &root);
6604
+ ~ExecuteFunctionState();
6599
6605
 
6600
- unique_ptr<FunctionData> local_state;
6606
+ unique_ptr<FunctionLocalState> local_state;
6601
6607
 
6602
6608
  public:
6603
- static FunctionData *GetFunctionState(ExpressionState &state) {
6609
+ static FunctionLocalState *GetFunctionState(ExpressionState &state) {
6604
6610
  return ((ExecuteFunctionState &)state).local_state.get();
6605
6611
  }
6606
6612
  };
@@ -7235,6 +7241,11 @@ public:
7235
7241
 
7236
7242
 
7237
7243
  namespace duckdb {
7244
+
7245
+ struct FunctionLocalState {
7246
+ DUCKDB_API virtual ~FunctionLocalState();
7247
+ };
7248
+
7238
7249
  class BoundFunctionExpression;
7239
7250
  class ScalarFunctionCatalogEntry;
7240
7251
 
@@ -7243,7 +7254,8 @@ typedef std::function<void(DataChunk &, ExpressionState &, Vector &)> scalar_fun
7243
7254
  //! Binds the scalar function and creates the function data
7244
7255
  typedef unique_ptr<FunctionData> (*bind_scalar_function_t)(ClientContext &context, ScalarFunction &bound_function,
7245
7256
  vector<unique_ptr<Expression>> &arguments);
7246
- typedef unique_ptr<FunctionData> (*init_local_state_t)(const BoundFunctionExpression &expr, FunctionData *bind_data);
7257
+ typedef unique_ptr<FunctionLocalState> (*init_local_state_t)(const BoundFunctionExpression &expr,
7258
+ FunctionData *bind_data);
7247
7259
  typedef unique_ptr<BaseStatistics> (*function_statistics_t)(ClientContext &context, BoundFunctionExpression &expr,
7248
7260
  FunctionData *bind_data,
7249
7261
  vector<unique_ptr<BaseStatistics>> &child_stats);
@@ -7716,13 +7728,13 @@ public:
7716
7728
  }
7717
7729
 
7718
7730
  template <class STATE_TYPE, class OP>
7719
- static void Combine(Vector &source, Vector &target, idx_t count) {
7731
+ static void Combine(Vector &source, Vector &target, FunctionData *bind_data, idx_t count) {
7720
7732
  D_ASSERT(source.GetType().id() == LogicalTypeId::POINTER && target.GetType().id() == LogicalTypeId::POINTER);
7721
7733
  auto sdata = FlatVector::GetData<const STATE_TYPE *>(source);
7722
7734
  auto tdata = FlatVector::GetData<STATE_TYPE *>(target);
7723
7735
 
7724
7736
  for (idx_t i = 0; i < count; i++) {
7725
- OP::template Combine<STATE_TYPE, OP>(*sdata[i], tdata[i]);
7737
+ OP::template Combine<STATE_TYPE, OP>(*sdata[i], tdata[i], bind_data);
7726
7738
  }
7727
7739
  }
7728
7740
 
@@ -8953,8 +8965,8 @@ typedef void (*aggregate_initialize_t)(data_ptr_t state);
8953
8965
  //! The type used for updating hashed aggregate functions
8954
8966
  typedef void (*aggregate_update_t)(Vector inputs[], FunctionData *bind_data, idx_t input_count, Vector &state,
8955
8967
  idx_t count);
8956
- //! The type used for combining hashed aggregate states (optional)
8957
- typedef void (*aggregate_combine_t)(Vector &state, Vector &combined, idx_t count);
8968
+ //! The type used for combining hashed aggregate states
8969
+ typedef void (*aggregate_combine_t)(Vector &state, Vector &combined, FunctionData *bind_data, idx_t count);
8958
8970
  //! The type used for finalizing hashed aggregate function payloads
8959
8971
  typedef void (*aggregate_finalize_t)(Vector &state, FunctionData *bind_data, Vector &result, idx_t count, idx_t offset);
8960
8972
  //! The type used for propagating statistics in aggregate functions (optional)
@@ -9164,8 +9176,8 @@ public:
9164
9176
  }
9165
9177
 
9166
9178
  template <class STATE, class OP>
9167
- static void StateCombine(Vector &source, Vector &target, idx_t count) {
9168
- AggregateExecutor::Combine<STATE, OP>(source, target, count);
9179
+ static void StateCombine(Vector &source, Vector &target, FunctionData *bind_data, idx_t count) {
9180
+ AggregateExecutor::Combine<STATE, OP>(source, target, bind_data, count);
9169
9181
  }
9170
9182
 
9171
9183
  template <class STATE, class RESULT_TYPE, class OP>
@@ -13781,6 +13793,7 @@ public:
13781
13793
 
13782
13794
 
13783
13795
  namespace duckdb {
13796
+
13784
13797
  //! SQLStatement is the base class of any type of SQL statement.
13785
13798
  class SQLStatement {
13786
13799
  public:
@@ -13803,6 +13816,9 @@ protected:
13803
13816
  SQLStatement(const SQLStatement &other) = default;
13804
13817
 
13805
13818
  public:
13819
+ virtual string ToString() const {
13820
+ throw InternalException("ToString not supported for this type of SQLStatement");
13821
+ }
13806
13822
  //! Create a copy of this SelectStatement
13807
13823
  virtual unique_ptr<SQLStatement> Copy() const = 0;
13808
13824
  };
@@ -13907,7 +13923,9 @@ public:
13907
13923
 
13908
13924
  public:
13909
13925
  //! Convert the object to a string
13910
- virtual string ToString() const;
13926
+ virtual string ToString() const = 0;
13927
+ string BaseToString(string result) const;
13928
+ string BaseToString(string result, const vector<string> &column_name_alias) const;
13911
13929
  void Print();
13912
13930
 
13913
13931
  virtual bool Equals(const TableRef *other) const;
@@ -13944,6 +13962,8 @@ protected:
13944
13962
  SelectStatement(const SelectStatement &other);
13945
13963
 
13946
13964
  public:
13965
+ //! Convert the SELECT statement to a string
13966
+ string ToString() const override;
13947
13967
  //! Create a copy of this SelectStatement
13948
13968
  unique_ptr<SQLStatement> Copy() const override;
13949
13969
  //! Serializes a SelectStatement to a stand-alone binary blob
@@ -13995,6 +14015,9 @@ public:
13995
14015
  virtual const vector<unique_ptr<ParsedExpression>> &GetSelectList() const = 0;
13996
14016
 
13997
14017
  public:
14018
+ //! Convert the query node to a string
14019
+ virtual string ToString() const = 0;
14020
+
13998
14021
  virtual bool Equals(const QueryNode *other) const;
13999
14022
 
14000
14023
  //! Create a copy of this QueryNode
@@ -14006,6 +14029,9 @@ public:
14006
14029
  //! Deserializes a blob back into a QueryNode
14007
14030
  DUCKDB_API static unique_ptr<QueryNode> Deserialize(Deserializer &source);
14008
14031
 
14032
+ string CTEToString() const;
14033
+ string ResultModifiersToString() const;
14034
+
14009
14035
  protected:
14010
14036
  //! Copy base QueryNode properties from another expression to this one,
14011
14037
  //! used in Copy method
@@ -17214,6 +17240,27 @@ public:
17214
17240
 
17215
17241
  } // namespace duckdb
17216
17242
 
17243
+ //===----------------------------------------------------------------------===//
17244
+ // DuckDB
17245
+ //
17246
+ // duckdb/main/external_dependencies.hpp
17247
+ //
17248
+ //
17249
+ //===----------------------------------------------------------------------===//
17250
+
17251
+
17252
+
17253
+ namespace duckdb {
17254
+
17255
+ enum ExternalDependenciesType { PYTHON_DEPENDENCY };
17256
+ class ExternalDependency {
17257
+ public:
17258
+ explicit ExternalDependency(ExternalDependenciesType type_p) : type(type_p) {};
17259
+ virtual ~ExternalDependency() {};
17260
+ ExternalDependenciesType type;
17261
+ };
17262
+
17263
+ } // namespace duckdb
17217
17264
 
17218
17265
  namespace duckdb {
17219
17266
  class Appender;
@@ -17255,6 +17302,8 @@ public:
17255
17302
  TransactionContext transaction;
17256
17303
  //! Whether or not the query is interrupted
17257
17304
  atomic<bool> interrupted;
17305
+ //! External Objects (e.g., Python objects) that views depend of
17306
+ unordered_map<string, vector<shared_ptr<ExternalDependency>>> external_dependencies;
17258
17307
 
17259
17308
  unique_ptr<SchemaCatalogEntry> temporary_objects;
17260
17309
  unordered_map<string, shared_ptr<PreparedStatementData>> prepared_statements;
@@ -17472,6 +17521,7 @@ private:
17472
17521
  } // namespace duckdb
17473
17522
 
17474
17523
 
17524
+
17475
17525
  #include <memory>
17476
17526
 
17477
17527
  namespace duckdb {
@@ -17483,8 +17533,6 @@ class LogicalOperator;
17483
17533
  class QueryNode;
17484
17534
  class TableRef;
17485
17535
 
17486
- class ExtraDependencies {};
17487
-
17488
17536
  class Relation : public std::enable_shared_from_this<Relation> {
17489
17537
  public:
17490
17538
  DUCKDB_API Relation(const std::shared_ptr<ClientContext> &context, RelationType type)
@@ -17499,7 +17547,7 @@ public:
17499
17547
 
17500
17548
  RelationType type;
17501
17549
 
17502
- unique_ptr<ExtraDependencies> extra_dependencies;
17550
+ shared_ptr<ExternalDependency> extra_dependencies;
17503
17551
 
17504
17552
  public:
17505
17553
  DUCKDB_API virtual const vector<ColumnDefinition> &Columns() = 0;
@@ -17599,6 +17647,7 @@ public:
17599
17647
  DUCKDB_API virtual Relation *ChildRelation() {
17600
17648
  return nullptr;
17601
17649
  }
17650
+ DUCKDB_API vector<shared_ptr<ExternalDependency>> GetAllDependencies();
17602
17651
 
17603
17652
  protected:
17604
17653
  DUCKDB_API string RenderWhitespace(idx_t depth);
@@ -21882,6 +21931,8 @@ public:
21882
21931
 
21883
21932
 
21884
21933
 
21934
+ #include <algorithm>
21935
+
21885
21936
  namespace duckdb {
21886
21937
 
21887
21938
  enum class StrTimeSpecifier : uint8_t {
@@ -21929,7 +21980,11 @@ public:
21929
21980
  virtual ~StrTimeFormat() {
21930
21981
  }
21931
21982
 
21932
- static string ParseFormatSpecifier(const string &format_string, StrTimeFormat &format);
21983
+ DUCKDB_API static string ParseFormatSpecifier(const string &format_string, StrTimeFormat &format);
21984
+
21985
+ inline bool HasFormatSpecifier(StrTimeSpecifier s) const {
21986
+ return std::find(specifiers.begin(), specifiers.end(), s) != specifiers.end();
21987
+ }
21933
21988
 
21934
21989
  protected:
21935
21990
  //! The format specifiers
@@ -21945,13 +22000,13 @@ protected:
21945
22000
 
21946
22001
  protected:
21947
22002
  void AddLiteral(string literal);
21948
- virtual void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier);
22003
+ DUCKDB_API virtual void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier);
21949
22004
  };
21950
22005
 
21951
22006
  struct StrfTimeFormat : public StrTimeFormat {
21952
- idx_t GetLength(date_t date, dtime_t time);
22007
+ DUCKDB_API idx_t GetLength(date_t date, dtime_t time, int32_t utc_offset, const char *tz_name);
21953
22008
 
21954
- void FormatString(date_t date, int32_t data[7], char *target);
22009
+ DUCKDB_API void FormatString(date_t date, int32_t data[8], const char *tz_name, char *target);
21955
22010
  void FormatString(date_t date, dtime_t time, char *target);
21956
22011
 
21957
22012
  DUCKDB_API static string Format(timestamp_t timestamp, const string &format);
@@ -21964,8 +22019,9 @@ protected:
21964
22019
  vector<bool> is_date_specifier;
21965
22020
 
21966
22021
  protected:
21967
- void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
21968
- static idx_t GetSpecifierLength(StrTimeSpecifier specifier, date_t date, dtime_t time);
22022
+ DUCKDB_API void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
22023
+ static idx_t GetSpecifierLength(StrTimeSpecifier specifier, date_t date, dtime_t time, int32_t utc_offset,
22024
+ const char *tz_name);
21969
22025
  char *WriteString(char *target, const string_t &str);
21970
22026
  char *Write2(char *target, uint8_t value);
21971
22027
  char *WritePadded2(char *target, uint32_t value);
@@ -21973,20 +22029,21 @@ protected:
21973
22029
  char *WritePadded(char *target, uint32_t value, size_t padding);
21974
22030
  bool IsDateSpecifier(StrTimeSpecifier specifier);
21975
22031
  char *WriteDateSpecifier(StrTimeSpecifier specifier, date_t date, char *target);
21976
- char *WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t data[], char *target);
22032
+ char *WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t data[], const char *tz_name, char *target);
21977
22033
  };
21978
22034
 
21979
22035
  struct StrpTimeFormat : public StrTimeFormat {
21980
22036
  public:
21981
22037
  //! Type-safe parsing argument
21982
22038
  struct ParseResult {
21983
- int32_t data[7];
22039
+ int32_t data[8]; // year, month, day, hour, min, sec, µs, offset
22040
+ string tz;
21984
22041
  string error_message;
21985
22042
  idx_t error_position = DConstants::INVALID_INDEX;
21986
22043
 
21987
22044
  date_t ToDate();
21988
22045
  timestamp_t ToTimestamp();
21989
- string FormatError(string_t input, const string &format_specifier);
22046
+ DUCKDB_API string FormatError(string_t input, const string &format_specifier);
21990
22047
  };
21991
22048
 
21992
22049
  public:
@@ -21996,7 +22053,7 @@ public:
21996
22053
  public:
21997
22054
  DUCKDB_API static ParseResult Parse(const string &format, const string &text);
21998
22055
 
21999
- bool Parse(string_t str, ParseResult &result);
22056
+ DUCKDB_API bool Parse(string_t str, ParseResult &result);
22000
22057
 
22001
22058
  bool TryParseDate(string_t str, date_t &result, string &error_message);
22002
22059
  bool TryParseTimestamp(string_t str, timestamp_t &result, string &error_message);
@@ -22006,7 +22063,7 @@ public:
22006
22063
 
22007
22064
  protected:
22008
22065
  static string FormatStrpTimeError(const string &input, idx_t position);
22009
- void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
22066
+ DUCKDB_API void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
22010
22067
  int NumericSpecifierWidth(StrTimeSpecifier specifier);
22011
22068
  int32_t TryParseCollection(const char *data, idx_t &pos, idx_t size, const string_t collection[],
22012
22069
  idx_t collection_count);
@@ -22080,6 +22137,8 @@ struct BufferedCSVReaderOptions {
22080
22137
  bool has_header = false;
22081
22138
  //! Whether or not the file has a header line
22082
22139
  bool header = false;
22140
+ //! Whether or not we should ignore InvalidInput errors
22141
+ bool ignore_errors = false;
22083
22142
  //! Whether or not header names shall be normalized
22084
22143
  bool normalize_names = false;
22085
22144
  //! How many leading rows to skip
@@ -22232,6 +22291,10 @@ private:
22232
22291
  const vector<LogicalType> &requested_types,
22233
22292
  vector<vector<LogicalType>> &best_sql_types_candidates,
22234
22293
  map<LogicalTypeId, vector<string>> &best_format_candidates);
22294
+
22295
+ private:
22296
+ //! Whether or not the current row's columns have overflown sql_types.size()
22297
+ bool error_column_overflow = false;
22235
22298
  };
22236
22299
 
22237
22300
  } // namespace duckdb
@@ -22421,7 +22484,7 @@ public:
22421
22484
  //===----------------------------------------------------------------------===//
22422
22485
  // DuckDB
22423
22486
  //
22424
- // duckdb/parser/expression/collate_expression.hpp
22487
+ // duckdb/parser/expression/star_expression.hpp
22425
22488
  //
22426
22489
  //
22427
22490
  //===----------------------------------------------------------------------===//
@@ -22430,22 +22493,25 @@ public:
22430
22493
 
22431
22494
 
22432
22495
 
22496
+
22433
22497
  namespace duckdb {
22434
22498
 
22435
- //! CollateExpression represents a COLLATE statement
22436
- class CollateExpression : public ParsedExpression {
22499
+ //! Represents a * expression in the SELECT clause
22500
+ class StarExpression : public ParsedExpression {
22437
22501
  public:
22438
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
22502
+ StarExpression(string relation_name = string());
22439
22503
 
22440
- //! The child of the cast expression
22441
- unique_ptr<ParsedExpression> child;
22442
- //! The collation clause
22443
- string collation;
22504
+ //! The relation name in case of tbl.*, or empty if this is a normal *
22505
+ string relation_name;
22506
+ //! List of columns to exclude from the STAR expression
22507
+ case_insensitive_set_t exclude_list;
22508
+ //! List of columns to replace with another expression
22509
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
22444
22510
 
22445
22511
  public:
22446
22512
  string ToString() const override;
22447
22513
 
22448
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
22514
+ static bool Equals(const StarExpression *a, const StarExpression *b);
22449
22515
 
22450
22516
  unique_ptr<ParsedExpression> Copy() const override;
22451
22517
 
@@ -22456,7 +22522,7 @@ public:
22456
22522
  //===----------------------------------------------------------------------===//
22457
22523
  // DuckDB
22458
22524
  //
22459
- // duckdb/parser/expression/between_expression.hpp
22525
+ // duckdb/parser/expression/default_expression.hpp
22460
22526
  //
22461
22527
  //
22462
22528
  //===----------------------------------------------------------------------===//
@@ -22466,39 +22532,28 @@ public:
22466
22532
 
22467
22533
 
22468
22534
  namespace duckdb {
22469
-
22470
- class BetweenExpression : public ParsedExpression {
22535
+ //! Represents the default value of a column
22536
+ class DefaultExpression : public ParsedExpression {
22471
22537
  public:
22472
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22473
- unique_ptr<ParsedExpression> upper);
22474
-
22475
- unique_ptr<ParsedExpression> input;
22476
- unique_ptr<ParsedExpression> lower;
22477
- unique_ptr<ParsedExpression> upper;
22538
+ DefaultExpression();
22478
22539
 
22479
22540
  public:
22480
- string ToString() const override;
22541
+ bool IsScalar() const override {
22542
+ return false;
22543
+ }
22481
22544
 
22482
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22545
+ string ToString() const override;
22483
22546
 
22484
22547
  unique_ptr<ParsedExpression> Copy() const override;
22485
22548
 
22486
22549
  void Serialize(FieldWriter &writer) const override;
22487
22550
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22488
-
22489
- public:
22490
- template <class T, class BASE>
22491
- static string ToString(const T &entry) {
22492
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22493
- }
22494
22551
  };
22495
22552
  } // namespace duckdb
22496
-
22497
-
22498
22553
  //===----------------------------------------------------------------------===//
22499
22554
  // DuckDB
22500
22555
  //
22501
- // duckdb/parser/expression/case_expression.hpp
22556
+ // duckdb/parser/expression/operator_expression.hpp
22502
22557
  //
22503
22558
  //
22504
22559
  //===----------------------------------------------------------------------===//
@@ -22508,25 +22563,22 @@ public:
22508
22563
 
22509
22564
 
22510
22565
 
22511
- namespace duckdb {
22512
22566
 
22513
- struct CaseCheck {
22514
- unique_ptr<ParsedExpression> when_expr;
22515
- unique_ptr<ParsedExpression> then_expr;
22516
- };
22517
22567
 
22518
- //! The CaseExpression represents a CASE expression in the query
22519
- class CaseExpression : public ParsedExpression {
22568
+ namespace duckdb {
22569
+ //! Represents a built-in operator expression
22570
+ class OperatorExpression : public ParsedExpression {
22520
22571
  public:
22521
- DUCKDB_API CaseExpression();
22572
+ DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
22573
+ unique_ptr<ParsedExpression> right = nullptr);
22574
+ DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22522
22575
 
22523
- vector<CaseCheck> case_checks;
22524
- unique_ptr<ParsedExpression> else_expr;
22576
+ vector<unique_ptr<ParsedExpression>> children;
22525
22577
 
22526
22578
  public:
22527
22579
  string ToString() const override;
22528
22580
 
22529
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
22581
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
22530
22582
 
22531
22583
  unique_ptr<ParsedExpression> Copy() const override;
22532
22584
 
@@ -22536,22 +22588,72 @@ public:
22536
22588
  public:
22537
22589
  template <class T, class BASE>
22538
22590
  static string ToString(const T &entry) {
22539
- string case_str = "CASE ";
22540
- for (auto &check : entry.case_checks) {
22541
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
22542
- case_str += " THEN (" + check.then_expr->ToString() + ")";
22591
+ auto op = ExpressionTypeToOperator(entry.type);
22592
+ if (!op.empty()) {
22593
+ // use the operator string to represent the operator
22594
+ D_ASSERT(entry.children.size() == 2);
22595
+ return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
22596
+ }
22597
+ switch (entry.type) {
22598
+ case ExpressionType::COMPARE_IN:
22599
+ case ExpressionType::COMPARE_NOT_IN: {
22600
+ string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
22601
+ string in_child = entry.children[0]->ToString();
22602
+ string child_list = "(";
22603
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22604
+ if (i > 1) {
22605
+ child_list += ", ";
22606
+ }
22607
+ child_list += entry.children[i]->ToString();
22608
+ }
22609
+ child_list += ")";
22610
+ return "(" + in_child + op_type + child_list + ")";
22611
+ }
22612
+ case ExpressionType::OPERATOR_NOT:
22613
+ case ExpressionType::GROUPING_FUNCTION:
22614
+ case ExpressionType::OPERATOR_COALESCE: {
22615
+ string result = ExpressionTypeToString(entry.type);
22616
+ result += "(";
22617
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22618
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
22619
+ result += ")";
22620
+ return result;
22621
+ }
22622
+ case ExpressionType::OPERATOR_IS_NULL:
22623
+ return "(" + entry.children[0]->ToString() + " IS NULL)";
22624
+ case ExpressionType::OPERATOR_IS_NOT_NULL:
22625
+ return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
22626
+ case ExpressionType::ARRAY_EXTRACT:
22627
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
22628
+ case ExpressionType::ARRAY_SLICE:
22629
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
22630
+ entry.children[2]->ToString() + "]";
22631
+ case ExpressionType::STRUCT_EXTRACT: {
22632
+ D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
22633
+ auto child_string = entry.children[1]->ToString();
22634
+ D_ASSERT(child_string.size() >= 3);
22635
+ D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
22636
+ return "(" + entry.children[0]->ToString() + ")." +
22637
+ KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
22638
+ }
22639
+ case ExpressionType::ARRAY_CONSTRUCTOR: {
22640
+ string result = "(ARRAY[";
22641
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22642
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
22643
+ result += "])";
22644
+ return result;
22645
+ }
22646
+ default:
22647
+ throw InternalException("Unrecognized operator type");
22543
22648
  }
22544
- case_str += " ELSE " + entry.else_expr->ToString();
22545
- case_str += " END";
22546
- return case_str;
22547
22649
  }
22548
22650
  };
22549
- } // namespace duckdb
22550
22651
 
22652
+ } // namespace duckdb
22551
22653
  //===----------------------------------------------------------------------===//
22552
22654
  // DuckDB
22553
22655
  //
22554
- // duckdb/parser/expression/cast_expression.hpp
22656
+ // duckdb/parser/expression/conjunction_expression.hpp
22555
22657
  //
22556
22658
  //
22557
22659
  //===----------------------------------------------------------------------===//
@@ -22563,22 +22665,22 @@ public:
22563
22665
 
22564
22666
  namespace duckdb {
22565
22667
 
22566
- //! CastExpression represents a type cast from one SQL type to another SQL type
22567
- class CastExpression : public ParsedExpression {
22668
+ //! Represents a conjunction (AND/OR)
22669
+ class ConjunctionExpression : public ParsedExpression {
22568
22670
  public:
22569
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22671
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22672
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22673
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22674
+ unique_ptr<ParsedExpression> right);
22570
22675
 
22571
- //! The child of the cast expression
22572
- unique_ptr<ParsedExpression> child;
22573
- //! The type to cast to
22574
- LogicalType cast_type;
22575
- //! Whether or not this is a try_cast expression
22576
- bool try_cast;
22676
+ vector<unique_ptr<ParsedExpression>> children;
22577
22677
 
22578
22678
  public:
22679
+ void AddExpression(unique_ptr<ParsedExpression> expr);
22680
+
22579
22681
  string ToString() const override;
22580
22682
 
22581
- static bool Equals(const CastExpression *a, const CastExpression *b);
22683
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22582
22684
 
22583
22685
  unique_ptr<ParsedExpression> Copy() const override;
22584
22686
 
@@ -22588,18 +22690,18 @@ public:
22588
22690
  public:
22589
22691
  template <class T, class BASE>
22590
22692
  static string ToString(const T &entry) {
22591
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22592
- entry.cast_type.ToString() + ")";
22693
+ string result = "(" + entry.children[0]->ToString();
22694
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22695
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22696
+ }
22697
+ return result + ")";
22593
22698
  }
22594
22699
  };
22595
22700
  } // namespace duckdb
22596
-
22597
-
22598
-
22599
22701
  //===----------------------------------------------------------------------===//
22600
22702
  // DuckDB
22601
22703
  //
22602
- // duckdb/parser/expression/comparison_expression.hpp
22704
+ // duckdb/parser/expression/constant_expression.hpp
22603
22705
  //
22604
22706
  //
22605
22707
  //===----------------------------------------------------------------------===//
@@ -22608,39 +22710,34 @@ public:
22608
22710
 
22609
22711
 
22610
22712
 
22713
+
22611
22714
  namespace duckdb {
22612
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22613
- //! and has two children.
22614
- class ComparisonExpression : public ParsedExpression {
22715
+
22716
+ //! ConstantExpression represents a constant value in the query
22717
+ class ConstantExpression : public ParsedExpression {
22615
22718
  public:
22616
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22617
- unique_ptr<ParsedExpression> right);
22719
+ DUCKDB_API explicit ConstantExpression(Value val);
22618
22720
 
22619
- unique_ptr<ParsedExpression> left;
22620
- unique_ptr<ParsedExpression> right;
22721
+ //! The constant value referenced
22722
+ Value value;
22621
22723
 
22622
22724
  public:
22623
22725
  string ToString() const override;
22624
22726
 
22625
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22727
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22728
+ hash_t Hash() const override;
22626
22729
 
22627
22730
  unique_ptr<ParsedExpression> Copy() const override;
22628
22731
 
22629
22732
  void Serialize(FieldWriter &writer) const override;
22630
22733
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22631
-
22632
- public:
22633
- template <class T, class BASE>
22634
- static string ToString(const T &entry) {
22635
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22636
- }
22637
22734
  };
22638
- } // namespace duckdb
22639
22735
 
22736
+ } // namespace duckdb
22640
22737
  //===----------------------------------------------------------------------===//
22641
22738
  // DuckDB
22642
22739
  //
22643
- // duckdb/parser/expression/conjunction_expression.hpp
22740
+ // duckdb/parser/expression/case_expression.hpp
22644
22741
  //
22645
22742
  //
22646
22743
  //===----------------------------------------------------------------------===//
@@ -22652,22 +22749,23 @@ public:
22652
22749
 
22653
22750
  namespace duckdb {
22654
22751
 
22655
- //! Represents a conjunction (AND/OR)
22656
- class ConjunctionExpression : public ParsedExpression {
22752
+ struct CaseCheck {
22753
+ unique_ptr<ParsedExpression> when_expr;
22754
+ unique_ptr<ParsedExpression> then_expr;
22755
+ };
22756
+
22757
+ //! The CaseExpression represents a CASE expression in the query
22758
+ class CaseExpression : public ParsedExpression {
22657
22759
  public:
22658
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22659
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22660
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22661
- unique_ptr<ParsedExpression> right);
22760
+ DUCKDB_API CaseExpression();
22662
22761
 
22663
- vector<unique_ptr<ParsedExpression>> children;
22762
+ vector<CaseCheck> case_checks;
22763
+ unique_ptr<ParsedExpression> else_expr;
22664
22764
 
22665
22765
  public:
22666
- void AddExpression(unique_ptr<ParsedExpression> expr);
22667
-
22668
22766
  string ToString() const override;
22669
22767
 
22670
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22768
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
22671
22769
 
22672
22770
  unique_ptr<ParsedExpression> Copy() const override;
22673
22771
 
@@ -22677,19 +22775,64 @@ public:
22677
22775
  public:
22678
22776
  template <class T, class BASE>
22679
22777
  static string ToString(const T &entry) {
22680
- string result = entry.children[0]->ToString();
22681
- for (idx_t i = 1; i < entry.children.size(); i++) {
22682
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22683
- }
22684
- return result;
22778
+ string case_str = "CASE ";
22779
+ for (auto &check : entry.case_checks) {
22780
+ case_str += " WHEN (" + check.when_expr->ToString() + ")";
22781
+ case_str += " THEN (" + check.then_expr->ToString() + ")";
22782
+ }
22783
+ case_str += " ELSE " + entry.else_expr->ToString();
22784
+ case_str += " END";
22785
+ return case_str;
22786
+ }
22787
+ };
22788
+ } // namespace duckdb
22789
+ //===----------------------------------------------------------------------===//
22790
+ // DuckDB
22791
+ //
22792
+ // duckdb/parser/expression/between_expression.hpp
22793
+ //
22794
+ //
22795
+ //===----------------------------------------------------------------------===//
22796
+
22797
+
22798
+
22799
+
22800
+
22801
+ namespace duckdb {
22802
+
22803
+ class BetweenExpression : public ParsedExpression {
22804
+ public:
22805
+ BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22806
+ unique_ptr<ParsedExpression> upper);
22807
+
22808
+ unique_ptr<ParsedExpression> input;
22809
+ unique_ptr<ParsedExpression> lower;
22810
+ unique_ptr<ParsedExpression> upper;
22811
+
22812
+ public:
22813
+ string ToString() const override;
22814
+
22815
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22816
+
22817
+ unique_ptr<ParsedExpression> Copy() const override;
22818
+
22819
+ void Serialize(FieldWriter &writer) const override;
22820
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22821
+
22822
+ public:
22823
+ template <class T, class BASE>
22824
+ static string ToString(const T &entry) {
22825
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22685
22826
  }
22686
22827
  };
22687
22828
  } // namespace duckdb
22688
22829
 
22830
+
22831
+
22689
22832
  //===----------------------------------------------------------------------===//
22690
22833
  // DuckDB
22691
22834
  //
22692
- // duckdb/parser/expression/constant_expression.hpp
22835
+ // duckdb/parser/expression/cast_expression.hpp
22693
22836
  //
22694
22837
  //
22695
22838
  //===----------------------------------------------------------------------===//
@@ -22701,32 +22844,41 @@ public:
22701
22844
 
22702
22845
  namespace duckdb {
22703
22846
 
22704
- //! ConstantExpression represents a constant value in the query
22705
- class ConstantExpression : public ParsedExpression {
22847
+ //! CastExpression represents a type cast from one SQL type to another SQL type
22848
+ class CastExpression : public ParsedExpression {
22706
22849
  public:
22707
- DUCKDB_API explicit ConstantExpression(Value val);
22850
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22708
22851
 
22709
- //! The constant value referenced
22710
- Value value;
22852
+ //! The child of the cast expression
22853
+ unique_ptr<ParsedExpression> child;
22854
+ //! The type to cast to
22855
+ LogicalType cast_type;
22856
+ //! Whether or not this is a try_cast expression
22857
+ bool try_cast;
22711
22858
 
22712
22859
  public:
22713
22860
  string ToString() const override;
22714
22861
 
22715
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22716
- hash_t Hash() const override;
22862
+ static bool Equals(const CastExpression *a, const CastExpression *b);
22717
22863
 
22718
22864
  unique_ptr<ParsedExpression> Copy() const override;
22719
22865
 
22720
22866
  void Serialize(FieldWriter &writer) const override;
22721
22867
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22722
- };
22723
22868
 
22869
+ public:
22870
+ template <class T, class BASE>
22871
+ static string ToString(const T &entry) {
22872
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22873
+ entry.cast_type.ToString() + ")";
22874
+ }
22875
+ };
22724
22876
  } // namespace duckdb
22725
22877
 
22726
22878
  //===----------------------------------------------------------------------===//
22727
22879
  // DuckDB
22728
22880
  //
22729
- // duckdb/parser/expression/default_expression.hpp
22881
+ // duckdb/parser/expression/collate_expression.hpp
22730
22882
  //
22731
22883
  //
22732
22884
  //===----------------------------------------------------------------------===//
@@ -22736,25 +22888,74 @@ public:
22736
22888
 
22737
22889
 
22738
22890
  namespace duckdb {
22739
- //! Represents the default value of a column
22740
- class DefaultExpression : public ParsedExpression {
22891
+
22892
+ //! CollateExpression represents a COLLATE statement
22893
+ class CollateExpression : public ParsedExpression {
22741
22894
  public:
22742
- DefaultExpression();
22895
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
22896
+
22897
+ //! The child of the cast expression
22898
+ unique_ptr<ParsedExpression> child;
22899
+ //! The collation clause
22900
+ string collation;
22743
22901
 
22744
22902
  public:
22745
- bool IsScalar() const override {
22746
- return false;
22747
- }
22903
+ string ToString() const override;
22904
+
22905
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
22906
+
22907
+ unique_ptr<ParsedExpression> Copy() const override;
22908
+
22909
+ void Serialize(FieldWriter &writer) const override;
22910
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22911
+ };
22912
+ } // namespace duckdb
22913
+
22914
+
22915
+ //===----------------------------------------------------------------------===//
22916
+ // DuckDB
22917
+ //
22918
+ // duckdb/parser/expression/comparison_expression.hpp
22919
+ //
22920
+ //
22921
+ //===----------------------------------------------------------------------===//
22922
+
22923
+
22924
+
22925
+
22926
+
22927
+ namespace duckdb {
22928
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22929
+ //! and has two children.
22930
+ class ComparisonExpression : public ParsedExpression {
22931
+ public:
22932
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22933
+ unique_ptr<ParsedExpression> right);
22934
+
22935
+ unique_ptr<ParsedExpression> left;
22936
+ unique_ptr<ParsedExpression> right;
22748
22937
 
22938
+ public:
22749
22939
  string ToString() const override;
22750
22940
 
22941
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22942
+
22751
22943
  unique_ptr<ParsedExpression> Copy() const override;
22752
22944
 
22753
22945
  void Serialize(FieldWriter &writer) const override;
22754
22946
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22947
+
22948
+ public:
22949
+ template <class T, class BASE>
22950
+ static string ToString(const T &entry) {
22951
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22952
+ }
22755
22953
  };
22756
22954
  } // namespace duckdb
22757
22955
 
22956
+
22957
+
22958
+
22758
22959
  //===----------------------------------------------------------------------===//
22759
22960
  // DuckDB
22760
22961
  //
@@ -22817,7 +23018,7 @@ public:
22817
23018
  template <class T, class BASE>
22818
23019
  static string ToString(const T &entry, const string &schema, const string &function_name, bool is_operator = false,
22819
23020
  bool distinct = false, BASE *filter = nullptr, OrderModifier *order_bys = nullptr,
22820
- bool export_state = false) {
23021
+ bool export_state = false, bool add_alias = false) {
22821
23022
  if (is_operator) {
22822
23023
  // built-in operator
22823
23024
  D_ASSERT(!distinct);
@@ -22839,8 +23040,11 @@ public:
22839
23040
  if (distinct) {
22840
23041
  result += "DISTINCT ";
22841
23042
  }
22842
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22843
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
23043
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ", [&](const unique_ptr<BASE> &child) {
23044
+ return child->alias.empty() || !add_alias
23045
+ ? child->ToString()
23046
+ : KeywordHelper::WriteOptionallyQuoted(child->alias) + " := " + child->ToString();
23047
+ });
22844
23048
  // ordered aggregate
22845
23049
  if (order_bys && !order_bys->orders.empty()) {
22846
23050
  if (entry.children.empty()) {
@@ -22871,106 +23075,6 @@ public:
22871
23075
  } // namespace duckdb
22872
23076
 
22873
23077
 
22874
- //===----------------------------------------------------------------------===//
22875
- // DuckDB
22876
- //
22877
- // duckdb/parser/expression/operator_expression.hpp
22878
- //
22879
- //
22880
- //===----------------------------------------------------------------------===//
22881
-
22882
-
22883
-
22884
-
22885
-
22886
-
22887
-
22888
-
22889
- namespace duckdb {
22890
- //! Represents a built-in operator expression
22891
- class OperatorExpression : public ParsedExpression {
22892
- public:
22893
- DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
22894
- unique_ptr<ParsedExpression> right = nullptr);
22895
- DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22896
-
22897
- vector<unique_ptr<ParsedExpression>> children;
22898
-
22899
- public:
22900
- string ToString() const override;
22901
-
22902
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
22903
-
22904
- unique_ptr<ParsedExpression> Copy() const override;
22905
-
22906
- void Serialize(FieldWriter &writer) const override;
22907
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22908
-
22909
- public:
22910
- template <class T, class BASE>
22911
- static string ToString(const T &entry) {
22912
- auto op = ExpressionTypeToOperator(entry.type);
22913
- if (!op.empty()) {
22914
- // use the operator string to represent the operator
22915
- D_ASSERT(entry.children.size() == 2);
22916
- return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
22917
- }
22918
- switch (entry.type) {
22919
- case ExpressionType::COMPARE_IN:
22920
- case ExpressionType::COMPARE_NOT_IN: {
22921
- string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
22922
- string in_child = entry.children[0]->ToString();
22923
- string child_list = "(";
22924
- for (idx_t i = 1; i < entry.children.size(); i++) {
22925
- if (i > 1) {
22926
- child_list += ", ";
22927
- }
22928
- child_list += entry.children[i]->ToString();
22929
- }
22930
- child_list += ")";
22931
- return "(" + in_child + op_type + child_list + ")";
22932
- }
22933
- case ExpressionType::OPERATOR_NOT:
22934
- case ExpressionType::GROUPING_FUNCTION:
22935
- case ExpressionType::OPERATOR_COALESCE: {
22936
- string result = ExpressionTypeToString(entry.type);
22937
- result += "(";
22938
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22939
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
22940
- result += ")";
22941
- return result;
22942
- }
22943
- case ExpressionType::OPERATOR_IS_NULL:
22944
- return "(" + entry.children[0]->ToString() + " IS NULL)";
22945
- case ExpressionType::OPERATOR_IS_NOT_NULL:
22946
- return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
22947
- case ExpressionType::ARRAY_EXTRACT:
22948
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
22949
- case ExpressionType::ARRAY_SLICE:
22950
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
22951
- entry.children[2]->ToString() + "]";
22952
- case ExpressionType::STRUCT_EXTRACT: {
22953
- D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
22954
- auto child_string = entry.children[1]->ToString();
22955
- D_ASSERT(child_string.size() >= 3);
22956
- D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
22957
- return "(" + entry.children[0]->ToString() + ")." +
22958
- KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
22959
- }
22960
- case ExpressionType::ARRAY_CONSTRUCTOR: {
22961
- string result = "ARRAY[";
22962
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22963
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
22964
- result += "]";
22965
- return result;
22966
- }
22967
- default:
22968
- throw InternalException("Unrecognized operator type");
22969
- }
22970
- }
22971
- };
22972
-
22973
- } // namespace duckdb
22974
23078
 
22975
23079
  //===----------------------------------------------------------------------===//
22976
23080
  // DuckDB
@@ -23044,10 +23148,11 @@ public:
23044
23148
  };
23045
23149
  } // namespace duckdb
23046
23150
 
23151
+
23047
23152
  //===----------------------------------------------------------------------===//
23048
23153
  // DuckDB
23049
23154
  //
23050
- // duckdb/parser/expression/star_expression.hpp
23155
+ // duckdb/parser/expression/subquery_expression.hpp
23051
23156
  //
23052
23157
  //
23053
23158
  //===----------------------------------------------------------------------===//
@@ -23057,52 +23162,13 @@ public:
23057
23162
 
23058
23163
 
23059
23164
 
23165
+
23060
23166
  namespace duckdb {
23061
23167
 
23062
- //! Represents a * expression in the SELECT clause
23063
- class StarExpression : public ParsedExpression {
23168
+ //! Represents a subquery
23169
+ class SubqueryExpression : public ParsedExpression {
23064
23170
  public:
23065
- StarExpression(string relation_name = string());
23066
-
23067
- //! The relation name in case of tbl.*, or empty if this is a normal *
23068
- string relation_name;
23069
- //! List of columns to exclude from the STAR expression
23070
- case_insensitive_set_t exclude_list;
23071
- //! List of columns to replace with another expression
23072
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
23073
-
23074
- public:
23075
- string ToString() const override;
23076
-
23077
- static bool Equals(const StarExpression *a, const StarExpression *b);
23078
-
23079
- unique_ptr<ParsedExpression> Copy() const override;
23080
-
23081
- void Serialize(FieldWriter &writer) const override;
23082
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23083
- };
23084
- } // namespace duckdb
23085
-
23086
- //===----------------------------------------------------------------------===//
23087
- // DuckDB
23088
- //
23089
- // duckdb/parser/expression/subquery_expression.hpp
23090
- //
23091
- //
23092
- //===----------------------------------------------------------------------===//
23093
-
23094
-
23095
-
23096
-
23097
-
23098
-
23099
-
23100
- namespace duckdb {
23101
-
23102
- //! Represents a subquery
23103
- class SubqueryExpression : public ParsedExpression {
23104
- public:
23105
- SubqueryExpression();
23171
+ SubqueryExpression();
23106
23172
 
23107
23173
  //! The actual subquery
23108
23174
  unique_ptr<SelectStatement> subquery;
@@ -23137,7 +23203,7 @@ public:
23137
23203
  //===----------------------------------------------------------------------===//
23138
23204
  // DuckDB
23139
23205
  //
23140
- // duckdb/parser/parsed_data/create_collation_info.hpp
23206
+ // duckdb/parser/parsed_data/export_table_data.hpp
23141
23207
  //
23142
23208
  //
23143
23209
  //===----------------------------------------------------------------------===//
@@ -23149,112 +23215,24 @@ public:
23149
23215
 
23150
23216
  namespace duckdb {
23151
23217
 
23152
- struct CreateCollationInfo : public CreateInfo {
23153
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23154
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23155
- not_required_for_equality(not_required_for_equality_p) {
23156
- this->name = move(name_p);
23157
- }
23158
-
23159
- //! The name of the collation
23160
- string name;
23161
- //! The collation function to push in case collation is required
23162
- ScalarFunction function;
23163
- //! Whether or not the collation can be combined with other collations.
23164
- bool combinable;
23165
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23166
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23167
- //! speeds up processing.
23168
- bool not_required_for_equality;
23169
-
23170
- public:
23171
- unique_ptr<CreateInfo> Copy() const override {
23172
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23173
- CopyProperties(*result);
23174
- return move(result);
23175
- }
23176
- };
23177
-
23178
- } // namespace duckdb
23179
- //===----------------------------------------------------------------------===//
23180
- // DuckDB
23181
- //
23182
- // duckdb/parser/parsed_data/create_schema_info.hpp
23183
- //
23184
- //
23185
- //===----------------------------------------------------------------------===//
23186
-
23187
-
23188
-
23189
-
23190
-
23191
- namespace duckdb {
23218
+ struct ExportedTableData {
23219
+ //! Name of the exported table
23220
+ string table_name;
23192
23221
 
23193
- struct CreateSchemaInfo : public CreateInfo {
23194
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23195
- }
23222
+ //! Name of the schema
23223
+ string schema_name;
23196
23224
 
23197
- public:
23198
- unique_ptr<CreateInfo> Copy() const override {
23199
- auto result = make_unique<CreateSchemaInfo>();
23200
- CopyProperties(*result);
23201
- return move(result);
23202
- }
23225
+ //! Path to be exported
23226
+ string file_path;
23203
23227
  };
23204
23228
 
23205
- } // namespace duckdb
23206
- //===----------------------------------------------------------------------===//
23207
- // DuckDB
23208
- //
23209
- // duckdb/parser/parsed_data/show_select_info.hpp
23210
- //
23211
- //
23212
- //===----------------------------------------------------------------------===//
23213
-
23214
-
23215
-
23216
-
23217
-
23218
-
23219
- namespace duckdb {
23220
-
23221
- struct ShowSelectInfo : public ParseInfo {
23222
- //! Types of projected columns
23223
- vector<LogicalType> types;
23224
- //! The QueryNode of select query
23225
- unique_ptr<QueryNode> query;
23226
- //! Aliases of projected columns
23227
- vector<string> aliases;
23228
- //! Whether or not we are requesting a summary or a describe
23229
- bool is_summary;
23230
-
23231
- unique_ptr<ShowSelectInfo> Copy() {
23232
- auto result = make_unique<ShowSelectInfo>();
23233
- result->types = types;
23234
- result->query = query->Copy();
23235
- result->aliases = aliases;
23236
- result->is_summary = is_summary;
23237
- return result;
23238
- }
23229
+ struct ExportedTableInfo {
23230
+ TableCatalogEntry *entry;
23231
+ ExportedTableData table_data;
23239
23232
  };
23240
23233
 
23241
- } // namespace duckdb
23242
- //===----------------------------------------------------------------------===//
23243
- // DuckDB
23244
- //
23245
- // duckdb/parser/parsed_data/vacuum_info.hpp
23246
- //
23247
- //
23248
- //===----------------------------------------------------------------------===//
23249
-
23250
-
23251
-
23252
-
23253
-
23254
- namespace duckdb {
23255
-
23256
- struct VacuumInfo : public ParseInfo {
23257
- // nothing for now
23234
+ struct BoundExportData : public ParseInfo {
23235
+ std::vector<ExportedTableInfo> data;
23258
23236
  };
23259
23237
 
23260
23238
  } // namespace duckdb
@@ -23345,6 +23323,129 @@ public:
23345
23323
  }
23346
23324
  };
23347
23325
 
23326
+ } // namespace duckdb
23327
+ //===----------------------------------------------------------------------===//
23328
+ // DuckDB
23329
+ //
23330
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23331
+ //
23332
+ //
23333
+ //===----------------------------------------------------------------------===//
23334
+
23335
+
23336
+
23337
+
23338
+
23339
+
23340
+ namespace duckdb {
23341
+
23342
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23343
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
23344
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23345
+ this->name = function.name;
23346
+ functions.AddFunction(move(function));
23347
+ }
23348
+
23349
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23350
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23351
+ this->name = functions.name;
23352
+ for (auto &func : functions.functions) {
23353
+ func.name = functions.name;
23354
+ }
23355
+ }
23356
+
23357
+ AggregateFunctionSet functions;
23358
+
23359
+ public:
23360
+ unique_ptr<CreateInfo> Copy() const override {
23361
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23362
+ CopyProperties(*result);
23363
+ return move(result);
23364
+ }
23365
+ };
23366
+
23367
+ } // namespace duckdb
23368
+ //===----------------------------------------------------------------------===//
23369
+ // DuckDB
23370
+ //
23371
+ // duckdb/parser/parsed_data/create_collation_info.hpp
23372
+ //
23373
+ //
23374
+ //===----------------------------------------------------------------------===//
23375
+
23376
+
23377
+
23378
+
23379
+
23380
+
23381
+ namespace duckdb {
23382
+
23383
+ struct CreateCollationInfo : public CreateInfo {
23384
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23385
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23386
+ not_required_for_equality(not_required_for_equality_p) {
23387
+ this->name = move(name_p);
23388
+ }
23389
+
23390
+ //! The name of the collation
23391
+ string name;
23392
+ //! The collation function to push in case collation is required
23393
+ ScalarFunction function;
23394
+ //! Whether or not the collation can be combined with other collations.
23395
+ bool combinable;
23396
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23397
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23398
+ //! speeds up processing.
23399
+ bool not_required_for_equality;
23400
+
23401
+ public:
23402
+ unique_ptr<CreateInfo> Copy() const override {
23403
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23404
+ CopyProperties(*result);
23405
+ return move(result);
23406
+ }
23407
+ };
23408
+
23409
+ } // namespace duckdb
23410
+ //===----------------------------------------------------------------------===//
23411
+ // DuckDB
23412
+ //
23413
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23414
+ //
23415
+ //
23416
+ //===----------------------------------------------------------------------===//
23417
+
23418
+
23419
+
23420
+
23421
+
23422
+
23423
+ namespace duckdb {
23424
+
23425
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23426
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
23427
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23428
+ functions.push_back(move(function));
23429
+ this->name = function.name;
23430
+ }
23431
+ CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23432
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23433
+ this->name = name;
23434
+ for (auto &function : functions) {
23435
+ function.name = name;
23436
+ }
23437
+ }
23438
+
23439
+ vector<PragmaFunction> functions;
23440
+
23441
+ public:
23442
+ unique_ptr<CreateInfo> Copy() const override {
23443
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23444
+ CopyProperties(*result);
23445
+ return move(result);
23446
+ }
23447
+ };
23448
+
23348
23449
  } // namespace duckdb
23349
23450
  //===----------------------------------------------------------------------===//
23350
23451
  // DuckDB
@@ -23374,7 +23475,7 @@ struct TransactionInfo : public ParseInfo {
23374
23475
  //===----------------------------------------------------------------------===//
23375
23476
  // DuckDB
23376
23477
  //
23377
- // duckdb/parser/parsed_data/create_type_info.hpp
23478
+ // duckdb/parser/parsed_data/drop_info.hpp
23378
23479
  //
23379
23480
  //
23380
23481
  //===----------------------------------------------------------------------===//
@@ -23384,27 +23485,33 @@ struct TransactionInfo : public ParseInfo {
23384
23485
 
23385
23486
 
23386
23487
 
23387
-
23388
-
23389
23488
  namespace duckdb {
23390
23489
 
23391
- struct CreateTypeInfo : public CreateInfo {
23392
-
23393
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23490
+ struct DropInfo : public ParseInfo {
23491
+ DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23394
23492
  }
23395
23493
 
23396
- //! Name of the Type
23494
+ //! The catalog type to drop
23495
+ CatalogType type;
23496
+ //! Schema name to drop from, if any
23497
+ string schema;
23498
+ //! Element name to drop
23397
23499
  string name;
23398
- //! Logical Type
23399
- LogicalType type;
23500
+ //! Ignore if the entry does not exist instead of failing
23501
+ bool if_exists = false;
23502
+ //! Cascade drop (drop all dependents instead of throwing an error if there
23503
+ //! are any)
23504
+ bool cascade = false;
23400
23505
 
23401
23506
  public:
23402
- unique_ptr<CreateInfo> Copy() const override {
23403
- auto result = make_unique<CreateTypeInfo>();
23404
- CopyProperties(*result);
23405
- result->name = name;
23507
+ unique_ptr<DropInfo> Copy() const {
23508
+ auto result = make_unique<DropInfo>();
23406
23509
  result->type = type;
23407
- return move(result);
23510
+ result->schema = schema;
23511
+ result->name = name;
23512
+ result->if_exists = if_exists;
23513
+ result->cascade = cascade;
23514
+ return result;
23408
23515
  }
23409
23516
  };
23410
23517
 
@@ -23412,7 +23519,7 @@ public:
23412
23519
  //===----------------------------------------------------------------------===//
23413
23520
  // DuckDB
23414
23521
  //
23415
- // duckdb/parser/parsed_data/create_view_info.hpp
23522
+ // duckdb/parser/parsed_data/create_schema_info.hpp
23416
23523
  //
23417
23524
  //
23418
23525
  //===----------------------------------------------------------------------===//
@@ -23421,32 +23528,16 @@ public:
23421
23528
 
23422
23529
 
23423
23530
 
23424
-
23425
23531
  namespace duckdb {
23426
23532
 
23427
- struct CreateViewInfo : public CreateInfo {
23428
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
23429
- }
23430
- CreateViewInfo(string schema, string view_name)
23431
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
23533
+ struct CreateSchemaInfo : public CreateInfo {
23534
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23432
23535
  }
23433
23536
 
23434
- //! Table name to insert to
23435
- string view_name;
23436
- //! Aliases of the view
23437
- vector<string> aliases;
23438
- //! Return types
23439
- vector<LogicalType> types;
23440
- //! The SelectStatement of the view
23441
- unique_ptr<SelectStatement> query;
23442
-
23443
23537
  public:
23444
23538
  unique_ptr<CreateInfo> Copy() const override {
23445
- auto result = make_unique<CreateViewInfo>(schema, view_name);
23539
+ auto result = make_unique<CreateSchemaInfo>();
23446
23540
  CopyProperties(*result);
23447
- result->aliases = aliases;
23448
- result->types = types;
23449
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
23450
23541
  return move(result);
23451
23542
  }
23452
23543
  };
@@ -23539,7 +23630,7 @@ public:
23539
23630
  //===----------------------------------------------------------------------===//
23540
23631
  // DuckDB
23541
23632
  //
23542
- // duckdb/parser/parsed_data/export_table_data.hpp
23633
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23543
23634
  //
23544
23635
  //
23545
23636
  //===----------------------------------------------------------------------===//
@@ -23548,34 +23639,28 @@ public:
23548
23639
 
23549
23640
 
23550
23641
 
23551
-
23552
23642
  namespace duckdb {
23553
23643
 
23554
- struct ExportedTableData {
23555
- //! Name of the exported table
23556
- string table_name;
23557
-
23558
- //! Name of the schema
23559
- string schema_name;
23560
-
23561
- //! Path to be exported
23562
- string file_path;
23563
- };
23644
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23564
23645
 
23565
- struct ExportedTableInfo {
23566
- TableCatalogEntry *entry;
23567
- ExportedTableData table_data;
23568
- };
23646
+ struct LoadInfo : public ParseInfo {
23647
+ std::string filename;
23648
+ LoadType load_type;
23569
23649
 
23570
- struct BoundExportData : public ParseInfo {
23571
- std::vector<ExportedTableInfo> data;
23650
+ public:
23651
+ unique_ptr<LoadInfo> Copy() const {
23652
+ auto result = make_unique<LoadInfo>();
23653
+ result->filename = filename;
23654
+ result->load_type = load_type;
23655
+ return result;
23656
+ }
23572
23657
  };
23573
23658
 
23574
23659
  } // namespace duckdb
23575
23660
  //===----------------------------------------------------------------------===//
23576
23661
  // DuckDB
23577
23662
  //
23578
- // duckdb/parser/parsed_data/vacuum_info.hpp
23663
+ // duckdb/parser/parsed_data/create_type_info.hpp
23579
23664
  //
23580
23665
  //
23581
23666
  //===----------------------------------------------------------------------===//
@@ -23584,20 +23669,28 @@ struct BoundExportData : public ParseInfo {
23584
23669
 
23585
23670
 
23586
23671
 
23672
+
23673
+
23674
+
23587
23675
  namespace duckdb {
23588
23676
 
23589
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23677
+ struct CreateTypeInfo : public CreateInfo {
23590
23678
 
23591
- struct LoadInfo : public ParseInfo {
23592
- std::string filename;
23593
- LoadType load_type;
23679
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23680
+ }
23681
+
23682
+ //! Name of the Type
23683
+ string name;
23684
+ //! Logical Type
23685
+ LogicalType type;
23594
23686
 
23595
23687
  public:
23596
- unique_ptr<LoadInfo> Copy() const {
23597
- auto result = make_unique<LoadInfo>();
23598
- result->filename = filename;
23599
- result->load_type = load_type;
23600
- return result;
23688
+ unique_ptr<CreateInfo> Copy() const override {
23689
+ auto result = make_unique<CreateTypeInfo>();
23690
+ CopyProperties(*result);
23691
+ result->name = name;
23692
+ result->type = type;
23693
+ return move(result);
23601
23694
  }
23602
23695
  };
23603
23696
 
@@ -23605,7 +23698,7 @@ public:
23605
23698
  //===----------------------------------------------------------------------===//
23606
23699
  // DuckDB
23607
23700
  //
23608
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23701
+ // duckdb/parser/parsed_data/create_view_info.hpp
23609
23702
  //
23610
23703
  //
23611
23704
  //===----------------------------------------------------------------------===//
@@ -23617,27 +23710,29 @@ public:
23617
23710
 
23618
23711
  namespace duckdb {
23619
23712
 
23620
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23621
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
23622
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23623
- this->name = function.name;
23624
- functions.AddFunction(move(function));
23713
+ struct CreateViewInfo : public CreateInfo {
23714
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
23625
23715
  }
23626
-
23627
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23628
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23629
- this->name = functions.name;
23630
- for (auto &func : functions.functions) {
23631
- func.name = functions.name;
23632
- }
23716
+ CreateViewInfo(string schema, string view_name)
23717
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
23633
23718
  }
23634
23719
 
23635
- AggregateFunctionSet functions;
23720
+ //! Table name to insert to
23721
+ string view_name;
23722
+ //! Aliases of the view
23723
+ vector<string> aliases;
23724
+ //! Return types
23725
+ vector<LogicalType> types;
23726
+ //! The SelectStatement of the view
23727
+ unique_ptr<SelectStatement> query;
23636
23728
 
23637
23729
  public:
23638
23730
  unique_ptr<CreateInfo> Copy() const override {
23639
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23731
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
23640
23732
  CopyProperties(*result);
23733
+ result->aliases = aliases;
23734
+ result->types = types;
23735
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
23641
23736
  return move(result);
23642
23737
  }
23643
23738
  };
@@ -23646,7 +23741,7 @@ public:
23646
23741
  //===----------------------------------------------------------------------===//
23647
23742
  // DuckDB
23648
23743
  //
23649
- // duckdb/parser/parsed_data/drop_info.hpp
23744
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23650
23745
  //
23651
23746
  //
23652
23747
  //===----------------------------------------------------------------------===//
@@ -23655,42 +23750,17 @@ public:
23655
23750
 
23656
23751
 
23657
23752
 
23658
-
23659
23753
  namespace duckdb {
23660
23754
 
23661
- struct DropInfo : public ParseInfo {
23662
- DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23663
- }
23664
-
23665
- //! The catalog type to drop
23666
- CatalogType type;
23667
- //! Schema name to drop from, if any
23668
- string schema;
23669
- //! Element name to drop
23670
- string name;
23671
- //! Ignore if the entry does not exist instead of failing
23672
- bool if_exists = false;
23673
- //! Cascade drop (drop all dependents instead of throwing an error if there
23674
- //! are any)
23675
- bool cascade = false;
23676
-
23677
- public:
23678
- unique_ptr<DropInfo> Copy() const {
23679
- auto result = make_unique<DropInfo>();
23680
- result->type = type;
23681
- result->schema = schema;
23682
- result->name = name;
23683
- result->if_exists = if_exists;
23684
- result->cascade = cascade;
23685
- return result;
23686
- }
23755
+ struct VacuumInfo : public ParseInfo {
23756
+ // nothing for now
23687
23757
  };
23688
23758
 
23689
23759
  } // namespace duckdb
23690
23760
  //===----------------------------------------------------------------------===//
23691
23761
  // DuckDB
23692
23762
  //
23693
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23763
+ // duckdb/parser/parsed_data/show_select_info.hpp
23694
23764
  //
23695
23765
  //
23696
23766
  //===----------------------------------------------------------------------===//
@@ -23702,27 +23772,23 @@ public:
23702
23772
 
23703
23773
  namespace duckdb {
23704
23774
 
23705
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23706
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
23707
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23708
- functions.push_back(move(function));
23709
- this->name = function.name;
23710
- }
23711
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23712
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23713
- this->name = name;
23714
- for (auto &function : functions) {
23715
- function.name = name;
23716
- }
23717
- }
23718
-
23719
- vector<PragmaFunction> functions;
23775
+ struct ShowSelectInfo : public ParseInfo {
23776
+ //! Types of projected columns
23777
+ vector<LogicalType> types;
23778
+ //! The QueryNode of select query
23779
+ unique_ptr<QueryNode> query;
23780
+ //! Aliases of projected columns
23781
+ vector<string> aliases;
23782
+ //! Whether or not we are requesting a summary or a describe
23783
+ bool is_summary;
23720
23784
 
23721
- public:
23722
- unique_ptr<CreateInfo> Copy() const override {
23723
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23724
- CopyProperties(*result);
23725
- return move(result);
23785
+ unique_ptr<ShowSelectInfo> Copy() {
23786
+ auto result = make_unique<ShowSelectInfo>();
23787
+ result->types = types;
23788
+ result->query = query->Copy();
23789
+ result->aliases = aliases;
23790
+ result->is_summary = is_summary;
23791
+ return result;
23726
23792
  }
23727
23793
  };
23728
23794
 
@@ -23730,7 +23796,7 @@ public:
23730
23796
  //===----------------------------------------------------------------------===//
23731
23797
  // DuckDB
23732
23798
  //
23733
- // duckdb/parser/tableref/expressionlistref.hpp
23799
+ // duckdb/parser/tableref/emptytableref.hpp
23734
23800
  //
23735
23801
  //
23736
23802
  //===----------------------------------------------------------------------===//
@@ -23739,35 +23805,25 @@ public:
23739
23805
 
23740
23806
 
23741
23807
 
23742
-
23743
-
23744
-
23745
23808
  namespace duckdb {
23746
- //! Represents an expression list as generated by a VALUES statement
23747
- class ExpressionListRef : public TableRef {
23809
+ //! Represents a cross product
23810
+ class EmptyTableRef : public TableRef {
23748
23811
  public:
23749
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
23812
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
23750
23813
  }
23751
23814
 
23752
- //! Value list, only used for VALUES statement
23753
- vector<vector<unique_ptr<ParsedExpression>>> values;
23754
- //! Expected SQL types
23755
- vector<LogicalType> expected_types;
23756
- //! The set of expected names
23757
- vector<string> expected_names;
23758
-
23759
23815
  public:
23816
+ string ToString() const override;
23760
23817
  bool Equals(const TableRef *other_p) const override;
23761
23818
 
23762
23819
  unique_ptr<TableRef> Copy() override;
23763
23820
 
23764
- //! Serializes a blob into a ExpressionListRef
23821
+ //! Serializes a blob into a DummyTableRef
23765
23822
  void Serialize(FieldWriter &serializer) const override;
23766
- //! Deserializes a blob back into a ExpressionListRef
23823
+ //! Deserializes a blob back into a DummyTableRef
23767
23824
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23768
23825
  };
23769
23826
  } // namespace duckdb
23770
-
23771
23827
  //===----------------------------------------------------------------------===//
23772
23828
  // DuckDB
23773
23829
  //
@@ -23793,6 +23849,7 @@ public:
23793
23849
  unique_ptr<TableRef> right;
23794
23850
 
23795
23851
  public:
23852
+ string ToString() const override;
23796
23853
  bool Equals(const TableRef *other_p) const override;
23797
23854
 
23798
23855
  unique_ptr<TableRef> Copy() override;
@@ -23804,10 +23861,12 @@ public:
23804
23861
  };
23805
23862
  } // namespace duckdb
23806
23863
 
23864
+
23865
+
23807
23866
  //===----------------------------------------------------------------------===//
23808
23867
  // DuckDB
23809
23868
  //
23810
- // duckdb/parser/tableref/emptytableref.hpp
23869
+ // duckdb/parser/tableref/expressionlistref.hpp
23811
23870
  //
23812
23871
  //
23813
23872
  //===----------------------------------------------------------------------===//
@@ -23816,26 +23875,36 @@ public:
23816
23875
 
23817
23876
 
23818
23877
 
23878
+
23879
+
23880
+
23819
23881
  namespace duckdb {
23820
- //! Represents a cross product
23821
- class EmptyTableRef : public TableRef {
23882
+ //! Represents an expression list as generated by a VALUES statement
23883
+ class ExpressionListRef : public TableRef {
23822
23884
  public:
23823
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
23885
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
23824
23886
  }
23825
23887
 
23888
+ //! Value list, only used for VALUES statement
23889
+ vector<vector<unique_ptr<ParsedExpression>>> values;
23890
+ //! Expected SQL types
23891
+ vector<LogicalType> expected_types;
23892
+ //! The set of expected names
23893
+ vector<string> expected_names;
23894
+
23826
23895
  public:
23896
+ string ToString() const override;
23827
23897
  bool Equals(const TableRef *other_p) const override;
23828
23898
 
23829
23899
  unique_ptr<TableRef> Copy() override;
23830
23900
 
23831
- //! Serializes a blob into a DummyTableRef
23901
+ //! Serializes a blob into a ExpressionListRef
23832
23902
  void Serialize(FieldWriter &serializer) const override;
23833
- //! Deserializes a blob back into a DummyTableRef
23903
+ //! Deserializes a blob back into a ExpressionListRef
23834
23904
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23835
23905
  };
23836
23906
  } // namespace duckdb
23837
23907
 
23838
-
23839
23908
  //===----------------------------------------------------------------------===//
23840
23909
  // DuckDB
23841
23910
  //
@@ -23873,6 +23942,7 @@ public:
23873
23942
  vector<string> using_columns;
23874
23943
 
23875
23944
  public:
23945
+ string ToString() const override;
23876
23946
  bool Equals(const TableRef *other_p) const override;
23877
23947
 
23878
23948
  unique_ptr<TableRef> Copy() override;
@@ -23909,6 +23979,7 @@ public:
23909
23979
  vector<string> column_name_alias;
23910
23980
 
23911
23981
  public:
23982
+ string ToString() const override;
23912
23983
  bool Equals(const TableRef *other_p) const override;
23913
23984
 
23914
23985
  unique_ptr<TableRef> Copy() override;