duckdb 0.3.3-dev1140.0 → 0.3.3-dev1226.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 "7c15866e7"
15
- #define DUCKDB_VERSION "v0.3.3-dev1140"
14
+ #define DUCKDB_SOURCE_ID "39cfae40b"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1226"
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);
@@ -15878,10 +15887,20 @@ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
15878
15887
  This should not be used with `DUCKDB_TYPE_DECIMAL`.
15879
15888
 
15880
15889
  * type: The primitive type to create.
15881
- * returns: The logical type type.
15890
+ * returns: The logical type.
15882
15891
  */
15883
15892
  DUCKDB_API duckdb_logical_type duckdb_create_logical_type(duckdb_type type);
15884
15893
 
15894
+ /*!
15895
+ Creates a `duckdb_logical_type` of type decimal with the specified width and scale
15896
+ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
15897
+
15898
+ * width: The width of the decimal type
15899
+ * scale: The scale of the decimal type
15900
+ * returns: The logical type.
15901
+ */
15902
+ DUCKDB_API duckdb_logical_type duckdb_create_decimal_type(uint8_t width, uint8_t scale);
15903
+
15885
15904
  /*!
15886
15905
  Retrieves the type class of a `duckdb_logical_type`.
15887
15906
 
@@ -16278,6 +16297,18 @@ Sets the main function of the table function
16278
16297
  DUCKDB_API void duckdb_table_function_set_function(duckdb_table_function table_function,
16279
16298
  duckdb_table_function_t function);
16280
16299
 
16300
+ /*!
16301
+ Sets whether or not the given table function supports projection pushdown.
16302
+
16303
+ If this is set to true, the system will provide a list of all required columns in the `init` stage through
16304
+ the `duckdb_init_get_column_count` and `duckdb_init_get_column_index` functions.
16305
+ If this is set to false (the default), the system will expect all columns to be projected.
16306
+
16307
+ * table_function: The table function
16308
+ * pushdown: True if the table function supports projection pushdown, false otherwise.
16309
+ */
16310
+ DUCKDB_API void duckdb_table_function_supports_projection_pushdown(duckdb_table_function table_function, bool pushdown);
16311
+
16281
16312
  /*!
16282
16313
  Register the table function object within the given connection.
16283
16314
 
@@ -16379,6 +16410,27 @@ Sets the user-provided init data in the init object. This object can be retrieve
16379
16410
  */
16380
16411
  DUCKDB_API void duckdb_init_set_init_data(duckdb_init_info info, void *init_data, duckdb_delete_callback_t destroy);
16381
16412
 
16413
+ /*!
16414
+ Returns the number of projected columns.
16415
+
16416
+ This function must be used if projection pushdown is enabled to figure out which columns to emit.
16417
+
16418
+ * info: The info object
16419
+ * returns: The number of projected columns.
16420
+ */
16421
+ DUCKDB_API idx_t duckdb_init_get_column_count(duckdb_init_info info);
16422
+
16423
+ /*!
16424
+ Returns the column index of the projected column at the specified position.
16425
+
16426
+ This function must be used if projection pushdown is enabled to figure out which columns to emit.
16427
+
16428
+ * info: The info object
16429
+ * column_index: The index at which to get the projected column index, from 0..duckdb_init_get_column_count(info)
16430
+ * returns: The column index of the projected column.
16431
+ */
16432
+ DUCKDB_API idx_t duckdb_init_get_column_index(duckdb_init_info info, idx_t column_index);
16433
+
16382
16434
  /*!
16383
16435
  Report that an error has occurred while calling init.
16384
16436
 
@@ -18827,7 +18879,7 @@ struct CreateFunctionInfo : public CreateInfo {
18827
18879
  explicit CreateFunctionInfo(CatalogType type, string schema = DEFAULT_SCHEMA) : CreateInfo(type, schema) {
18828
18880
  D_ASSERT(type == CatalogType::SCALAR_FUNCTION_ENTRY || type == CatalogType::AGGREGATE_FUNCTION_ENTRY ||
18829
18881
  type == CatalogType::TABLE_FUNCTION_ENTRY || type == CatalogType::PRAGMA_FUNCTION_ENTRY ||
18830
- type == CatalogType::MACRO_ENTRY);
18882
+ type == CatalogType::MACRO_ENTRY || type == CatalogType::TABLE_MACRO_ENTRY);
18831
18883
  }
18832
18884
 
18833
18885
  //! Function name
@@ -23253,6 +23305,8 @@ struct TransactionInfo : public ParseInfo {
23253
23305
  //===----------------------------------------------------------------------===//
23254
23306
 
23255
23307
 
23308
+ //! The SelectStatement of the view
23309
+
23256
23310
 
23257
23311
 
23258
23312
 
@@ -23261,25 +23315,33 @@ struct TransactionInfo : public ParseInfo {
23261
23315
 
23262
23316
  namespace duckdb {
23263
23317
 
23264
- class MacroCatalogEntry;
23318
+ enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
23265
23319
 
23266
23320
  class MacroFunction {
23267
23321
  public:
23268
- explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23322
+ // explicit MacroFunction(unique_ptr<ParsedExpression> expression);
23323
+ MacroFunction(MacroType type);
23269
23324
 
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;
23325
+ // MacroFunction(void);
23326
+ // The type
23327
+ MacroType type;
23276
23328
  //! The positional parameters
23277
23329
  vector<unique_ptr<ParsedExpression>> parameters;
23278
23330
  //! The default parameters and their associated values
23279
23331
  unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
23280
23332
 
23281
23333
  public:
23282
- unique_ptr<MacroFunction> Copy();
23334
+ virtual ~MacroFunction() {
23335
+ }
23336
+
23337
+ void CopyProperties(MacroFunction &other);
23338
+
23339
+ virtual unique_ptr<MacroFunction> Copy() = 0;
23340
+
23341
+ static string ValidateArguments(MacroFunction &macro_function, const string &name,
23342
+ FunctionExpression &function_expr,
23343
+ vector<unique_ptr<ParsedExpression>> &positionals,
23344
+ unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
23283
23345
  };
23284
23346
 
23285
23347
  } // namespace duckdb
@@ -23291,6 +23353,9 @@ struct CreateMacroInfo : public CreateFunctionInfo {
23291
23353
  CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
23292
23354
  }
23293
23355
 
23356
+ CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
23357
+ }
23358
+
23294
23359
  unique_ptr<MacroFunction> function;
23295
23360
 
23296
23361
  public: