duckdb 0.3.5-dev324.0 → 0.3.5-dev346.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.5-dev324.0",
4
+ "version": "0.3.5-dev346.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -50336,13 +50336,9 @@ static bool TimestampTzCastSwitch(Vector &source, Vector &result, idx_t count, s
50336
50336
  // timestamp with time zone to varchar
50337
50337
  VectorStringCast<timestamp_t, duckdb::StringCastTZ>(source, result, count);
50338
50338
  break;
50339
- case LogicalTypeId::DATE:
50340
- // timestamp with time zone to date
50341
- UnaryExecutor::Execute<timestamp_t, date_t, duckdb::Cast>(source, result, count);
50342
- break;
50343
- case LogicalTypeId::TIME:
50344
50339
  case LogicalTypeId::TIME_TZ:
50345
- // timestamp with time zone to time
50340
+ // timestamp with time zone to time with time zone.
50341
+ // TODO: set the offset to +00
50346
50342
  UnaryExecutor::Execute<timestamp_t, dtime_t, duckdb::Cast>(source, result, count);
50347
50343
  break;
50348
50344
  case LogicalTypeId::TIMESTAMP:
@@ -77817,6 +77813,9 @@ void AvgFun::RegisterFunction(BuiltinFunctions &set) {
77817
77813
  LogicalType::DOUBLE, LogicalType::DOUBLE, true));
77818
77814
  set.AddFunction(avg);
77819
77815
 
77816
+ avg.name = "mean";
77817
+ set.AddFunction(avg);
77818
+
77820
77819
  AggregateFunctionSet favg("favg");
77821
77820
  favg.AddFunction(AggregateFunction::UnaryAggregate<KahanAvgState, double, double, KahanAverageOperation>(
77822
77821
  LogicalType::DOUBLE, LogicalType::DOUBLE, true));
@@ -129093,44 +129092,75 @@ FilterResult FilterCombiner::AddFilter(Expression *expr) {
129093
129092
  if (expr->GetExpressionClass() == ExpressionClass::BOUND_BETWEEN) {
129094
129093
  auto &comparison = (BoundBetweenExpression &)*expr;
129095
129094
  //! check if one of the sides is a scalar value
129096
- bool left_is_scalar = comparison.lower->IsFoldable();
129097
- bool right_is_scalar = comparison.upper->IsFoldable();
129098
- if (left_is_scalar || right_is_scalar) {
129099
- //! comparison with scalar
129095
+ bool lower_is_scalar = comparison.lower->IsFoldable();
129096
+ bool upper_is_scalar = comparison.upper->IsFoldable();
129097
+ if (lower_is_scalar || upper_is_scalar) {
129098
+ //! comparison with scalar - break apart
129100
129099
  auto node = GetNode(comparison.input.get());
129101
129100
  idx_t equivalence_set = GetEquivalenceSet(node);
129102
- auto scalar = comparison.lower.get();
129103
- auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
129101
+ auto result = FilterResult::UNSATISFIABLE;
129102
+
129103
+ if (lower_is_scalar) {
129104
+ auto scalar = comparison.lower.get();
129105
+ auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
129104
129106
 
129105
- // create the ExpressionValueInformation
129106
- ExpressionValueInformation info;
129107
- if (comparison.lower_inclusive) {
129108
- info.comparison_type = ExpressionType::COMPARE_GREATERTHANOREQUALTO;
129107
+ // create the ExpressionValueInformation
129108
+ ExpressionValueInformation info;
129109
+ if (comparison.lower_inclusive) {
129110
+ info.comparison_type = ExpressionType::COMPARE_GREATERTHANOREQUALTO;
129111
+ } else {
129112
+ info.comparison_type = ExpressionType::COMPARE_GREATERTHAN;
129113
+ }
129114
+ info.constant = constant_value;
129115
+
129116
+ // get the current bucket of constant values
129117
+ D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
129118
+ auto &info_list = constant_values.find(equivalence_set)->second;
129119
+ // check the existing constant comparisons to see if we can do any pruning
129120
+ result = AddConstantComparison(info_list, info);
129109
129121
  } else {
129110
- info.comparison_type = ExpressionType::COMPARE_GREATERTHAN;
129122
+ D_ASSERT(upper_is_scalar);
129123
+ const auto type = comparison.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO
129124
+ : ExpressionType::COMPARE_LESSTHAN;
129125
+ auto left = comparison.lower->Copy();
129126
+ auto right = comparison.input->Copy();
129127
+ auto lower_comp = make_unique<BoundComparisonExpression>(type, move(left), move(right));
129128
+ result = AddBoundComparisonFilter(lower_comp.get());
129129
+ }
129130
+
129131
+ // Stop if we failed
129132
+ if (result != FilterResult::SUCCESS) {
129133
+ return result;
129111
129134
  }
129112
- info.constant = constant_value;
129113
129135
 
129114
- // get the current bucket of constant values
129115
- D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
129116
- auto &info_list = constant_values.find(equivalence_set)->second;
129117
- // check the existing constant comparisons to see if we can do any pruning
129118
- AddConstantComparison(info_list, info);
129119
- scalar = comparison.upper.get();
129120
- constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
129136
+ if (upper_is_scalar) {
129137
+ auto scalar = comparison.upper.get();
129138
+ auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
129121
129139
 
129122
- // create the ExpressionValueInformation
129123
- if (comparison.upper_inclusive) {
129124
- info.comparison_type = ExpressionType::COMPARE_LESSTHANOREQUALTO;
129140
+ // create the ExpressionValueInformation
129141
+ ExpressionValueInformation info;
129142
+ if (comparison.upper_inclusive) {
129143
+ info.comparison_type = ExpressionType::COMPARE_LESSTHANOREQUALTO;
129144
+ } else {
129145
+ info.comparison_type = ExpressionType::COMPARE_LESSTHAN;
129146
+ }
129147
+ info.constant = constant_value;
129148
+
129149
+ // get the current bucket of constant values
129150
+ D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
129151
+ // check the existing constant comparisons to see if we can do any pruning
129152
+ result = AddConstantComparison(constant_values.find(equivalence_set)->second, info);
129125
129153
  } else {
129126
- info.comparison_type = ExpressionType::COMPARE_LESSTHAN;
129154
+ D_ASSERT(lower_is_scalar);
129155
+ const auto type = comparison.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO
129156
+ : ExpressionType::COMPARE_LESSTHAN;
129157
+ auto left = comparison.input->Copy();
129158
+ auto right = comparison.upper->Copy();
129159
+ auto upper_comp = make_unique<BoundComparisonExpression>(type, move(left), move(right));
129160
+ result = AddBoundComparisonFilter(upper_comp.get());
129127
129161
  }
129128
- info.constant = constant_value;
129129
129162
 
129130
- // get the current bucket of constant values
129131
- D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
129132
- // check the existing constant comparisons to see if we can do any pruning
129133
- return AddConstantComparison(constant_values.find(equivalence_set)->second, info);
129163
+ return result;
129134
129164
  }
129135
129165
  } else if (expr->GetExpressionClass() == ExpressionClass::BOUND_COMPARISON) {
129136
129166
  return AddBoundComparisonFilter(expr);
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 "fc2413a5e"
15
- #define DUCKDB_VERSION "v0.3.5-dev324"
14
+ #define DUCKDB_SOURCE_ID "0a96249d0"
15
+ #define DUCKDB_VERSION "v0.3.5-dev346"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -22808,8 +22808,8 @@ namespace duckdb {
22808
22808
 
22809
22809
  class BetweenExpression : public ParsedExpression {
22810
22810
  public:
22811
- BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22812
- unique_ptr<ParsedExpression> upper);
22811
+ DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
22812
+ unique_ptr<ParsedExpression> upper);
22813
22813
 
22814
22814
  unique_ptr<ParsedExpression> input;
22815
22815
  unique_ptr<ParsedExpression> lower;