duckdb 0.3.3-dev1217.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.3-dev1217.0",
4
+ "version": "0.3.3-dev1226.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -104250,6 +104250,10 @@ duckdb_logical_type duckdb_create_logical_type(duckdb_type type) {
104250
104250
  return new duckdb::LogicalType(duckdb::ConvertCTypeToCPP(type));
104251
104251
  }
104252
104252
 
104253
+ duckdb_logical_type duckdb_create_decimal_type(uint8_t width, uint8_t scale) {
104254
+ return new duckdb::LogicalType(duckdb::LogicalType::DECIMAL(width, scale));
104255
+ }
104256
+
104253
104257
  duckdb_type duckdb_get_type_id(duckdb_logical_type type) {
104254
104258
  if (!type) {
104255
104259
  return DUCKDB_TYPE_INVALID;
@@ -105222,12 +105226,15 @@ struct CTableInitData : public FunctionOperatorData {
105222
105226
  };
105223
105227
 
105224
105228
  struct CTableInternalInitInfo {
105225
- CTableInternalInitInfo(CTableBindData &bind_data, CTableInitData &init_data)
105226
- : bind_data(bind_data), init_data(init_data), success(true) {
105229
+ CTableInternalInitInfo(CTableBindData &bind_data, CTableInitData &init_data, const vector<column_t> &column_ids,
105230
+ TableFilterCollection *filters)
105231
+ : bind_data(bind_data), init_data(init_data), column_ids(column_ids), filters(filters), success(true) {
105227
105232
  }
105228
105233
 
105229
105234
  CTableBindData &bind_data;
105230
105235
  CTableInitData &init_data;
105236
+ const vector<column_t> &column_ids;
105237
+ TableFilterCollection *filters;
105231
105238
  bool success;
105232
105239
  string error;
105233
105240
  };
@@ -105264,7 +105271,7 @@ unique_ptr<FunctionOperatorData> CTableFunctionInit(ClientContext &context, cons
105264
105271
  auto &bind_data = (CTableBindData &)*bind_data_p;
105265
105272
  auto result = make_unique<CTableInitData>();
105266
105273
 
105267
- CTableInternalInitInfo init_info(bind_data, *result);
105274
+ CTableInternalInitInfo init_info(bind_data, *result, column_ids, filters);
105268
105275
  bind_data.info->init(&init_info);
105269
105276
  if (!init_info.success) {
105270
105277
  throw Exception(init_info.error);
@@ -105358,6 +105365,14 @@ void duckdb_table_function_set_function(duckdb_table_function table_function, du
105358
105365
  info->function = function;
105359
105366
  }
105360
105367
 
105368
+ void duckdb_table_function_supports_projection_pushdown(duckdb_table_function table_function, bool pushdown) {
105369
+ if (!table_function) {
105370
+ return;
105371
+ }
105372
+ auto tf = (duckdb::TableFunction *)table_function;
105373
+ tf->projection_pushdown = pushdown;
105374
+ }
105375
+
105361
105376
  duckdb_state duckdb_register_table_function(duckdb_connection connection, duckdb_table_function function) {
105362
105377
  if (!connection || !function) {
105363
105378
  return DuckDBError;
@@ -105469,6 +105484,25 @@ void duckdb_init_set_error(duckdb_init_info info, const char *error) {
105469
105484
  function_info->success = false;
105470
105485
  }
105471
105486
 
105487
+ idx_t duckdb_init_get_column_count(duckdb_init_info info) {
105488
+ if (!info) {
105489
+ return 0;
105490
+ }
105491
+ auto function_info = (duckdb::CTableInternalInitInfo *)info;
105492
+ return function_info->column_ids.size();
105493
+ }
105494
+
105495
+ idx_t duckdb_init_get_column_index(duckdb_init_info info, idx_t column_index) {
105496
+ if (!info) {
105497
+ return 0;
105498
+ }
105499
+ auto function_info = (duckdb::CTableInternalInitInfo *)info;
105500
+ if (column_index >= function_info->column_ids.size()) {
105501
+ return 0;
105502
+ }
105503
+ return function_info->column_ids[column_index];
105504
+ }
105505
+
105472
105506
  //===--------------------------------------------------------------------===//
105473
105507
  // Function Interface
105474
105508
  //===--------------------------------------------------------------------===//
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 "3919a8589"
15
- #define DUCKDB_VERSION "v0.3.3-dev1217"
14
+ #define DUCKDB_SOURCE_ID "39cfae40b"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1226"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -15887,10 +15887,20 @@ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
15887
15887
  This should not be used with `DUCKDB_TYPE_DECIMAL`.
15888
15888
 
15889
15889
  * type: The primitive type to create.
15890
- * returns: The logical type type.
15890
+ * returns: The logical type.
15891
15891
  */
15892
15892
  DUCKDB_API duckdb_logical_type duckdb_create_logical_type(duckdb_type type);
15893
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
+
15894
15904
  /*!
15895
15905
  Retrieves the type class of a `duckdb_logical_type`.
15896
15906
 
@@ -16287,6 +16297,18 @@ Sets the main function of the table function
16287
16297
  DUCKDB_API void duckdb_table_function_set_function(duckdb_table_function table_function,
16288
16298
  duckdb_table_function_t function);
16289
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
+
16290
16312
  /*!
16291
16313
  Register the table function object within the given connection.
16292
16314
 
@@ -16388,6 +16410,27 @@ Sets the user-provided init data in the init object. This object can be retrieve
16388
16410
  */
16389
16411
  DUCKDB_API void duckdb_init_set_init_data(duckdb_init_info info, void *init_data, duckdb_delete_callback_t destroy);
16390
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
+
16391
16434
  /*!
16392
16435
  Report that an error has occurred while calling init.
16393
16436