duckdb 0.3.3-dev1133.0 → 0.3.3-dev1217.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 "4060e4667"
15
- #define DUCKDB_VERSION "v0.3.3-dev1133"
14
+ #define DUCKDB_SOURCE_ID "3919a8589"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1217"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -8012,6 +8012,7 @@ enum class CatalogType : uint8_t {
8012
8012
  PRAGMA_FUNCTION_ENTRY = 28,
8013
8013
  COPY_FUNCTION_ENTRY = 29,
8014
8014
  MACRO_ENTRY = 30,
8015
+ TABLE_MACRO_ENTRY = 31,
8015
8016
 
8016
8017
  // version info
8017
8018
  UPDATED_ENTRY = 50,
@@ -12997,7 +12998,7 @@ class QueryNode;
12997
12998
 
12998
12999
  class ScalarFunctionCatalogEntry;
12999
13000
  class AggregateFunctionCatalogEntry;
13000
- class MacroCatalogEntry;
13001
+ class ScalarMacroCatalogEntry;
13001
13002
  class CatalogEntry;
13002
13003
  class SimpleFunction;
13003
13004
 
@@ -13033,6 +13034,8 @@ public:
13033
13034
  //! be added. Defaults to INVALID.
13034
13035
  LogicalType target_type;
13035
13036
 
13037
+ MacroBinding *macro_binding;
13038
+
13036
13039
  public:
13037
13040
  unique_ptr<Expression> Bind(unique_ptr<ParsedExpression> &expr, LogicalType *result_type = nullptr,
13038
13041
  bool root_expression = true);
@@ -13079,6 +13082,8 @@ public:
13079
13082
  virtual BindResult BindExpression(unique_ptr<ParsedExpression> *expr_ptr, idx_t depth,
13080
13083
  bool root_expression = false);
13081
13084
 
13085
+ void ReplaceMacroParametersRecursive(unique_ptr<ParsedExpression> &expr);
13086
+
13082
13087
  protected:
13083
13088
  BindResult BindExpression(BetweenExpression &expr, idx_t depth);
13084
13089
  BindResult BindExpression(CaseExpression &expr, idx_t depth);
@@ -13101,18 +13106,15 @@ protected:
13101
13106
  virtual BindResult BindFunction(FunctionExpression &expr, ScalarFunctionCatalogEntry *function, idx_t depth);
13102
13107
  virtual BindResult BindAggregate(FunctionExpression &expr, AggregateFunctionCatalogEntry *function, idx_t depth);
13103
13108
  virtual BindResult BindUnnest(FunctionExpression &expr, idx_t depth);
13104
- virtual BindResult BindMacro(FunctionExpression &expr, MacroCatalogEntry *macro, idx_t depth,
13109
+ virtual BindResult BindMacro(FunctionExpression &expr, ScalarMacroCatalogEntry *macro, idx_t depth,
13105
13110
  unique_ptr<ParsedExpression> *expr_ptr);
13106
13111
 
13107
- void ReplaceMacroParametersRecursive(unique_ptr<ParsedExpression> &expr);
13108
-
13109
13112
  virtual string UnsupportedAggregateMessage();
13110
13113
  virtual string UnsupportedUnnestMessage();
13111
13114
 
13112
13115
  Binder &binder;
13113
13116
  ClientContext &context;
13114
13117
  ExpressionBinder *stored_binder;
13115
- MacroBinding *macro_binding;
13116
13118
  vector<BoundColumnReferenceInfo> bound_columns;
13117
13119
  };
13118
13120
 
@@ -13269,6 +13271,8 @@ public:
13269
13271
  const vector<LogicalType> &types, LogicalGet &get);
13270
13272
  //! Adds a subquery with a given alias to the BindContext.
13271
13273
  void AddSubquery(idx_t index, const string &alias, SubqueryRef &ref, BoundQueryNode &subquery);
13274
+ //! Adds a subquery with a given alias to the BindContext.
13275
+ void AddSubquery(idx_t index, const string &alias, TableFunctionRef &ref, BoundQueryNode &subquery);
13272
13276
  //! Adds a base table with the given alias to the BindContext.
13273
13277
  void AddGenericBinding(idx_t index, const string &alias, const vector<string> &names,
13274
13278
  const vector<LogicalType> &types);
@@ -13344,6 +13348,8 @@ private:
13344
13348
 
13345
13349
 
13346
13350
 
13351
+ //#include "duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp"
13352
+
13347
13353
  namespace duckdb {
13348
13354
  class BoundResultModifier;
13349
13355
  class BoundSelectNode;
@@ -13353,6 +13359,7 @@ class LimitModifier;
13353
13359
  class OrderBinder;
13354
13360
  class TableCatalogEntry;
13355
13361
  class ViewCatalogEntry;
13362
+ class TableMacroCatalogEntry;
13356
13363
 
13357
13364
  struct CreateInfo;
13358
13365
  struct BoundCreateTableInfo;
@@ -13536,6 +13543,8 @@ private:
13536
13543
  BoundStatement Bind(SetStatement &stmt);
13537
13544
  BoundStatement Bind(LoadStatement &stmt);
13538
13545
 
13546
+ unique_ptr<QueryNode> BindTableMacro(FunctionExpression &function, TableMacroCatalogEntry *macro_func, idx_t depth);
13547
+
13539
13548
  unique_ptr<BoundQueryNode> BindNode(SelectNode &node);
13540
13549
  unique_ptr<BoundQueryNode> BindNode(SetOperationNode &node);
13541
13550
  unique_ptr<BoundQueryNode> BindNode(RecursiveCTENode &node);
@@ -18827,7 +18836,7 @@ struct CreateFunctionInfo : public CreateInfo {
18827
18836
  explicit CreateFunctionInfo(CatalogType type, string schema = DEFAULT_SCHEMA) : CreateInfo(type, schema) {
18828
18837
  D_ASSERT(type == CatalogType::SCALAR_FUNCTION_ENTRY || type == CatalogType::AGGREGATE_FUNCTION_ENTRY ||
18829
18838
  type == CatalogType::TABLE_FUNCTION_ENTRY || type == CatalogType::PRAGMA_FUNCTION_ENTRY ||
18830
- type == CatalogType::MACRO_ENTRY);
18839
+ type == CatalogType::MACRO_ENTRY || type == CatalogType::TABLE_MACRO_ENTRY);
18831
18840
  }
18832
18841
 
18833
18842
  //! Function name
@@ -23253,6 +23262,8 @@ struct TransactionInfo : public ParseInfo {
23253
23262
  //===----------------------------------------------------------------------===//
23254
23263
 
23255
23264
 
23265
+ //! The SelectStatement of the view
23266
+
23256
23267
 
23257
23268
 
23258
23269
 
@@ -23261,25 +23272,33 @@ struct TransactionInfo : public ParseInfo {
23261
23272
 
23262
23273
  namespace duckdb {
23263
23274
 
23264
- class MacroCatalogEntry;
23275
+ enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
23265
23276
 
23266
23277
  class MacroFunction {
23267
23278
  public:
23268
- explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23279
+ // explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23280
+ MacroFunction(MacroType type);
23269
23281
 
23270
- //! Check whether the supplied arguments are valid
23271
- static string ValidateArguments(MacroCatalogEntry &macro_func, FunctionExpression &function_expr,
23272
- vector<unique_ptr<ParsedExpression>> &positionals,
23273
- unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
23274
- //! The macro expression
23275
- unique_ptr<ParsedExpression> expression;
23282
+ // MacroFunction(void);
23283
+ // The type
23284
+ MacroType type;
23276
23285
  //! The positional parameters
23277
23286
  vector<unique_ptr<ParsedExpression>> parameters;
23278
23287
  //! The default parameters and their associated values
23279
23288
  unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
23280
23289
 
23281
23290
  public:
23282
- unique_ptr<MacroFunction> Copy();
23291
+ virtual ~MacroFunction() {
23292
+ }
23293
+
23294
+ void CopyProperties(MacroFunction &other);
23295
+
23296
+ virtual unique_ptr<MacroFunction> Copy() = 0;
23297
+
23298
+ static string ValidateArguments(MacroFunction &macro_function, const string &name,
23299
+ FunctionExpression &function_expr,
23300
+ vector<unique_ptr<ParsedExpression>> &positionals,
23301
+ unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
23283
23302
  };
23284
23303
 
23285
23304
  } // namespace duckdb
@@ -23291,6 +23310,9 @@ struct CreateMacroInfo : public CreateFunctionInfo {
23291
23310
  CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
23292
23311
  }
23293
23312
 
23313
+ CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
23314
+ }
23315
+
23294
23316
  unique_ptr<MacroFunction> function;
23295
23317
 
23296
23318
  public: