duckdb 0.3.5-dev2.0 → 0.3.5-dev211.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 "0c68c88e5"
15
- #define DUCKDB_VERSION "v0.3.5-dev2"
14
+ #define DUCKDB_SOURCE_ID "3227e359a"
15
+ #define DUCKDB_VERSION "v0.3.5-dev211"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -2789,7 +2789,7 @@ public:
2789
2789
  DUCKDB_API static Value LIST(LogicalType child_type, vector<Value> values);
2790
2790
  //! Create an empty list with the specified child-type
2791
2791
  DUCKDB_API static Value EMPTYLIST(LogicalType child_type);
2792
- //! Creat a map value from a (key, value) pair
2792
+ //! Create a map value from a (key, value) pair
2793
2793
  DUCKDB_API static Value MAP(Value key, Value value);
2794
2794
 
2795
2795
  //! Create a blob Value from a data pointer and a length: no bytes are interpreted
@@ -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 {
@@ -6427,11 +6436,14 @@ public:
6427
6436
  //! Bind a scalar function from the set of functions and input arguments. Returns the index of the chosen function,
6428
6437
  //! returns DConstants::INVALID_INDEX and sets error if none could be found
6429
6438
  DUCKDB_API static idx_t BindFunction(const string &name, vector<ScalarFunction> &functions,
6430
- vector<LogicalType> &arguments, string &error);
6439
+ vector<LogicalType> &arguments, string &error, bool &cast_parameters);
6431
6440
  DUCKDB_API static idx_t BindFunction(const string &name, vector<ScalarFunction> &functions,
6432
- vector<unique_ptr<Expression>> &arguments, string &error);
6441
+ vector<unique_ptr<Expression>> &arguments, string &error,
6442
+ bool &cast_parameters);
6433
6443
  //! Bind an aggregate function from the set of functions and input arguments. Returns the index of the chosen
6434
6444
  //! function, returns DConstants::INVALID_INDEX and sets error if none could be found
6445
+ DUCKDB_API static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
6446
+ vector<LogicalType> &arguments, string &error, bool &cast_parameters);
6435
6447
  DUCKDB_API static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
6436
6448
  vector<LogicalType> &arguments, string &error);
6437
6449
  DUCKDB_API static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
@@ -6477,10 +6489,6 @@ public:
6477
6489
  public:
6478
6490
  DUCKDB_API string ToString() override;
6479
6491
  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
6492
  };
6485
6493
 
6486
6494
  class BaseScalarFunction : public SimpleFunction {
@@ -6502,7 +6510,8 @@ public:
6502
6510
  DUCKDB_API hash_t Hash() const;
6503
6511
 
6504
6512
  //! Cast a set of expressions to the arguments of this function
6505
- DUCKDB_API void CastToFunctionArguments(vector<unique_ptr<Expression>> &children);
6513
+ DUCKDB_API void CastToFunctionArguments(vector<unique_ptr<Expression>> &children,
6514
+ bool cast_parameter_expressions = true);
6506
6515
 
6507
6516
  DUCKDB_API string ToString() override;
6508
6517
  };
@@ -6574,6 +6583,7 @@ namespace duckdb {
6574
6583
  class Expression;
6575
6584
  class ExpressionExecutor;
6576
6585
  struct ExpressionExecutorState;
6586
+ struct FunctionLocalState;
6577
6587
 
6578
6588
  struct ExpressionState {
6579
6589
  ExpressionState(const Expression &expr, ExpressionExecutorState &root);
@@ -6594,13 +6604,13 @@ public:
6594
6604
  };
6595
6605
 
6596
6606
  struct ExecuteFunctionState : public ExpressionState {
6597
- ExecuteFunctionState(const Expression &expr, ExpressionExecutorState &root) : ExpressionState(expr, root) {
6598
- }
6607
+ ExecuteFunctionState(const Expression &expr, ExpressionExecutorState &root);
6608
+ ~ExecuteFunctionState();
6599
6609
 
6600
- unique_ptr<FunctionData> local_state;
6610
+ unique_ptr<FunctionLocalState> local_state;
6601
6611
 
6602
6612
  public:
6603
- static FunctionData *GetFunctionState(ExpressionState &state) {
6613
+ static FunctionLocalState *GetFunctionState(ExpressionState &state) {
6604
6614
  return ((ExecuteFunctionState &)state).local_state.get();
6605
6615
  }
6606
6616
  };
@@ -7235,6 +7245,11 @@ public:
7235
7245
 
7236
7246
 
7237
7247
  namespace duckdb {
7248
+
7249
+ struct FunctionLocalState {
7250
+ DUCKDB_API virtual ~FunctionLocalState();
7251
+ };
7252
+
7238
7253
  class BoundFunctionExpression;
7239
7254
  class ScalarFunctionCatalogEntry;
7240
7255
 
@@ -7243,7 +7258,8 @@ typedef std::function<void(DataChunk &, ExpressionState &, Vector &)> scalar_fun
7243
7258
  //! Binds the scalar function and creates the function data
7244
7259
  typedef unique_ptr<FunctionData> (*bind_scalar_function_t)(ClientContext &context, ScalarFunction &bound_function,
7245
7260
  vector<unique_ptr<Expression>> &arguments);
7246
- typedef unique_ptr<FunctionData> (*init_local_state_t)(const BoundFunctionExpression &expr, FunctionData *bind_data);
7261
+ typedef unique_ptr<FunctionLocalState> (*init_local_state_t)(const BoundFunctionExpression &expr,
7262
+ FunctionData *bind_data);
7247
7263
  typedef unique_ptr<BaseStatistics> (*function_statistics_t)(ClientContext &context, BoundFunctionExpression &expr,
7248
7264
  FunctionData *bind_data,
7249
7265
  vector<unique_ptr<BaseStatistics>> &child_stats);
@@ -7285,10 +7301,9 @@ public:
7285
7301
  vector<unique_ptr<Expression>> children,
7286
7302
  string &error, bool is_operator = false);
7287
7303
 
7288
- DUCKDB_API static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context,
7289
- ScalarFunction bound_function,
7290
- vector<unique_ptr<Expression>> children,
7291
- bool is_operator = false);
7304
+ DUCKDB_API static unique_ptr<BoundFunctionExpression>
7305
+ BindScalarFunction(ClientContext &context, ScalarFunction bound_function, vector<unique_ptr<Expression>> children,
7306
+ bool is_operator = false, bool cast_parameters = true);
7292
7307
 
7293
7308
  DUCKDB_API bool operator==(const ScalarFunction &rhs) const;
7294
7309
  DUCKDB_API bool operator!=(const ScalarFunction &rhs) const;
@@ -7716,13 +7731,13 @@ public:
7716
7731
  }
7717
7732
 
7718
7733
  template <class STATE_TYPE, class OP>
7719
- static void Combine(Vector &source, Vector &target, idx_t count) {
7734
+ static void Combine(Vector &source, Vector &target, FunctionData *bind_data, idx_t count) {
7720
7735
  D_ASSERT(source.GetType().id() == LogicalTypeId::POINTER && target.GetType().id() == LogicalTypeId::POINTER);
7721
7736
  auto sdata = FlatVector::GetData<const STATE_TYPE *>(source);
7722
7737
  auto tdata = FlatVector::GetData<STATE_TYPE *>(target);
7723
7738
 
7724
7739
  for (idx_t i = 0; i < count; i++) {
7725
- OP::template Combine<STATE_TYPE, OP>(*sdata[i], tdata[i]);
7740
+ OP::template Combine<STATE_TYPE, OP>(*sdata[i], tdata[i], bind_data);
7726
7741
  }
7727
7742
  }
7728
7743
 
@@ -8953,8 +8968,8 @@ typedef void (*aggregate_initialize_t)(data_ptr_t state);
8953
8968
  //! The type used for updating hashed aggregate functions
8954
8969
  typedef void (*aggregate_update_t)(Vector inputs[], FunctionData *bind_data, idx_t input_count, Vector &state,
8955
8970
  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);
8971
+ //! The type used for combining hashed aggregate states
8972
+ typedef void (*aggregate_combine_t)(Vector &state, Vector &combined, FunctionData *bind_data, idx_t count);
8958
8973
  //! The type used for finalizing hashed aggregate function payloads
8959
8974
  typedef void (*aggregate_finalize_t)(Vector &state, FunctionData *bind_data, Vector &result, idx_t count, idx_t offset);
8960
8975
  //! The type used for propagating statistics in aggregate functions (optional)
@@ -9058,7 +9073,8 @@ public:
9058
9073
  DUCKDB_API static unique_ptr<BoundAggregateExpression>
9059
9074
  BindAggregateFunction(ClientContext &context, AggregateFunction bound_function,
9060
9075
  vector<unique_ptr<Expression>> children, unique_ptr<Expression> filter = nullptr,
9061
- bool is_distinct = false, unique_ptr<BoundOrderModifier> order_bys = nullptr);
9076
+ bool is_distinct = false, unique_ptr<BoundOrderModifier> order_bys = nullptr,
9077
+ bool cast_parameters = true);
9062
9078
 
9063
9079
  DUCKDB_API static unique_ptr<FunctionData> BindSortedAggregate(AggregateFunction &bound_function,
9064
9080
  vector<unique_ptr<Expression>> &children,
@@ -9164,8 +9180,8 @@ public:
9164
9180
  }
9165
9181
 
9166
9182
  template <class STATE, class OP>
9167
- static void StateCombine(Vector &source, Vector &target, idx_t count) {
9168
- AggregateExecutor::Combine<STATE, OP>(source, target, count);
9183
+ static void StateCombine(Vector &source, Vector &target, FunctionData *bind_data, idx_t count) {
9184
+ AggregateExecutor::Combine<STATE, OP>(source, target, bind_data, count);
9169
9185
  }
9170
9186
 
9171
9187
  template <class STATE, class RESULT_TYPE, class OP>
@@ -13147,9 +13163,6 @@ public:
13147
13163
  static bool ContainsType(const LogicalType &type, LogicalTypeId target);
13148
13164
  static LogicalType ExchangeType(const LogicalType &type, LogicalTypeId target, LogicalType new_type);
13149
13165
 
13150
- static void ResolveParameterType(LogicalType &type);
13151
- static void ResolveParameterType(unique_ptr<Expression> &expr);
13152
-
13153
13166
  //! Bind the given expresion. Unlike Bind(), this does *not* mute the given ParsedExpression.
13154
13167
  //! Exposed to be used from sub-binders that aren't subclasses of ExpressionBinder.
13155
13168
  virtual BindResult BindExpression(unique_ptr<ParsedExpression> *expr_ptr, idx_t depth,
@@ -13171,7 +13184,6 @@ protected:
13171
13184
  BindResult BindExpression(OperatorExpression &expr, idx_t depth);
13172
13185
  BindResult BindExpression(ParameterExpression &expr, idx_t depth);
13173
13186
  BindResult BindExpression(PositionalReferenceExpression &ref, idx_t depth);
13174
- BindResult BindExpression(StarExpression &expr, idx_t depth);
13175
13187
  BindResult BindExpression(SubqueryExpression &expr, idx_t depth);
13176
13188
 
13177
13189
  protected:
@@ -13483,6 +13495,8 @@ public:
13483
13495
  vector<CorrelatedColumnInfo> correlated_columns;
13484
13496
  //! The set of parameter expressions bound by this binder
13485
13497
  vector<BoundParameterExpression *> *parameters;
13498
+ //! The types of the prepared statement parameters, if any
13499
+ vector<LogicalType> *parameter_types;
13486
13500
  //! Whether or not the bound statement is read-only
13487
13501
  bool read_only;
13488
13502
  //! Whether or not the statement requires a valid transaction to run
@@ -13781,6 +13795,7 @@ public:
13781
13795
 
13782
13796
 
13783
13797
  namespace duckdb {
13798
+
13784
13799
  //! SQLStatement is the base class of any type of SQL statement.
13785
13800
  class SQLStatement {
13786
13801
  public:
@@ -13803,6 +13818,9 @@ protected:
13803
13818
  SQLStatement(const SQLStatement &other) = default;
13804
13819
 
13805
13820
  public:
13821
+ virtual string ToString() const {
13822
+ throw InternalException("ToString not supported for this type of SQLStatement");
13823
+ }
13806
13824
  //! Create a copy of this SelectStatement
13807
13825
  virtual unique_ptr<SQLStatement> Copy() const = 0;
13808
13826
  };
@@ -13907,7 +13925,9 @@ public:
13907
13925
 
13908
13926
  public:
13909
13927
  //! Convert the object to a string
13910
- virtual string ToString() const;
13928
+ virtual string ToString() const = 0;
13929
+ string BaseToString(string result) const;
13930
+ string BaseToString(string result, const vector<string> &column_name_alias) const;
13911
13931
  void Print();
13912
13932
 
13913
13933
  virtual bool Equals(const TableRef *other) const;
@@ -13944,6 +13964,8 @@ protected:
13944
13964
  SelectStatement(const SelectStatement &other);
13945
13965
 
13946
13966
  public:
13967
+ //! Convert the SELECT statement to a string
13968
+ string ToString() const override;
13947
13969
  //! Create a copy of this SelectStatement
13948
13970
  unique_ptr<SQLStatement> Copy() const override;
13949
13971
  //! Serializes a SelectStatement to a stand-alone binary blob
@@ -13995,6 +14017,9 @@ public:
13995
14017
  virtual const vector<unique_ptr<ParsedExpression>> &GetSelectList() const = 0;
13996
14018
 
13997
14019
  public:
14020
+ //! Convert the query node to a string
14021
+ virtual string ToString() const = 0;
14022
+
13998
14023
  virtual bool Equals(const QueryNode *other) const;
13999
14024
 
14000
14025
  //! Create a copy of this QueryNode
@@ -14006,6 +14031,9 @@ public:
14006
14031
  //! Deserializes a blob back into a QueryNode
14007
14032
  DUCKDB_API static unique_ptr<QueryNode> Deserialize(Deserializer &source);
14008
14033
 
14034
+ string CTEToString() const;
14035
+ string ResultModifiersToString() const;
14036
+
14009
14037
  protected:
14010
14038
  //! Copy base QueryNode properties from another expression to this one,
14011
14039
  //! used in Copy method
@@ -15975,6 +16003,24 @@ This should not be used with `DUCKDB_TYPE_DECIMAL`.
15975
16003
  */
15976
16004
  DUCKDB_API duckdb_logical_type duckdb_create_logical_type(duckdb_type type);
15977
16005
 
16006
+ /*!
16007
+ Creates a list type from its child type.
16008
+ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
16009
+
16010
+ * type: The child type of list type to create.
16011
+ * returns: The logical type.
16012
+ */
16013
+ DUCKDB_API duckdb_logical_type duckdb_create_list_type(duckdb_logical_type type);
16014
+
16015
+ /*!
16016
+ Creates a map type from its key type and value type.
16017
+ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
16018
+
16019
+ * type: The key type and value type of map type to create.
16020
+ * returns: The logical type.
16021
+ */
16022
+ DUCKDB_API duckdb_logical_type duckdb_create_map_type(duckdb_logical_type key_type, duckdb_logical_type value_type);
16023
+
15978
16024
  /*!
15979
16025
  Creates a `duckdb_logical_type` of type decimal with the specified width and scale
15980
16026
  The resulting type should be destroyed with `duckdb_destroy_logical_type`.
@@ -16054,6 +16100,26 @@ The result must be freed with `duckdb_destroy_logical_type`
16054
16100
  */
16055
16101
  DUCKDB_API duckdb_logical_type duckdb_list_type_child_type(duckdb_logical_type type);
16056
16102
 
16103
+ /*!
16104
+ Retrieves the key type of the given map type.
16105
+
16106
+ The result must be freed with `duckdb_destroy_logical_type`
16107
+
16108
+ * type: The logical type object
16109
+ * returns: The key type of the map type. Must be destroyed with `duckdb_destroy_logical_type`.
16110
+ */
16111
+ DUCKDB_API duckdb_logical_type duckdb_map_type_key_type(duckdb_logical_type type);
16112
+
16113
+ /*!
16114
+ Retrieves the value type of the given map type.
16115
+
16116
+ The result must be freed with `duckdb_destroy_logical_type`
16117
+
16118
+ * type: The logical type object
16119
+ * returns: The value type of the map type. Must be destroyed with `duckdb_destroy_logical_type`.
16120
+ */
16121
+ DUCKDB_API duckdb_logical_type duckdb_map_type_value_type(duckdb_logical_type type);
16122
+
16057
16123
  /*!
16058
16124
  Returns the number of children of a struct type.
16059
16125
 
@@ -17176,6 +17242,27 @@ public:
17176
17242
 
17177
17243
  } // namespace duckdb
17178
17244
 
17245
+ //===----------------------------------------------------------------------===//
17246
+ // DuckDB
17247
+ //
17248
+ // duckdb/main/external_dependencies.hpp
17249
+ //
17250
+ //
17251
+ //===----------------------------------------------------------------------===//
17252
+
17253
+
17254
+
17255
+ namespace duckdb {
17256
+
17257
+ enum ExternalDependenciesType { PYTHON_DEPENDENCY };
17258
+ class ExternalDependency {
17259
+ public:
17260
+ explicit ExternalDependency(ExternalDependenciesType type_p) : type(type_p) {};
17261
+ virtual ~ExternalDependency() {};
17262
+ ExternalDependenciesType type;
17263
+ };
17264
+
17265
+ } // namespace duckdb
17179
17266
 
17180
17267
  namespace duckdb {
17181
17268
  class Appender;
@@ -17217,6 +17304,8 @@ public:
17217
17304
  TransactionContext transaction;
17218
17305
  //! Whether or not the query is interrupted
17219
17306
  atomic<bool> interrupted;
17307
+ //! External Objects (e.g., Python objects) that views depend of
17308
+ unordered_map<string, vector<shared_ptr<ExternalDependency>>> external_dependencies;
17220
17309
 
17221
17310
  unique_ptr<SchemaCatalogEntry> temporary_objects;
17222
17311
  unordered_map<string, shared_ptr<PreparedStatementData>> prepared_statements;
@@ -17360,7 +17449,8 @@ private:
17360
17449
 
17361
17450
  //! Internally prepare a SQL statement. Caller must hold the context_lock.
17362
17451
  shared_ptr<PreparedStatementData> CreatePreparedStatement(ClientContextLock &lock, const string &query,
17363
- unique_ptr<SQLStatement> statement);
17452
+ unique_ptr<SQLStatement> statement,
17453
+ vector<Value> *values = nullptr);
17364
17454
  unique_ptr<PendingQueryResult> PendingStatementInternal(ClientContextLock &lock, const string &query,
17365
17455
  unique_ptr<SQLStatement> statement);
17366
17456
  unique_ptr<QueryResult> RunStatementInternal(ClientContextLock &lock, const string &query,
@@ -17434,6 +17524,7 @@ private:
17434
17524
  } // namespace duckdb
17435
17525
 
17436
17526
 
17527
+
17437
17528
  #include <memory>
17438
17529
 
17439
17530
  namespace duckdb {
@@ -17445,8 +17536,6 @@ class LogicalOperator;
17445
17536
  class QueryNode;
17446
17537
  class TableRef;
17447
17538
 
17448
- class ExtraDependencies {};
17449
-
17450
17539
  class Relation : public std::enable_shared_from_this<Relation> {
17451
17540
  public:
17452
17541
  DUCKDB_API Relation(const std::shared_ptr<ClientContext> &context, RelationType type)
@@ -17461,7 +17550,7 @@ public:
17461
17550
 
17462
17551
  RelationType type;
17463
17552
 
17464
- unique_ptr<ExtraDependencies> extra_dependencies;
17553
+ shared_ptr<ExternalDependency> extra_dependencies;
17465
17554
 
17466
17555
  public:
17467
17556
  DUCKDB_API virtual const vector<ColumnDefinition> &Columns() = 0;
@@ -17561,6 +17650,7 @@ public:
17561
17650
  DUCKDB_API virtual Relation *ChildRelation() {
17562
17651
  return nullptr;
17563
17652
  }
17653
+ DUCKDB_API vector<shared_ptr<ExternalDependency>> GetAllDependencies();
17564
17654
 
17565
17655
  protected:
17566
17656
  DUCKDB_API string RenderWhitespace(idx_t depth);
@@ -21844,6 +21934,8 @@ public:
21844
21934
 
21845
21935
 
21846
21936
 
21937
+ #include <algorithm>
21938
+
21847
21939
  namespace duckdb {
21848
21940
 
21849
21941
  enum class StrTimeSpecifier : uint8_t {
@@ -21891,7 +21983,11 @@ public:
21891
21983
  virtual ~StrTimeFormat() {
21892
21984
  }
21893
21985
 
21894
- static string ParseFormatSpecifier(const string &format_string, StrTimeFormat &format);
21986
+ DUCKDB_API static string ParseFormatSpecifier(const string &format_string, StrTimeFormat &format);
21987
+
21988
+ inline bool HasFormatSpecifier(StrTimeSpecifier s) const {
21989
+ return std::find(specifiers.begin(), specifiers.end(), s) != specifiers.end();
21990
+ }
21895
21991
 
21896
21992
  protected:
21897
21993
  //! The format specifiers
@@ -21907,13 +22003,13 @@ protected:
21907
22003
 
21908
22004
  protected:
21909
22005
  void AddLiteral(string literal);
21910
- virtual void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier);
22006
+ DUCKDB_API virtual void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier);
21911
22007
  };
21912
22008
 
21913
22009
  struct StrfTimeFormat : public StrTimeFormat {
21914
- idx_t GetLength(date_t date, dtime_t time);
22010
+ DUCKDB_API idx_t GetLength(date_t date, dtime_t time, int32_t utc_offset, const char *tz_name);
21915
22011
 
21916
- void FormatString(date_t date, int32_t data[7], char *target);
22012
+ DUCKDB_API void FormatString(date_t date, int32_t data[8], const char *tz_name, char *target);
21917
22013
  void FormatString(date_t date, dtime_t time, char *target);
21918
22014
 
21919
22015
  DUCKDB_API static string Format(timestamp_t timestamp, const string &format);
@@ -21926,8 +22022,9 @@ protected:
21926
22022
  vector<bool> is_date_specifier;
21927
22023
 
21928
22024
  protected:
21929
- void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
21930
- static idx_t GetSpecifierLength(StrTimeSpecifier specifier, date_t date, dtime_t time);
22025
+ DUCKDB_API void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
22026
+ static idx_t GetSpecifierLength(StrTimeSpecifier specifier, date_t date, dtime_t time, int32_t utc_offset,
22027
+ const char *tz_name);
21931
22028
  char *WriteString(char *target, const string_t &str);
21932
22029
  char *Write2(char *target, uint8_t value);
21933
22030
  char *WritePadded2(char *target, uint32_t value);
@@ -21935,20 +22032,21 @@ protected:
21935
22032
  char *WritePadded(char *target, uint32_t value, size_t padding);
21936
22033
  bool IsDateSpecifier(StrTimeSpecifier specifier);
21937
22034
  char *WriteDateSpecifier(StrTimeSpecifier specifier, date_t date, char *target);
21938
- char *WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t data[], char *target);
22035
+ char *WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t data[], const char *tz_name, char *target);
21939
22036
  };
21940
22037
 
21941
22038
  struct StrpTimeFormat : public StrTimeFormat {
21942
22039
  public:
21943
22040
  //! Type-safe parsing argument
21944
22041
  struct ParseResult {
21945
- int32_t data[7];
22042
+ int32_t data[8]; // year, month, day, hour, min, sec, µs, offset
22043
+ string tz;
21946
22044
  string error_message;
21947
22045
  idx_t error_position = DConstants::INVALID_INDEX;
21948
22046
 
21949
22047
  date_t ToDate();
21950
22048
  timestamp_t ToTimestamp();
21951
- string FormatError(string_t input, const string &format_specifier);
22049
+ DUCKDB_API string FormatError(string_t input, const string &format_specifier);
21952
22050
  };
21953
22051
 
21954
22052
  public:
@@ -21958,7 +22056,7 @@ public:
21958
22056
  public:
21959
22057
  DUCKDB_API static ParseResult Parse(const string &format, const string &text);
21960
22058
 
21961
- bool Parse(string_t str, ParseResult &result);
22059
+ DUCKDB_API bool Parse(string_t str, ParseResult &result);
21962
22060
 
21963
22061
  bool TryParseDate(string_t str, date_t &result, string &error_message);
21964
22062
  bool TryParseTimestamp(string_t str, timestamp_t &result, string &error_message);
@@ -21968,7 +22066,7 @@ public:
21968
22066
 
21969
22067
  protected:
21970
22068
  static string FormatStrpTimeError(const string &input, idx_t position);
21971
- void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
22069
+ DUCKDB_API void AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) override;
21972
22070
  int NumericSpecifierWidth(StrTimeSpecifier specifier);
21973
22071
  int32_t TryParseCollection(const char *data, idx_t &pos, idx_t size, const string_t collection[],
21974
22072
  idx_t collection_count);
@@ -22019,13 +22117,10 @@ struct TextSearchShiftArray {
22019
22117
  };
22020
22118
 
22021
22119
  struct BufferedCSVReaderOptions {
22022
- //! The file path of the CSV file to read
22023
- string file_path;
22024
- //! Whether file is compressed or not, and if so which compression type
22025
- //! AUTO_DETECT (default; infer from file extension)
22026
- FileCompressionType compression = FileCompressionType::AUTO_DETECT;
22027
- //! Whether or not to automatically detect dialect and datatypes
22028
- bool auto_detect = false;
22120
+ //===--------------------------------------------------------------------===//
22121
+ // CommonCSVOptions
22122
+ //===--------------------------------------------------------------------===//
22123
+
22029
22124
  //! Whether or not a delimiter was defined by the user
22030
22125
  bool has_delimiter = false;
22031
22126
  //! Delimiter to separate columns within each line
@@ -22042,26 +22137,51 @@ struct BufferedCSVReaderOptions {
22042
22137
  bool has_header = false;
22043
22138
  //! Whether or not the file has a header line
22044
22139
  bool header = false;
22045
- //! Whether or not header names shall be normalized
22046
- bool normalize_names = false;
22047
- //! How many leading rows to skip
22048
- idx_t skip_rows = 0;
22140
+ //! Whether or not we should ignore InvalidInput errors
22141
+ bool ignore_errors = false;
22049
22142
  //! Expected number of columns
22050
22143
  idx_t num_cols = 0;
22144
+ //! Number of samples to buffer
22145
+ idx_t buffer_size = STANDARD_VECTOR_SIZE * 100;
22051
22146
  //! Specifies the string that represents a null value
22052
22147
  string null_str;
22148
+ //! Whether file is compressed or not, and if so which compression type
22149
+ //! AUTO_DETECT (default; infer from file extension)
22150
+ FileCompressionType compression = FileCompressionType::AUTO_DETECT;
22151
+
22152
+ //===--------------------------------------------------------------------===//
22153
+ // ReadCSVOptions
22154
+ //===--------------------------------------------------------------------===//
22155
+
22156
+ //! How many leading rows to skip
22157
+ idx_t skip_rows = 0;
22158
+ //! Maximum CSV line size: specified because if we reach this amount, we likely have wrong delimiters (default: 2MB)
22159
+ idx_t maximum_line_size = 2097152;
22160
+ //! Whether or not header names shall be normalized
22161
+ bool normalize_names = false;
22053
22162
  //! True, if column with that index must skip null check
22054
22163
  vector<bool> force_not_null;
22164
+ //! Consider all columns to be of type varchar
22165
+ bool all_varchar = false;
22055
22166
  //! Size of sample chunk used for dialect and type detection
22056
22167
  idx_t sample_chunk_size = STANDARD_VECTOR_SIZE;
22057
22168
  //! Number of sample chunks used for type detection
22058
22169
  idx_t sample_chunks = 10;
22059
- //! Number of samples to buffer
22060
- idx_t buffer_size = STANDARD_VECTOR_SIZE * 100;
22061
- //! Consider all columns to be of type varchar
22062
- bool all_varchar = false;
22063
- //! Maximum CSV line size: specified because if we reach this amount, we likely have wrong delimiters (default: 2MB)
22064
- idx_t maximum_line_size = 2097152;
22170
+ //! Whether or not to automatically detect dialect and datatypes
22171
+ bool auto_detect = false;
22172
+ //! The file path of the CSV file to read
22173
+ string file_path;
22174
+ //! Whether or not to include a file name column
22175
+ bool include_file_name = false;
22176
+
22177
+ //===--------------------------------------------------------------------===//
22178
+ // WriteCSVOptions
22179
+ //===--------------------------------------------------------------------===//
22180
+
22181
+ //! The column names of the columns to write
22182
+ vector<string> names;
22183
+ //! True, if column with that index must be quoted
22184
+ vector<bool> force_quote;
22065
22185
 
22066
22186
  //! The date format to use (if any is specified)
22067
22187
  std::map<LogicalTypeId, StrpTimeFormat> date_format = {{LogicalTypeId::DATE, {}}, {LogicalTypeId::TIMESTAMP, {}}};
@@ -22069,6 +22189,16 @@ struct BufferedCSVReaderOptions {
22069
22189
  std::map<LogicalTypeId, bool> has_format = {{LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}};
22070
22190
 
22071
22191
  void SetDelimiter(const string &delimiter);
22192
+ //! Set an option that is supported by both reading and writing functions, called by
22193
+ //! the SetReadOption and SetWriteOption methods
22194
+ bool SetBaseOption(const string &loption, const Value &value);
22195
+
22196
+ //! loption - lowercase string
22197
+ //! set - argument(s) to the option
22198
+ //! expected_names - names expected if the option is "columns"
22199
+ void SetReadOption(const string &loption, const Value &value, vector<string> &expected_names);
22200
+
22201
+ void SetWriteOption(const string &loption, const Value &value);
22072
22202
 
22073
22203
  std::string ToString() const;
22074
22204
  };
@@ -22194,6 +22324,10 @@ private:
22194
22324
  const vector<LogicalType> &requested_types,
22195
22325
  vector<vector<LogicalType>> &best_sql_types_candidates,
22196
22326
  map<LogicalTypeId, vector<string>> &best_format_candidates);
22327
+
22328
+ private:
22329
+ //! Whether or not the current row's columns have overflown sql_types.size()
22330
+ bool error_column_overflow = false;
22197
22331
  };
22198
22332
 
22199
22333
  } // namespace duckdb
@@ -22383,7 +22517,7 @@ public:
22383
22517
  //===----------------------------------------------------------------------===//
22384
22518
  // DuckDB
22385
22519
  //
22386
- // duckdb/parser/expression/collate_expression.hpp
22520
+ // duckdb/parser/expression/star_expression.hpp
22387
22521
  //
22388
22522
  //
22389
22523
  //===----------------------------------------------------------------------===//
@@ -22392,22 +22526,25 @@ public:
22392
22526
 
22393
22527
 
22394
22528
 
22529
+
22395
22530
  namespace duckdb {
22396
22531
 
22397
- //! CollateExpression represents a COLLATE statement
22398
- class CollateExpression : public ParsedExpression {
22532
+ //! Represents a * expression in the SELECT clause
22533
+ class StarExpression : public ParsedExpression {
22399
22534
  public:
22400
- CollateExpression(string collation, unique_ptr<ParsedExpression> child);
22535
+ StarExpression(string relation_name = string());
22401
22536
 
22402
- //! The child of the cast expression
22403
- unique_ptr<ParsedExpression> child;
22404
- //! The collation clause
22405
- string collation;
22537
+ //! The relation name in case of tbl.*, or empty if this is a normal *
22538
+ string relation_name;
22539
+ //! List of columns to exclude from the STAR expression
22540
+ case_insensitive_set_t exclude_list;
22541
+ //! List of columns to replace with another expression
22542
+ case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
22406
22543
 
22407
22544
  public:
22408
22545
  string ToString() const override;
22409
22546
 
22410
- static bool Equals(const CollateExpression *a, const CollateExpression *b);
22547
+ static bool Equals(const StarExpression *a, const StarExpression *b);
22411
22548
 
22412
22549
  unique_ptr<ParsedExpression> Copy() const override;
22413
22550
 
@@ -22418,7 +22555,7 @@ public:
22418
22555
  //===----------------------------------------------------------------------===//
22419
22556
  // DuckDB
22420
22557
  //
22421
- // duckdb/parser/expression/between_expression.hpp
22558
+ // duckdb/parser/expression/default_expression.hpp
22422
22559
  //
22423
22560
  //
22424
22561
  //===----------------------------------------------------------------------===//
@@ -22428,39 +22565,28 @@ public:
22428
22565
 
22429
22566
 
22430
22567
  namespace duckdb {
22431
-
22432
- class BetweenExpression : public ParsedExpression {
22568
+ //! Represents the default value of a column
22569
+ class DefaultExpression : public ParsedExpression {
22433
22570
  public:
22434
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22435
- unique_ptr<ParsedExpression> upper);
22436
-
22437
- unique_ptr<ParsedExpression> input;
22438
- unique_ptr<ParsedExpression> lower;
22439
- unique_ptr<ParsedExpression> upper;
22571
+ DefaultExpression();
22440
22572
 
22441
22573
  public:
22442
- string ToString() const override;
22574
+ bool IsScalar() const override {
22575
+ return false;
22576
+ }
22443
22577
 
22444
- static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22578
+ string ToString() const override;
22445
22579
 
22446
22580
  unique_ptr<ParsedExpression> Copy() const override;
22447
22581
 
22448
22582
  void Serialize(FieldWriter &writer) const override;
22449
22583
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22450
-
22451
- public:
22452
- template <class T, class BASE>
22453
- static string ToString(const T &entry) {
22454
- return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22455
- }
22456
22584
  };
22457
22585
  } // namespace duckdb
22458
-
22459
-
22460
22586
  //===----------------------------------------------------------------------===//
22461
22587
  // DuckDB
22462
22588
  //
22463
- // duckdb/parser/expression/case_expression.hpp
22589
+ // duckdb/parser/expression/operator_expression.hpp
22464
22590
  //
22465
22591
  //
22466
22592
  //===----------------------------------------------------------------------===//
@@ -22470,25 +22596,22 @@ public:
22470
22596
 
22471
22597
 
22472
22598
 
22473
- namespace duckdb {
22474
22599
 
22475
- struct CaseCheck {
22476
- unique_ptr<ParsedExpression> when_expr;
22477
- unique_ptr<ParsedExpression> then_expr;
22478
- };
22479
22600
 
22480
- //! The CaseExpression represents a CASE expression in the query
22481
- class CaseExpression : public ParsedExpression {
22601
+ namespace duckdb {
22602
+ //! Represents a built-in operator expression
22603
+ class OperatorExpression : public ParsedExpression {
22482
22604
  public:
22483
- DUCKDB_API CaseExpression();
22605
+ DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
22606
+ unique_ptr<ParsedExpression> right = nullptr);
22607
+ DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22484
22608
 
22485
- vector<CaseCheck> case_checks;
22486
- unique_ptr<ParsedExpression> else_expr;
22609
+ vector<unique_ptr<ParsedExpression>> children;
22487
22610
 
22488
22611
  public:
22489
22612
  string ToString() const override;
22490
22613
 
22491
- static bool Equals(const CaseExpression *a, const CaseExpression *b);
22614
+ static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
22492
22615
 
22493
22616
  unique_ptr<ParsedExpression> Copy() const override;
22494
22617
 
@@ -22498,22 +22621,72 @@ public:
22498
22621
  public:
22499
22622
  template <class T, class BASE>
22500
22623
  static string ToString(const T &entry) {
22501
- string case_str = "CASE ";
22502
- for (auto &check : entry.case_checks) {
22503
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
22504
- case_str += " THEN (" + check.then_expr->ToString() + ")";
22624
+ auto op = ExpressionTypeToOperator(entry.type);
22625
+ if (!op.empty()) {
22626
+ // use the operator string to represent the operator
22627
+ D_ASSERT(entry.children.size() == 2);
22628
+ return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
22629
+ }
22630
+ switch (entry.type) {
22631
+ case ExpressionType::COMPARE_IN:
22632
+ case ExpressionType::COMPARE_NOT_IN: {
22633
+ string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
22634
+ string in_child = entry.children[0]->ToString();
22635
+ string child_list = "(";
22636
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22637
+ if (i > 1) {
22638
+ child_list += ", ";
22639
+ }
22640
+ child_list += entry.children[i]->ToString();
22641
+ }
22642
+ child_list += ")";
22643
+ return "(" + in_child + op_type + child_list + ")";
22644
+ }
22645
+ case ExpressionType::OPERATOR_NOT:
22646
+ case ExpressionType::GROUPING_FUNCTION:
22647
+ case ExpressionType::OPERATOR_COALESCE: {
22648
+ string result = ExpressionTypeToString(entry.type);
22649
+ result += "(";
22650
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22651
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
22652
+ result += ")";
22653
+ return result;
22654
+ }
22655
+ case ExpressionType::OPERATOR_IS_NULL:
22656
+ return "(" + entry.children[0]->ToString() + " IS NULL)";
22657
+ case ExpressionType::OPERATOR_IS_NOT_NULL:
22658
+ return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
22659
+ case ExpressionType::ARRAY_EXTRACT:
22660
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
22661
+ case ExpressionType::ARRAY_SLICE:
22662
+ return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
22663
+ entry.children[2]->ToString() + "]";
22664
+ case ExpressionType::STRUCT_EXTRACT: {
22665
+ D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
22666
+ auto child_string = entry.children[1]->ToString();
22667
+ D_ASSERT(child_string.size() >= 3);
22668
+ D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
22669
+ return "(" + entry.children[0]->ToString() + ")." +
22670
+ KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
22671
+ }
22672
+ case ExpressionType::ARRAY_CONSTRUCTOR: {
22673
+ string result = "(ARRAY[";
22674
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22675
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
22676
+ result += "])";
22677
+ return result;
22678
+ }
22679
+ default:
22680
+ throw InternalException("Unrecognized operator type");
22505
22681
  }
22506
- case_str += " ELSE " + entry.else_expr->ToString();
22507
- case_str += " END";
22508
- return case_str;
22509
22682
  }
22510
22683
  };
22511
- } // namespace duckdb
22512
22684
 
22685
+ } // namespace duckdb
22513
22686
  //===----------------------------------------------------------------------===//
22514
22687
  // DuckDB
22515
22688
  //
22516
- // duckdb/parser/expression/cast_expression.hpp
22689
+ // duckdb/parser/expression/conjunction_expression.hpp
22517
22690
  //
22518
22691
  //
22519
22692
  //===----------------------------------------------------------------------===//
@@ -22525,22 +22698,22 @@ public:
22525
22698
 
22526
22699
  namespace duckdb {
22527
22700
 
22528
- //! CastExpression represents a type cast from one SQL type to another SQL type
22529
- class CastExpression : public ParsedExpression {
22701
+ //! Represents a conjunction (AND/OR)
22702
+ class ConjunctionExpression : public ParsedExpression {
22530
22703
  public:
22531
- DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22704
+ DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22705
+ DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22706
+ DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22707
+ unique_ptr<ParsedExpression> right);
22532
22708
 
22533
- //! The child of the cast expression
22534
- unique_ptr<ParsedExpression> child;
22535
- //! The type to cast to
22536
- LogicalType cast_type;
22537
- //! Whether or not this is a try_cast expression
22538
- bool try_cast;
22709
+ vector<unique_ptr<ParsedExpression>> children;
22539
22710
 
22540
22711
  public:
22712
+ void AddExpression(unique_ptr<ParsedExpression> expr);
22713
+
22541
22714
  string ToString() const override;
22542
22715
 
22543
- static bool Equals(const CastExpression *a, const CastExpression *b);
22716
+ static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22544
22717
 
22545
22718
  unique_ptr<ParsedExpression> Copy() const override;
22546
22719
 
@@ -22550,18 +22723,54 @@ public:
22550
22723
  public:
22551
22724
  template <class T, class BASE>
22552
22725
  static string ToString(const T &entry) {
22553
- return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22554
- entry.cast_type.ToString() + ")";
22726
+ string result = "(" + entry.children[0]->ToString();
22727
+ for (idx_t i = 1; i < entry.children.size(); i++) {
22728
+ result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22729
+ }
22730
+ return result + ")";
22555
22731
  }
22556
22732
  };
22557
22733
  } // namespace duckdb
22734
+ //===----------------------------------------------------------------------===//
22735
+ // DuckDB
22736
+ //
22737
+ // duckdb/parser/expression/constant_expression.hpp
22738
+ //
22739
+ //
22740
+ //===----------------------------------------------------------------------===//
22741
+
22742
+
22558
22743
 
22559
22744
 
22560
22745
 
22746
+
22747
+ namespace duckdb {
22748
+
22749
+ //! ConstantExpression represents a constant value in the query
22750
+ class ConstantExpression : public ParsedExpression {
22751
+ public:
22752
+ DUCKDB_API explicit ConstantExpression(Value val);
22753
+
22754
+ //! The constant value referenced
22755
+ Value value;
22756
+
22757
+ public:
22758
+ string ToString() const override;
22759
+
22760
+ static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22761
+ hash_t Hash() const override;
22762
+
22763
+ unique_ptr<ParsedExpression> Copy() const override;
22764
+
22765
+ void Serialize(FieldWriter &writer) const override;
22766
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22767
+ };
22768
+
22769
+ } // namespace duckdb
22561
22770
  //===----------------------------------------------------------------------===//
22562
22771
  // DuckDB
22563
22772
  //
22564
- // duckdb/parser/expression/comparison_expression.hpp
22773
+ // duckdb/parser/expression/case_expression.hpp
22565
22774
  //
22566
22775
  //
22567
22776
  //===----------------------------------------------------------------------===//
@@ -22570,21 +22779,26 @@ public:
22570
22779
 
22571
22780
 
22572
22781
 
22782
+
22573
22783
  namespace duckdb {
22574
- //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22575
- //! and has two children.
22576
- class ComparisonExpression : public ParsedExpression {
22784
+
22785
+ struct CaseCheck {
22786
+ unique_ptr<ParsedExpression> when_expr;
22787
+ unique_ptr<ParsedExpression> then_expr;
22788
+ };
22789
+
22790
+ //! The CaseExpression represents a CASE expression in the query
22791
+ class CaseExpression : public ParsedExpression {
22577
22792
  public:
22578
- DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22579
- unique_ptr<ParsedExpression> right);
22793
+ DUCKDB_API CaseExpression();
22580
22794
 
22581
- unique_ptr<ParsedExpression> left;
22582
- unique_ptr<ParsedExpression> right;
22795
+ vector<CaseCheck> case_checks;
22796
+ unique_ptr<ParsedExpression> else_expr;
22583
22797
 
22584
22798
  public:
22585
22799
  string ToString() const override;
22586
22800
 
22587
- static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22801
+ static bool Equals(const CaseExpression *a, const CaseExpression *b);
22588
22802
 
22589
22803
  unique_ptr<ParsedExpression> Copy() const override;
22590
22804
 
@@ -22594,15 +22808,21 @@ public:
22594
22808
  public:
22595
22809
  template <class T, class BASE>
22596
22810
  static string ToString(const T &entry) {
22597
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22811
+ string case_str = "CASE ";
22812
+ for (auto &check : entry.case_checks) {
22813
+ case_str += " WHEN (" + check.when_expr->ToString() + ")";
22814
+ case_str += " THEN (" + check.then_expr->ToString() + ")";
22815
+ }
22816
+ case_str += " ELSE " + entry.else_expr->ToString();
22817
+ case_str += " END";
22818
+ return case_str;
22598
22819
  }
22599
22820
  };
22600
22821
  } // namespace duckdb
22601
-
22602
22822
  //===----------------------------------------------------------------------===//
22603
22823
  // DuckDB
22604
22824
  //
22605
- // duckdb/parser/expression/conjunction_expression.hpp
22825
+ // duckdb/parser/expression/between_expression.hpp
22606
22826
  //
22607
22827
  //
22608
22828
  //===----------------------------------------------------------------------===//
@@ -22611,25 +22831,21 @@ public:
22611
22831
 
22612
22832
 
22613
22833
 
22614
-
22615
22834
  namespace duckdb {
22616
22835
 
22617
- //! Represents a conjunction (AND/OR)
22618
- class ConjunctionExpression : public ParsedExpression {
22836
+ class BetweenExpression : public ParsedExpression {
22619
22837
  public:
22620
- DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
22621
- DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
22622
- DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22623
- unique_ptr<ParsedExpression> right);
22838
+ BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22839
+ unique_ptr<ParsedExpression> upper);
22624
22840
 
22625
- vector<unique_ptr<ParsedExpression>> children;
22841
+ unique_ptr<ParsedExpression> input;
22842
+ unique_ptr<ParsedExpression> lower;
22843
+ unique_ptr<ParsedExpression> upper;
22626
22844
 
22627
22845
  public:
22628
- void AddExpression(unique_ptr<ParsedExpression> expr);
22629
-
22630
22846
  string ToString() const override;
22631
22847
 
22632
- static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
22848
+ static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
22633
22849
 
22634
22850
  unique_ptr<ParsedExpression> Copy() const override;
22635
22851
 
@@ -22639,19 +22855,17 @@ public:
22639
22855
  public:
22640
22856
  template <class T, class BASE>
22641
22857
  static string ToString(const T &entry) {
22642
- string result = entry.children[0]->ToString();
22643
- for (idx_t i = 1; i < entry.children.size(); i++) {
22644
- result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
22645
- }
22646
- return result;
22858
+ return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
22647
22859
  }
22648
22860
  };
22649
22861
  } // namespace duckdb
22650
22862
 
22863
+
22864
+
22651
22865
  //===----------------------------------------------------------------------===//
22652
22866
  // DuckDB
22653
22867
  //
22654
- // duckdb/parser/expression/constant_expression.hpp
22868
+ // duckdb/parser/expression/cast_expression.hpp
22655
22869
  //
22656
22870
  //
22657
22871
  //===----------------------------------------------------------------------===//
@@ -22663,32 +22877,41 @@ public:
22663
22877
 
22664
22878
  namespace duckdb {
22665
22879
 
22666
- //! ConstantExpression represents a constant value in the query
22667
- class ConstantExpression : public ParsedExpression {
22880
+ //! CastExpression represents a type cast from one SQL type to another SQL type
22881
+ class CastExpression : public ParsedExpression {
22668
22882
  public:
22669
- DUCKDB_API explicit ConstantExpression(Value val);
22883
+ DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
22670
22884
 
22671
- //! The constant value referenced
22672
- Value value;
22885
+ //! The child of the cast expression
22886
+ unique_ptr<ParsedExpression> child;
22887
+ //! The type to cast to
22888
+ LogicalType cast_type;
22889
+ //! Whether or not this is a try_cast expression
22890
+ bool try_cast;
22673
22891
 
22674
22892
  public:
22675
22893
  string ToString() const override;
22676
22894
 
22677
- static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
22678
- hash_t Hash() const override;
22895
+ static bool Equals(const CastExpression *a, const CastExpression *b);
22679
22896
 
22680
22897
  unique_ptr<ParsedExpression> Copy() const override;
22681
22898
 
22682
22899
  void Serialize(FieldWriter &writer) const override;
22683
22900
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22684
- };
22685
22901
 
22902
+ public:
22903
+ template <class T, class BASE>
22904
+ static string ToString(const T &entry) {
22905
+ return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
22906
+ entry.cast_type.ToString() + ")";
22907
+ }
22908
+ };
22686
22909
  } // namespace duckdb
22687
22910
 
22688
22911
  //===----------------------------------------------------------------------===//
22689
22912
  // DuckDB
22690
22913
  //
22691
- // duckdb/parser/expression/default_expression.hpp
22914
+ // duckdb/parser/expression/collate_expression.hpp
22692
22915
  //
22693
22916
  //
22694
22917
  //===----------------------------------------------------------------------===//
@@ -22698,25 +22921,74 @@ public:
22698
22921
 
22699
22922
 
22700
22923
  namespace duckdb {
22701
- //! Represents the default value of a column
22702
- class DefaultExpression : public ParsedExpression {
22924
+
22925
+ //! CollateExpression represents a COLLATE statement
22926
+ class CollateExpression : public ParsedExpression {
22703
22927
  public:
22704
- DefaultExpression();
22928
+ CollateExpression(string collation, unique_ptr<ParsedExpression> child);
22929
+
22930
+ //! The child of the cast expression
22931
+ unique_ptr<ParsedExpression> child;
22932
+ //! The collation clause
22933
+ string collation;
22705
22934
 
22706
22935
  public:
22707
- bool IsScalar() const override {
22708
- return false;
22709
- }
22936
+ string ToString() const override;
22937
+
22938
+ static bool Equals(const CollateExpression *a, const CollateExpression *b);
22939
+
22940
+ unique_ptr<ParsedExpression> Copy() const override;
22941
+
22942
+ void Serialize(FieldWriter &writer) const override;
22943
+ static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22944
+ };
22945
+ } // namespace duckdb
22946
+
22947
+
22948
+ //===----------------------------------------------------------------------===//
22949
+ // DuckDB
22950
+ //
22951
+ // duckdb/parser/expression/comparison_expression.hpp
22952
+ //
22953
+ //
22954
+ //===----------------------------------------------------------------------===//
22955
+
22956
+
22957
+
22958
+
22959
+
22960
+ namespace duckdb {
22961
+ //! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
22962
+ //! and has two children.
22963
+ class ComparisonExpression : public ParsedExpression {
22964
+ public:
22965
+ DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
22966
+ unique_ptr<ParsedExpression> right);
22967
+
22968
+ unique_ptr<ParsedExpression> left;
22969
+ unique_ptr<ParsedExpression> right;
22710
22970
 
22971
+ public:
22711
22972
  string ToString() const override;
22712
22973
 
22974
+ static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
22975
+
22713
22976
  unique_ptr<ParsedExpression> Copy() const override;
22714
22977
 
22715
22978
  void Serialize(FieldWriter &writer) const override;
22716
22979
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22980
+
22981
+ public:
22982
+ template <class T, class BASE>
22983
+ static string ToString(const T &entry) {
22984
+ return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
22985
+ }
22717
22986
  };
22718
22987
  } // namespace duckdb
22719
22988
 
22989
+
22990
+
22991
+
22720
22992
  //===----------------------------------------------------------------------===//
22721
22993
  // DuckDB
22722
22994
  //
@@ -22779,7 +23051,7 @@ public:
22779
23051
  template <class T, class BASE>
22780
23052
  static string ToString(const T &entry, const string &schema, const string &function_name, bool is_operator = false,
22781
23053
  bool distinct = false, BASE *filter = nullptr, OrderModifier *order_bys = nullptr,
22782
- bool export_state = false) {
23054
+ bool export_state = false, bool add_alias = false) {
22783
23055
  if (is_operator) {
22784
23056
  // built-in operator
22785
23057
  D_ASSERT(!distinct);
@@ -22801,8 +23073,11 @@ public:
22801
23073
  if (distinct) {
22802
23074
  result += "DISTINCT ";
22803
23075
  }
22804
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22805
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
23076
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ", [&](const unique_ptr<BASE> &child) {
23077
+ return child->alias.empty() || !add_alias
23078
+ ? child->ToString()
23079
+ : KeywordHelper::WriteOptionallyQuoted(child->alias) + " := " + child->ToString();
23080
+ });
22806
23081
  // ordered aggregate
22807
23082
  if (order_bys && !order_bys->orders.empty()) {
22808
23083
  if (entry.children.empty()) {
@@ -22833,10 +23108,11 @@ public:
22833
23108
  } // namespace duckdb
22834
23109
 
22835
23110
 
23111
+
22836
23112
  //===----------------------------------------------------------------------===//
22837
23113
  // DuckDB
22838
23114
  //
22839
- // duckdb/parser/expression/operator_expression.hpp
23115
+ // duckdb/parser/expression/parameter_expression.hpp
22840
23116
  //
22841
23117
  //
22842
23118
  //===----------------------------------------------------------------------===//
@@ -22845,146 +23121,45 @@ public:
22845
23121
 
22846
23122
 
22847
23123
 
22848
-
22849
-
22850
-
22851
23124
  namespace duckdb {
22852
- //! Represents a built-in operator expression
22853
- class OperatorExpression : public ParsedExpression {
23125
+ class ParameterExpression : public ParsedExpression {
22854
23126
  public:
22855
- DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
22856
- unique_ptr<ParsedExpression> right = nullptr);
22857
- DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
23127
+ ParameterExpression();
22858
23128
 
22859
- vector<unique_ptr<ParsedExpression>> children;
23129
+ idx_t parameter_nr;
22860
23130
 
22861
23131
  public:
22862
- string ToString() const override;
23132
+ bool IsScalar() const override {
23133
+ return true;
23134
+ }
23135
+ bool HasParameter() const override {
23136
+ return true;
23137
+ }
22863
23138
 
22864
- static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
23139
+ string ToString() const override;
22865
23140
 
22866
23141
  unique_ptr<ParsedExpression> Copy() const override;
23142
+ hash_t Hash() const override;
22867
23143
 
22868
23144
  void Serialize(FieldWriter &writer) const override;
22869
23145
  static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23146
+ };
23147
+ } // namespace duckdb
23148
+
23149
+ //===----------------------------------------------------------------------===//
23150
+ // DuckDB
23151
+ //
23152
+ // duckdb/parser/expression/positional_reference_expression.hpp
23153
+ //
23154
+ //
23155
+ //===----------------------------------------------------------------------===//
23156
+
22870
23157
 
22871
- public:
22872
- template <class T, class BASE>
22873
- static string ToString(const T &entry) {
22874
- auto op = ExpressionTypeToOperator(entry.type);
22875
- if (!op.empty()) {
22876
- // use the operator string to represent the operator
22877
- D_ASSERT(entry.children.size() == 2);
22878
- return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
22879
- }
22880
- switch (entry.type) {
22881
- case ExpressionType::COMPARE_IN:
22882
- case ExpressionType::COMPARE_NOT_IN: {
22883
- string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
22884
- string in_child = entry.children[0]->ToString();
22885
- string child_list = "(";
22886
- for (idx_t i = 1; i < entry.children.size(); i++) {
22887
- if (i > 1) {
22888
- child_list += ", ";
22889
- }
22890
- child_list += entry.children[i]->ToString();
22891
- }
22892
- child_list += ")";
22893
- return "(" + in_child + op_type + child_list + ")";
22894
- }
22895
- case ExpressionType::OPERATOR_NOT:
22896
- case ExpressionType::GROUPING_FUNCTION:
22897
- case ExpressionType::OPERATOR_COALESCE: {
22898
- string result = ExpressionTypeToString(entry.type);
22899
- result += "(";
22900
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22901
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
22902
- result += ")";
22903
- return result;
22904
- }
22905
- case ExpressionType::OPERATOR_IS_NULL:
22906
- return "(" + entry.children[0]->ToString() + " IS NULL)";
22907
- case ExpressionType::OPERATOR_IS_NOT_NULL:
22908
- return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
22909
- case ExpressionType::ARRAY_EXTRACT:
22910
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
22911
- case ExpressionType::ARRAY_SLICE:
22912
- return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
22913
- entry.children[2]->ToString() + "]";
22914
- case ExpressionType::STRUCT_EXTRACT: {
22915
- D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
22916
- auto child_string = entry.children[1]->ToString();
22917
- D_ASSERT(child_string.size() >= 3);
22918
- D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
22919
- return "(" + entry.children[0]->ToString() + ")." +
22920
- KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
22921
- }
22922
- case ExpressionType::ARRAY_CONSTRUCTOR: {
22923
- string result = "ARRAY[";
22924
- result += StringUtil::Join(entry.children, entry.children.size(), ", ",
22925
- [](const unique_ptr<BASE> &child) { return child->ToString(); });
22926
- result += "]";
22927
- return result;
22928
- }
22929
- default:
22930
- throw InternalException("Unrecognized operator type");
22931
- }
22932
- }
22933
- };
22934
-
22935
- } // namespace duckdb
22936
-
22937
- //===----------------------------------------------------------------------===//
22938
- // DuckDB
22939
- //
22940
- // duckdb/parser/expression/parameter_expression.hpp
22941
- //
22942
- //
22943
- //===----------------------------------------------------------------------===//
22944
-
22945
-
22946
-
22947
-
22948
-
22949
- namespace duckdb {
22950
- class ParameterExpression : public ParsedExpression {
22951
- public:
22952
- ParameterExpression();
22953
-
22954
- idx_t parameter_nr;
22955
-
22956
- public:
22957
- bool IsScalar() const override {
22958
- return true;
22959
- }
22960
- bool HasParameter() const override {
22961
- return true;
22962
- }
22963
-
22964
- string ToString() const override;
22965
-
22966
- unique_ptr<ParsedExpression> Copy() const override;
22967
- hash_t Hash() const override;
22968
-
22969
- void Serialize(FieldWriter &writer) const override;
22970
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
22971
- };
22972
- } // namespace duckdb
22973
-
22974
- //===----------------------------------------------------------------------===//
22975
- // DuckDB
22976
- //
22977
- // duckdb/parser/expression/positional_reference_expression.hpp
22978
- //
22979
- //
22980
- //===----------------------------------------------------------------------===//
22981
-
22982
-
22983
-
22984
-
22985
-
22986
- namespace duckdb {
22987
- class PositionalReferenceExpression : public ParsedExpression {
23158
+
23159
+
23160
+
23161
+ namespace duckdb {
23162
+ class PositionalReferenceExpression : public ParsedExpression {
22988
23163
  public:
22989
23164
  DUCKDB_API PositionalReferenceExpression(idx_t index);
22990
23165
 
@@ -23006,44 +23181,6 @@ public:
23006
23181
  };
23007
23182
  } // namespace duckdb
23008
23183
 
23009
- //===----------------------------------------------------------------------===//
23010
- // DuckDB
23011
- //
23012
- // duckdb/parser/expression/star_expression.hpp
23013
- //
23014
- //
23015
- //===----------------------------------------------------------------------===//
23016
-
23017
-
23018
-
23019
-
23020
-
23021
-
23022
- namespace duckdb {
23023
-
23024
- //! Represents a * expression in the SELECT clause
23025
- class StarExpression : public ParsedExpression {
23026
- public:
23027
- StarExpression(string relation_name = string());
23028
-
23029
- //! The relation name in case of tbl.*, or empty if this is a normal *
23030
- string relation_name;
23031
- //! List of columns to exclude from the STAR expression
23032
- case_insensitive_set_t exclude_list;
23033
- //! List of columns to replace with another expression
23034
- case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
23035
-
23036
- public:
23037
- string ToString() const override;
23038
-
23039
- static bool Equals(const StarExpression *a, const StarExpression *b);
23040
-
23041
- unique_ptr<ParsedExpression> Copy() const override;
23042
-
23043
- void Serialize(FieldWriter &writer) const override;
23044
- static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
23045
- };
23046
- } // namespace duckdb
23047
23184
 
23048
23185
  //===----------------------------------------------------------------------===//
23049
23186
  // DuckDB
@@ -23099,7 +23236,7 @@ public:
23099
23236
  //===----------------------------------------------------------------------===//
23100
23237
  // DuckDB
23101
23238
  //
23102
- // duckdb/parser/parsed_data/create_collation_info.hpp
23239
+ // duckdb/parser/parsed_data/export_table_data.hpp
23103
23240
  //
23104
23241
  //
23105
23242
  //===----------------------------------------------------------------------===//
@@ -23111,112 +23248,24 @@ public:
23111
23248
 
23112
23249
  namespace duckdb {
23113
23250
 
23114
- struct CreateCollationInfo : public CreateInfo {
23115
- CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23116
- : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23117
- not_required_for_equality(not_required_for_equality_p) {
23118
- this->name = move(name_p);
23119
- }
23120
-
23121
- //! The name of the collation
23122
- string name;
23123
- //! The collation function to push in case collation is required
23124
- ScalarFunction function;
23125
- //! Whether or not the collation can be combined with other collations.
23126
- bool combinable;
23127
- //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23128
- //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23129
- //! speeds up processing.
23130
- bool not_required_for_equality;
23131
-
23132
- public:
23133
- unique_ptr<CreateInfo> Copy() const override {
23134
- auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23135
- CopyProperties(*result);
23136
- return move(result);
23137
- }
23138
- };
23139
-
23140
- } // namespace duckdb
23141
- //===----------------------------------------------------------------------===//
23142
- // DuckDB
23143
- //
23144
- // duckdb/parser/parsed_data/create_schema_info.hpp
23145
- //
23146
- //
23147
- //===----------------------------------------------------------------------===//
23148
-
23149
-
23150
-
23151
-
23152
-
23153
- namespace duckdb {
23251
+ struct ExportedTableData {
23252
+ //! Name of the exported table
23253
+ string table_name;
23154
23254
 
23155
- struct CreateSchemaInfo : public CreateInfo {
23156
- CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23157
- }
23255
+ //! Name of the schema
23256
+ string schema_name;
23158
23257
 
23159
- public:
23160
- unique_ptr<CreateInfo> Copy() const override {
23161
- auto result = make_unique<CreateSchemaInfo>();
23162
- CopyProperties(*result);
23163
- return move(result);
23164
- }
23258
+ //! Path to be exported
23259
+ string file_path;
23165
23260
  };
23166
23261
 
23167
- } // namespace duckdb
23168
- //===----------------------------------------------------------------------===//
23169
- // DuckDB
23170
- //
23171
- // duckdb/parser/parsed_data/show_select_info.hpp
23172
- //
23173
- //
23174
- //===----------------------------------------------------------------------===//
23175
-
23176
-
23177
-
23178
-
23179
-
23180
-
23181
- namespace duckdb {
23182
-
23183
- struct ShowSelectInfo : public ParseInfo {
23184
- //! Types of projected columns
23185
- vector<LogicalType> types;
23186
- //! The QueryNode of select query
23187
- unique_ptr<QueryNode> query;
23188
- //! Aliases of projected columns
23189
- vector<string> aliases;
23190
- //! Whether or not we are requesting a summary or a describe
23191
- bool is_summary;
23192
-
23193
- unique_ptr<ShowSelectInfo> Copy() {
23194
- auto result = make_unique<ShowSelectInfo>();
23195
- result->types = types;
23196
- result->query = query->Copy();
23197
- result->aliases = aliases;
23198
- result->is_summary = is_summary;
23199
- return result;
23200
- }
23262
+ struct ExportedTableInfo {
23263
+ TableCatalogEntry *entry;
23264
+ ExportedTableData table_data;
23201
23265
  };
23202
23266
 
23203
- } // namespace duckdb
23204
- //===----------------------------------------------------------------------===//
23205
- // DuckDB
23206
- //
23207
- // duckdb/parser/parsed_data/vacuum_info.hpp
23208
- //
23209
- //
23210
- //===----------------------------------------------------------------------===//
23211
-
23212
-
23213
-
23214
-
23215
-
23216
- namespace duckdb {
23217
-
23218
- struct VacuumInfo : public ParseInfo {
23219
- // nothing for now
23267
+ struct BoundExportData : public ParseInfo {
23268
+ std::vector<ExportedTableInfo> data;
23220
23269
  };
23221
23270
 
23222
23271
  } // namespace duckdb
@@ -23307,6 +23356,129 @@ public:
23307
23356
  }
23308
23357
  };
23309
23358
 
23359
+ } // namespace duckdb
23360
+ //===----------------------------------------------------------------------===//
23361
+ // DuckDB
23362
+ //
23363
+ // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23364
+ //
23365
+ //
23366
+ //===----------------------------------------------------------------------===//
23367
+
23368
+
23369
+
23370
+
23371
+
23372
+
23373
+ namespace duckdb {
23374
+
23375
+ struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23376
+ explicit CreateAggregateFunctionInfo(AggregateFunction function)
23377
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23378
+ this->name = function.name;
23379
+ functions.AddFunction(move(function));
23380
+ }
23381
+
23382
+ explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23383
+ : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23384
+ this->name = functions.name;
23385
+ for (auto &func : functions.functions) {
23386
+ func.name = functions.name;
23387
+ }
23388
+ }
23389
+
23390
+ AggregateFunctionSet functions;
23391
+
23392
+ public:
23393
+ unique_ptr<CreateInfo> Copy() const override {
23394
+ auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23395
+ CopyProperties(*result);
23396
+ return move(result);
23397
+ }
23398
+ };
23399
+
23400
+ } // namespace duckdb
23401
+ //===----------------------------------------------------------------------===//
23402
+ // DuckDB
23403
+ //
23404
+ // duckdb/parser/parsed_data/create_collation_info.hpp
23405
+ //
23406
+ //
23407
+ //===----------------------------------------------------------------------===//
23408
+
23409
+
23410
+
23411
+
23412
+
23413
+
23414
+ namespace duckdb {
23415
+
23416
+ struct CreateCollationInfo : public CreateInfo {
23417
+ CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
23418
+ : CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
23419
+ not_required_for_equality(not_required_for_equality_p) {
23420
+ this->name = move(name_p);
23421
+ }
23422
+
23423
+ //! The name of the collation
23424
+ string name;
23425
+ //! The collation function to push in case collation is required
23426
+ ScalarFunction function;
23427
+ //! Whether or not the collation can be combined with other collations.
23428
+ bool combinable;
23429
+ //! Whether or not the collation is required for equality comparisons or not. For many collations a binary
23430
+ //! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
23431
+ //! speeds up processing.
23432
+ bool not_required_for_equality;
23433
+
23434
+ public:
23435
+ unique_ptr<CreateInfo> Copy() const override {
23436
+ auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
23437
+ CopyProperties(*result);
23438
+ return move(result);
23439
+ }
23440
+ };
23441
+
23442
+ } // namespace duckdb
23443
+ //===----------------------------------------------------------------------===//
23444
+ // DuckDB
23445
+ //
23446
+ // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23447
+ //
23448
+ //
23449
+ //===----------------------------------------------------------------------===//
23450
+
23451
+
23452
+
23453
+
23454
+
23455
+
23456
+ namespace duckdb {
23457
+
23458
+ struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23459
+ explicit CreatePragmaFunctionInfo(PragmaFunction function)
23460
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23461
+ functions.push_back(move(function));
23462
+ this->name = function.name;
23463
+ }
23464
+ CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23465
+ : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23466
+ this->name = name;
23467
+ for (auto &function : functions) {
23468
+ function.name = name;
23469
+ }
23470
+ }
23471
+
23472
+ vector<PragmaFunction> functions;
23473
+
23474
+ public:
23475
+ unique_ptr<CreateInfo> Copy() const override {
23476
+ auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23477
+ CopyProperties(*result);
23478
+ return move(result);
23479
+ }
23480
+ };
23481
+
23310
23482
  } // namespace duckdb
23311
23483
  //===----------------------------------------------------------------------===//
23312
23484
  // DuckDB
@@ -23336,7 +23508,7 @@ struct TransactionInfo : public ParseInfo {
23336
23508
  //===----------------------------------------------------------------------===//
23337
23509
  // DuckDB
23338
23510
  //
23339
- // duckdb/parser/parsed_data/create_type_info.hpp
23511
+ // duckdb/parser/parsed_data/drop_info.hpp
23340
23512
  //
23341
23513
  //
23342
23514
  //===----------------------------------------------------------------------===//
@@ -23346,27 +23518,33 @@ struct TransactionInfo : public ParseInfo {
23346
23518
 
23347
23519
 
23348
23520
 
23349
-
23350
-
23351
23521
  namespace duckdb {
23352
23522
 
23353
- struct CreateTypeInfo : public CreateInfo {
23354
-
23355
- CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23523
+ struct DropInfo : public ParseInfo {
23524
+ DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23356
23525
  }
23357
23526
 
23358
- //! Name of the Type
23527
+ //! The catalog type to drop
23528
+ CatalogType type;
23529
+ //! Schema name to drop from, if any
23530
+ string schema;
23531
+ //! Element name to drop
23359
23532
  string name;
23360
- //! Logical Type
23361
- LogicalType type;
23533
+ //! Ignore if the entry does not exist instead of failing
23534
+ bool if_exists = false;
23535
+ //! Cascade drop (drop all dependents instead of throwing an error if there
23536
+ //! are any)
23537
+ bool cascade = false;
23362
23538
 
23363
23539
  public:
23364
- unique_ptr<CreateInfo> Copy() const override {
23365
- auto result = make_unique<CreateTypeInfo>();
23366
- CopyProperties(*result);
23367
- result->name = name;
23540
+ unique_ptr<DropInfo> Copy() const {
23541
+ auto result = make_unique<DropInfo>();
23368
23542
  result->type = type;
23369
- return move(result);
23543
+ result->schema = schema;
23544
+ result->name = name;
23545
+ result->if_exists = if_exists;
23546
+ result->cascade = cascade;
23547
+ return result;
23370
23548
  }
23371
23549
  };
23372
23550
 
@@ -23374,7 +23552,7 @@ public:
23374
23552
  //===----------------------------------------------------------------------===//
23375
23553
  // DuckDB
23376
23554
  //
23377
- // duckdb/parser/parsed_data/create_view_info.hpp
23555
+ // duckdb/parser/parsed_data/create_schema_info.hpp
23378
23556
  //
23379
23557
  //
23380
23558
  //===----------------------------------------------------------------------===//
@@ -23383,32 +23561,16 @@ public:
23383
23561
 
23384
23562
 
23385
23563
 
23386
-
23387
23564
  namespace duckdb {
23388
23565
 
23389
- struct CreateViewInfo : public CreateInfo {
23390
- CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
23391
- }
23392
- CreateViewInfo(string schema, string view_name)
23393
- : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
23566
+ struct CreateSchemaInfo : public CreateInfo {
23567
+ CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
23394
23568
  }
23395
23569
 
23396
- //! Table name to insert to
23397
- string view_name;
23398
- //! Aliases of the view
23399
- vector<string> aliases;
23400
- //! Return types
23401
- vector<LogicalType> types;
23402
- //! The SelectStatement of the view
23403
- unique_ptr<SelectStatement> query;
23404
-
23405
23570
  public:
23406
23571
  unique_ptr<CreateInfo> Copy() const override {
23407
- auto result = make_unique<CreateViewInfo>(schema, view_name);
23572
+ auto result = make_unique<CreateSchemaInfo>();
23408
23573
  CopyProperties(*result);
23409
- result->aliases = aliases;
23410
- result->types = types;
23411
- result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
23412
23574
  return move(result);
23413
23575
  }
23414
23576
  };
@@ -23501,7 +23663,7 @@ public:
23501
23663
  //===----------------------------------------------------------------------===//
23502
23664
  // DuckDB
23503
23665
  //
23504
- // duckdb/parser/parsed_data/export_table_data.hpp
23666
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23505
23667
  //
23506
23668
  //
23507
23669
  //===----------------------------------------------------------------------===//
@@ -23510,34 +23672,28 @@ public:
23510
23672
 
23511
23673
 
23512
23674
 
23513
-
23514
23675
  namespace duckdb {
23515
23676
 
23516
- struct ExportedTableData {
23517
- //! Name of the exported table
23518
- string table_name;
23519
-
23520
- //! Name of the schema
23521
- string schema_name;
23522
-
23523
- //! Path to be exported
23524
- string file_path;
23525
- };
23677
+ enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23526
23678
 
23527
- struct ExportedTableInfo {
23528
- TableCatalogEntry *entry;
23529
- ExportedTableData table_data;
23530
- };
23679
+ struct LoadInfo : public ParseInfo {
23680
+ std::string filename;
23681
+ LoadType load_type;
23531
23682
 
23532
- struct BoundExportData : public ParseInfo {
23533
- std::vector<ExportedTableInfo> data;
23683
+ public:
23684
+ unique_ptr<LoadInfo> Copy() const {
23685
+ auto result = make_unique<LoadInfo>();
23686
+ result->filename = filename;
23687
+ result->load_type = load_type;
23688
+ return result;
23689
+ }
23534
23690
  };
23535
23691
 
23536
23692
  } // namespace duckdb
23537
23693
  //===----------------------------------------------------------------------===//
23538
23694
  // DuckDB
23539
23695
  //
23540
- // duckdb/parser/parsed_data/vacuum_info.hpp
23696
+ // duckdb/parser/parsed_data/create_type_info.hpp
23541
23697
  //
23542
23698
  //
23543
23699
  //===----------------------------------------------------------------------===//
@@ -23546,20 +23702,28 @@ struct BoundExportData : public ParseInfo {
23546
23702
 
23547
23703
 
23548
23704
 
23705
+
23706
+
23707
+
23549
23708
  namespace duckdb {
23550
23709
 
23551
- enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
23710
+ struct CreateTypeInfo : public CreateInfo {
23552
23711
 
23553
- struct LoadInfo : public ParseInfo {
23554
- std::string filename;
23555
- LoadType load_type;
23712
+ CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
23713
+ }
23714
+
23715
+ //! Name of the Type
23716
+ string name;
23717
+ //! Logical Type
23718
+ LogicalType type;
23556
23719
 
23557
23720
  public:
23558
- unique_ptr<LoadInfo> Copy() const {
23559
- auto result = make_unique<LoadInfo>();
23560
- result->filename = filename;
23561
- result->load_type = load_type;
23562
- return result;
23721
+ unique_ptr<CreateInfo> Copy() const override {
23722
+ auto result = make_unique<CreateTypeInfo>();
23723
+ CopyProperties(*result);
23724
+ result->name = name;
23725
+ result->type = type;
23726
+ return move(result);
23563
23727
  }
23564
23728
  };
23565
23729
 
@@ -23567,7 +23731,7 @@ public:
23567
23731
  //===----------------------------------------------------------------------===//
23568
23732
  // DuckDB
23569
23733
  //
23570
- // duckdb/parser/parsed_data/create_aggregate_function_info.hpp
23734
+ // duckdb/parser/parsed_data/create_view_info.hpp
23571
23735
  //
23572
23736
  //
23573
23737
  //===----------------------------------------------------------------------===//
@@ -23579,27 +23743,29 @@ public:
23579
23743
 
23580
23744
  namespace duckdb {
23581
23745
 
23582
- struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
23583
- explicit CreateAggregateFunctionInfo(AggregateFunction function)
23584
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
23585
- this->name = function.name;
23586
- functions.AddFunction(move(function));
23746
+ struct CreateViewInfo : public CreateInfo {
23747
+ CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
23587
23748
  }
23588
-
23589
- explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
23590
- : CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
23591
- this->name = functions.name;
23592
- for (auto &func : functions.functions) {
23593
- func.name = functions.name;
23594
- }
23749
+ CreateViewInfo(string schema, string view_name)
23750
+ : CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
23595
23751
  }
23596
23752
 
23597
- AggregateFunctionSet functions;
23753
+ //! Table name to insert to
23754
+ string view_name;
23755
+ //! Aliases of the view
23756
+ vector<string> aliases;
23757
+ //! Return types
23758
+ vector<LogicalType> types;
23759
+ //! The SelectStatement of the view
23760
+ unique_ptr<SelectStatement> query;
23598
23761
 
23599
23762
  public:
23600
23763
  unique_ptr<CreateInfo> Copy() const override {
23601
- auto result = make_unique<CreateAggregateFunctionInfo>(functions);
23764
+ auto result = make_unique<CreateViewInfo>(schema, view_name);
23602
23765
  CopyProperties(*result);
23766
+ result->aliases = aliases;
23767
+ result->types = types;
23768
+ result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
23603
23769
  return move(result);
23604
23770
  }
23605
23771
  };
@@ -23608,7 +23774,7 @@ public:
23608
23774
  //===----------------------------------------------------------------------===//
23609
23775
  // DuckDB
23610
23776
  //
23611
- // duckdb/parser/parsed_data/drop_info.hpp
23777
+ // duckdb/parser/parsed_data/vacuum_info.hpp
23612
23778
  //
23613
23779
  //
23614
23780
  //===----------------------------------------------------------------------===//
@@ -23617,42 +23783,17 @@ public:
23617
23783
 
23618
23784
 
23619
23785
 
23620
-
23621
23786
  namespace duckdb {
23622
23787
 
23623
- struct DropInfo : public ParseInfo {
23624
- DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
23625
- }
23626
-
23627
- //! The catalog type to drop
23628
- CatalogType type;
23629
- //! Schema name to drop from, if any
23630
- string schema;
23631
- //! Element name to drop
23632
- string name;
23633
- //! Ignore if the entry does not exist instead of failing
23634
- bool if_exists = false;
23635
- //! Cascade drop (drop all dependents instead of throwing an error if there
23636
- //! are any)
23637
- bool cascade = false;
23638
-
23639
- public:
23640
- unique_ptr<DropInfo> Copy() const {
23641
- auto result = make_unique<DropInfo>();
23642
- result->type = type;
23643
- result->schema = schema;
23644
- result->name = name;
23645
- result->if_exists = if_exists;
23646
- result->cascade = cascade;
23647
- return result;
23648
- }
23788
+ struct VacuumInfo : public ParseInfo {
23789
+ // nothing for now
23649
23790
  };
23650
23791
 
23651
23792
  } // namespace duckdb
23652
23793
  //===----------------------------------------------------------------------===//
23653
23794
  // DuckDB
23654
23795
  //
23655
- // duckdb/parser/parsed_data/create_pragma_function_info.hpp
23796
+ // duckdb/parser/parsed_data/show_select_info.hpp
23656
23797
  //
23657
23798
  //
23658
23799
  //===----------------------------------------------------------------------===//
@@ -23664,27 +23805,23 @@ public:
23664
23805
 
23665
23806
  namespace duckdb {
23666
23807
 
23667
- struct CreatePragmaFunctionInfo : public CreateFunctionInfo {
23668
- explicit CreatePragmaFunctionInfo(PragmaFunction function)
23669
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY) {
23670
- functions.push_back(move(function));
23671
- this->name = function.name;
23672
- }
23673
- CreatePragmaFunctionInfo(string name, vector<PragmaFunction> functions_)
23674
- : CreateFunctionInfo(CatalogType::PRAGMA_FUNCTION_ENTRY), functions(move(functions_)) {
23675
- this->name = name;
23676
- for (auto &function : functions) {
23677
- function.name = name;
23678
- }
23679
- }
23680
-
23681
- vector<PragmaFunction> functions;
23808
+ struct ShowSelectInfo : public ParseInfo {
23809
+ //! Types of projected columns
23810
+ vector<LogicalType> types;
23811
+ //! The QueryNode of select query
23812
+ unique_ptr<QueryNode> query;
23813
+ //! Aliases of projected columns
23814
+ vector<string> aliases;
23815
+ //! Whether or not we are requesting a summary or a describe
23816
+ bool is_summary;
23682
23817
 
23683
- public:
23684
- unique_ptr<CreateInfo> Copy() const override {
23685
- auto result = make_unique<CreatePragmaFunctionInfo>(functions[0].name, functions);
23686
- CopyProperties(*result);
23687
- return move(result);
23818
+ unique_ptr<ShowSelectInfo> Copy() {
23819
+ auto result = make_unique<ShowSelectInfo>();
23820
+ result->types = types;
23821
+ result->query = query->Copy();
23822
+ result->aliases = aliases;
23823
+ result->is_summary = is_summary;
23824
+ return result;
23688
23825
  }
23689
23826
  };
23690
23827
 
@@ -23692,7 +23829,7 @@ public:
23692
23829
  //===----------------------------------------------------------------------===//
23693
23830
  // DuckDB
23694
23831
  //
23695
- // duckdb/parser/tableref/expressionlistref.hpp
23832
+ // duckdb/parser/tableref/emptytableref.hpp
23696
23833
  //
23697
23834
  //
23698
23835
  //===----------------------------------------------------------------------===//
@@ -23701,35 +23838,25 @@ public:
23701
23838
 
23702
23839
 
23703
23840
 
23704
-
23705
-
23706
-
23707
23841
  namespace duckdb {
23708
- //! Represents an expression list as generated by a VALUES statement
23709
- class ExpressionListRef : public TableRef {
23842
+ //! Represents a cross product
23843
+ class EmptyTableRef : public TableRef {
23710
23844
  public:
23711
- ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
23845
+ EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
23712
23846
  }
23713
23847
 
23714
- //! Value list, only used for VALUES statement
23715
- vector<vector<unique_ptr<ParsedExpression>>> values;
23716
- //! Expected SQL types
23717
- vector<LogicalType> expected_types;
23718
- //! The set of expected names
23719
- vector<string> expected_names;
23720
-
23721
23848
  public:
23849
+ string ToString() const override;
23722
23850
  bool Equals(const TableRef *other_p) const override;
23723
23851
 
23724
23852
  unique_ptr<TableRef> Copy() override;
23725
23853
 
23726
- //! Serializes a blob into a ExpressionListRef
23854
+ //! Serializes a blob into a DummyTableRef
23727
23855
  void Serialize(FieldWriter &serializer) const override;
23728
- //! Deserializes a blob back into a ExpressionListRef
23856
+ //! Deserializes a blob back into a DummyTableRef
23729
23857
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23730
23858
  };
23731
23859
  } // namespace duckdb
23732
-
23733
23860
  //===----------------------------------------------------------------------===//
23734
23861
  // DuckDB
23735
23862
  //
@@ -23755,6 +23882,7 @@ public:
23755
23882
  unique_ptr<TableRef> right;
23756
23883
 
23757
23884
  public:
23885
+ string ToString() const override;
23758
23886
  bool Equals(const TableRef *other_p) const override;
23759
23887
 
23760
23888
  unique_ptr<TableRef> Copy() override;
@@ -23766,10 +23894,12 @@ public:
23766
23894
  };
23767
23895
  } // namespace duckdb
23768
23896
 
23897
+
23898
+
23769
23899
  //===----------------------------------------------------------------------===//
23770
23900
  // DuckDB
23771
23901
  //
23772
- // duckdb/parser/tableref/emptytableref.hpp
23902
+ // duckdb/parser/tableref/expressionlistref.hpp
23773
23903
  //
23774
23904
  //
23775
23905
  //===----------------------------------------------------------------------===//
@@ -23778,26 +23908,36 @@ public:
23778
23908
 
23779
23909
 
23780
23910
 
23911
+
23912
+
23913
+
23781
23914
  namespace duckdb {
23782
- //! Represents a cross product
23783
- class EmptyTableRef : public TableRef {
23915
+ //! Represents an expression list as generated by a VALUES statement
23916
+ class ExpressionListRef : public TableRef {
23784
23917
  public:
23785
- EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
23918
+ ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
23786
23919
  }
23787
23920
 
23921
+ //! Value list, only used for VALUES statement
23922
+ vector<vector<unique_ptr<ParsedExpression>>> values;
23923
+ //! Expected SQL types
23924
+ vector<LogicalType> expected_types;
23925
+ //! The set of expected names
23926
+ vector<string> expected_names;
23927
+
23788
23928
  public:
23929
+ string ToString() const override;
23789
23930
  bool Equals(const TableRef *other_p) const override;
23790
23931
 
23791
23932
  unique_ptr<TableRef> Copy() override;
23792
23933
 
23793
- //! Serializes a blob into a DummyTableRef
23934
+ //! Serializes a blob into a ExpressionListRef
23794
23935
  void Serialize(FieldWriter &serializer) const override;
23795
- //! Deserializes a blob back into a DummyTableRef
23936
+ //! Deserializes a blob back into a ExpressionListRef
23796
23937
  static unique_ptr<TableRef> Deserialize(FieldReader &source);
23797
23938
  };
23798
23939
  } // namespace duckdb
23799
23940
 
23800
-
23801
23941
  //===----------------------------------------------------------------------===//
23802
23942
  // DuckDB
23803
23943
  //
@@ -23835,6 +23975,7 @@ public:
23835
23975
  vector<string> using_columns;
23836
23976
 
23837
23977
  public:
23978
+ string ToString() const override;
23838
23979
  bool Equals(const TableRef *other_p) const override;
23839
23980
 
23840
23981
  unique_ptr<TableRef> Copy() override;
@@ -23871,6 +24012,7 @@ public:
23871
24012
  vector<string> column_name_alias;
23872
24013
 
23873
24014
  public:
24015
+ string ToString() const override;
23874
24016
  bool Equals(const TableRef *other_p) const override;
23875
24017
 
23876
24018
  unique_ptr<TableRef> Copy() override;
@@ -23901,8 +24043,7 @@ namespace duckdb {
23901
24043
  //! Represents a Table producing function
23902
24044
  class TableFunctionRef : public TableRef {
23903
24045
  public:
23904
- TableFunctionRef() : TableRef(TableReferenceType::TABLE_FUNCTION) {
23905
- }
24046
+ DUCKDB_API TableFunctionRef();
23906
24047
 
23907
24048
  unique_ptr<ParsedExpression> function;
23908
24049
  vector<string> column_name_alias;