duckdb 0.4.1-dev347.0 → 0.4.1-dev356.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 "81c2ea292"
15
- #define DUCKDB_VERSION "v0.4.1-dev347"
14
+ #define DUCKDB_SOURCE_ID "1aa22aab6"
15
+ #define DUCKDB_VERSION "v0.4.1-dev356"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -6623,6 +6623,9 @@ class TableFunction;
6623
6623
 
6624
6624
  struct PragmaInfo;
6625
6625
 
6626
+ enum class FunctionNullHandling : uint8_t { DEFAULT_NULL_HANDLING = 0, SPECIAL_HANDLING = 1 };
6627
+ enum class FunctionSideEffects : uint8_t { NO_SIDE_EFFECTS = 0, HAS_SIDE_EFFECTS = 1 };
6628
+
6626
6629
  struct FunctionData {
6627
6630
  DUCKDB_API virtual ~FunctionData();
6628
6631
 
@@ -6731,17 +6734,18 @@ public:
6731
6734
  class BaseScalarFunction : public SimpleFunction {
6732
6735
  public:
6733
6736
  DUCKDB_API BaseScalarFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
6734
- bool has_side_effects, LogicalType varargs = LogicalType(LogicalTypeId::INVALID),
6735
- bool propagates_null_values = false);
6737
+ FunctionSideEffects side_effects,
6738
+ LogicalType varargs = LogicalType(LogicalTypeId::INVALID),
6739
+ FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING);
6736
6740
  DUCKDB_API ~BaseScalarFunction() override;
6737
6741
 
6738
6742
  //! Return type of the function
6739
6743
  LogicalType return_type;
6740
6744
  //! Whether or not the function has side effects (e.g. sequence increments, random() functions, NOW()). Functions
6741
6745
  //! with side-effects cannot be constant-folded.
6742
- bool has_side_effects;
6743
- //! Whether or not the function propagates null values
6744
- bool propagates_null_values;
6746
+ FunctionSideEffects side_effects;
6747
+ //! How this function handles NULL values
6748
+ FunctionNullHandling null_handling;
6745
6749
 
6746
6750
  public:
6747
6751
  DUCKDB_API hash_t Hash() const;
@@ -7649,8 +7653,6 @@ struct FunctionLocalState {
7649
7653
  DUCKDB_API virtual ~FunctionLocalState();
7650
7654
  };
7651
7655
 
7652
- enum class FunctionNullHandling : uint8_t { NULL_IN_NULL_OUT = 0, SPECIAL_HANDLING = 1 };
7653
-
7654
7656
  class Binder;
7655
7657
  class BoundFunctionExpression;
7656
7658
  class ScalarFunctionCatalogEntry;
@@ -7681,19 +7683,19 @@ typedef void (*dependency_function_t)(BoundFunctionExpression &expr, unordered_s
7681
7683
  class ScalarFunction : public BaseScalarFunction {
7682
7684
  public:
7683
7685
  DUCKDB_API ScalarFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
7684
- scalar_function_t function, bool has_side_effects = false,
7685
- bind_scalar_function_t bind = nullptr, dependency_function_t dependency = nullptr,
7686
- function_statistics_t statistics = nullptr, init_local_state_t init_local_state = nullptr,
7686
+ scalar_function_t function, bind_scalar_function_t bind = nullptr,
7687
+ dependency_function_t dependency = nullptr, function_statistics_t statistics = nullptr,
7688
+ init_local_state_t init_local_state = nullptr,
7687
7689
  LogicalType varargs = LogicalType(LogicalTypeId::INVALID),
7688
- bool propagate_null_values = false,
7689
- FunctionNullHandling null_handling = FunctionNullHandling::NULL_IN_NULL_OUT);
7690
+ FunctionSideEffects side_effects = FunctionSideEffects::NO_SIDE_EFFECTS,
7691
+ FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING);
7690
7692
 
7691
7693
  DUCKDB_API ScalarFunction(vector<LogicalType> arguments, LogicalType return_type, scalar_function_t function,
7692
- bool propagate_null_values = false, bool has_side_effects = false,
7693
7694
  bind_scalar_function_t bind = nullptr, dependency_function_t dependency = nullptr,
7694
7695
  function_statistics_t statistics = nullptr, init_local_state_t init_local_state = nullptr,
7695
7696
  LogicalType varargs = LogicalType(LogicalTypeId::INVALID),
7696
- FunctionNullHandling null_handling = FunctionNullHandling::NULL_IN_NULL_OUT);
7697
+ FunctionSideEffects side_effects = FunctionSideEffects::NO_SIDE_EFFECTS,
7698
+ FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING);
7697
7699
 
7698
7700
  //! The main scalar function to execute
7699
7701
  scalar_function_t function;
@@ -7705,8 +7707,6 @@ public:
7705
7707
  dependency_function_t dependency;
7706
7708
  //! The statistics propagation function (if any)
7707
7709
  function_statistics_t statistics;
7708
- //! How this function handles NULL values
7709
- FunctionNullHandling null_handling;
7710
7710
 
7711
7711
  DUCKDB_API static unique_ptr<Expression> BindScalarFunction(ClientContext &context, const string &schema,
7712
7712
  const string &name,
@@ -9423,11 +9423,12 @@ public:
9423
9423
  const LogicalType &return_type, aggregate_size_t state_size,
9424
9424
  aggregate_initialize_t initialize, aggregate_update_t update,
9425
9425
  aggregate_combine_t combine, aggregate_finalize_t finalize,
9426
- bool propagates_null_values = false, aggregate_simple_update_t simple_update = nullptr,
9426
+ FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING,
9427
+ aggregate_simple_update_t simple_update = nullptr,
9427
9428
  bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr,
9428
9429
  aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr)
9429
- : BaseScalarFunction(name, arguments, return_type, false, LogicalType(LogicalTypeId::INVALID),
9430
- propagates_null_values),
9430
+ : BaseScalarFunction(name, arguments, return_type, FunctionSideEffects::NO_SIDE_EFFECTS,
9431
+ LogicalType(LogicalTypeId::INVALID), null_handling),
9431
9432
  state_size(state_size), initialize(initialize), update(update), combine(combine), finalize(finalize),
9432
9433
  simple_update(simple_update), window(window), bind(bind), destructor(destructor), statistics(statistics) {
9433
9434
  }
@@ -9439,7 +9440,8 @@ public:
9439
9440
  aggregate_simple_update_t simple_update = nullptr,
9440
9441
  bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr,
9441
9442
  aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr)
9442
- : BaseScalarFunction(name, arguments, return_type, false, LogicalType(LogicalTypeId::INVALID), false),
9443
+ : BaseScalarFunction(name, arguments, return_type, FunctionSideEffects::NO_SIDE_EFFECTS,
9444
+ LogicalType(LogicalTypeId::INVALID)),
9443
9445
  state_size(state_size), initialize(initialize), update(update), combine(combine), finalize(finalize),
9444
9446
  simple_update(simple_update), window(window), bind(bind), destructor(destructor), statistics(statistics) {
9445
9447
  }
@@ -9447,11 +9449,12 @@ public:
9447
9449
  DUCKDB_API AggregateFunction(const vector<LogicalType> &arguments, const LogicalType &return_type,
9448
9450
  aggregate_size_t state_size, aggregate_initialize_t initialize,
9449
9451
  aggregate_update_t update, aggregate_combine_t combine, aggregate_finalize_t finalize,
9450
- bool propagates_null_values = false, aggregate_simple_update_t simple_update = nullptr,
9452
+ FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING,
9453
+ aggregate_simple_update_t simple_update = nullptr,
9451
9454
  bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr,
9452
9455
  aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr)
9453
9456
  : AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize,
9454
- propagates_null_values, simple_update, bind, destructor, statistics, window) {
9457
+ null_handling, simple_update, bind, destructor, statistics, window) {
9455
9458
  }
9456
9459
 
9457
9460
  DUCKDB_API AggregateFunction(const vector<LogicalType> &arguments, const LogicalType &return_type,
@@ -9460,8 +9463,9 @@ public:
9460
9463
  aggregate_simple_update_t simple_update = nullptr,
9461
9464
  bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr,
9462
9465
  aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr)
9463
- : AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize, false,
9464
- simple_update, bind, destructor, statistics, window) {
9466
+ : AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize,
9467
+ FunctionNullHandling::DEFAULT_NULL_HANDLING, simple_update, bind, destructor, statistics,
9468
+ window) {
9465
9469
  }
9466
9470
  //! The hashed aggregate state sizing function
9467
9471
  aggregate_size_t state_size;
@@ -9515,13 +9519,14 @@ public:
9515
9519
  }
9516
9520
 
9517
9521
  template <class STATE, class INPUT_TYPE, class RESULT_TYPE, class OP>
9518
- static AggregateFunction UnaryAggregate(const LogicalType &input_type, LogicalType return_type,
9519
- bool propagates_null_values = false) {
9522
+ static AggregateFunction
9523
+ UnaryAggregate(const LogicalType &input_type, LogicalType return_type,
9524
+ FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING) {
9520
9525
  return AggregateFunction(
9521
9526
  {input_type}, return_type, AggregateFunction::StateSize<STATE>,
9522
9527
  AggregateFunction::StateInitialize<STATE, OP>, AggregateFunction::UnaryScatterUpdate<STATE, INPUT_TYPE, OP>,
9523
9528
  AggregateFunction::StateCombine<STATE, OP>, AggregateFunction::StateFinalize<STATE, RESULT_TYPE, OP>,
9524
- propagates_null_values, AggregateFunction::UnaryUpdate<STATE, INPUT_TYPE, OP>);
9529
+ null_handling, AggregateFunction::UnaryUpdate<STATE, INPUT_TYPE, OP>);
9525
9530
  }
9526
9531
 
9527
9532
  template <class STATE, class INPUT_TYPE, class RESULT_TYPE, class OP>
@@ -9737,6 +9742,7 @@ public:
9737
9742
 
9738
9743
  AggregateFunction aggr_function(move(name), move(arguments), move(return_type), state_size, initialize, update,
9739
9744
  combine, finalize, simple_update, bind, destructor);
9745
+ aggr_function.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
9740
9746
  return aggr_function;
9741
9747
  }
9742
9748