duckdb 0.3.2-dev733.0 → 0.3.2-dev772.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.2-dev733.0",
4
+ "version": "0.3.2-dev772.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -33840,13 +33840,14 @@ void ValidityMask::Slice(const ValidityMask &other, idx_t offset) {
33840
33840
  Initialize(other);
33841
33841
  return;
33842
33842
  }
33843
- Initialize(STANDARD_VECTOR_SIZE);
33843
+ ValidityMask new_mask(STANDARD_VECTOR_SIZE);
33844
33844
 
33845
33845
  // FIXME THIS NEEDS FIXING!
33846
33846
  #if 1
33847
33847
  for (idx_t i = offset; i < STANDARD_VECTOR_SIZE; i++) {
33848
- Set(i - offset, other.RowIsValid(i));
33848
+ new_mask.Set(i - offset, other.RowIsValid(i));
33849
33849
  }
33850
+ Initialize(new_mask);
33850
33851
  #else
33851
33852
  // first shift the "whole" units
33852
33853
  idx_t entire_units = offset / BITS_PER_VALUE;
@@ -33854,7 +33855,7 @@ void ValidityMask::Slice(const ValidityMask &other, idx_t offset) {
33854
33855
  if (entire_units > 0) {
33855
33856
  idx_t validity_idx;
33856
33857
  for (validity_idx = 0; validity_idx + entire_units < STANDARD_ENTRY_COUNT; validity_idx++) {
33857
- validity_mask[validity_idx] = other.validity_mask[validity_idx + entire_units];
33858
+ new_mask.validity_mask[validity_idx] = other.validity_mask[validity_idx + entire_units];
33858
33859
  }
33859
33860
  }
33860
33861
  // now we shift the remaining sub units
@@ -33869,15 +33870,17 @@ void ValidityMask::Slice(const ValidityMask &other, idx_t offset) {
33869
33870
  if (sub_units > 0) {
33870
33871
  idx_t validity_idx;
33871
33872
  for (validity_idx = 0; validity_idx + 1 < STANDARD_ENTRY_COUNT; validity_idx++) {
33872
- validity_mask[validity_idx] = (other.validity_mask[validity_idx] >> sub_units) |
33873
- (other.validity_mask[validity_idx + 1] << (BITS_PER_VALUE - sub_units));
33873
+ new_mask.validity_mask[validity_idx] =
33874
+ (other.validity_mask[validity_idx] >> sub_units) |
33875
+ (other.validity_mask[validity_idx + 1] << (BITS_PER_VALUE - sub_units));
33874
33876
  }
33875
- validity_mask[validity_idx] >>= sub_units;
33877
+ new_mask.validity_mask[validity_idx] >>= sub_units;
33876
33878
  }
33877
33879
  #ifdef DEBUG
33878
33880
  for (idx_t i = offset; i < STANDARD_VECTOR_SIZE; i++) {
33879
- D_ASSERT(RowIsValid(i - offset) == other.RowIsValid(i));
33881
+ D_ASSERT(new_mask.RowIsValid(i - offset) == other.RowIsValid(i));
33880
33882
  }
33883
+ Initialize(new_mask);
33881
33884
  #endif
33882
33885
  #endif
33883
33886
  }
@@ -63950,10 +63953,7 @@ namespace duckdb {
63950
63953
  //! LogicalLimit represents a LIMIT clause
63951
63954
  class LogicalLimit : public LogicalOperator {
63952
63955
  public:
63953
- LogicalLimit(int64_t limit_val, int64_t offset_val, unique_ptr<Expression> limit, unique_ptr<Expression> offset)
63954
- : LogicalOperator(LogicalOperatorType::LOGICAL_LIMIT), limit_val(limit_val), offset_val(offset_val),
63955
- limit(move(limit)), offset(move(offset)) {
63956
- }
63956
+ LogicalLimit(int64_t limit_val, int64_t offset_val, unique_ptr<Expression> limit, unique_ptr<Expression> offset);
63957
63957
 
63958
63958
  //! Limit and offset values in case they are constants, used in optimizations.
63959
63959
  int64_t limit_val;
@@ -63964,14 +63964,12 @@ public:
63964
63964
  unique_ptr<Expression> offset;
63965
63965
 
63966
63966
  public:
63967
- vector<ColumnBinding> GetColumnBindings() override {
63968
- return children[0]->GetColumnBindings();
63969
- }
63967
+ vector<ColumnBinding> GetColumnBindings() override;
63968
+
63969
+ idx_t EstimateCardinality(ClientContext &context) override;
63970
63970
 
63971
63971
  protected:
63972
- void ResolveTypes() override {
63973
- types = children[0]->types;
63974
- }
63972
+ void ResolveTypes() override;
63975
63973
  };
63976
63974
  } // namespace duckdb
63977
63975
 
@@ -64394,23 +64392,18 @@ namespace duckdb {
64394
64392
  //! LogicalSample represents a SAMPLE clause
64395
64393
  class LogicalSample : public LogicalOperator {
64396
64394
  public:
64397
- LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child)
64398
- : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(move(sample_options_p)) {
64399
- children.push_back(move(child));
64400
- }
64395
+ LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child);
64401
64396
 
64402
64397
  //! The sample options
64403
64398
  unique_ptr<SampleOptions> sample_options;
64404
64399
 
64405
64400
  public:
64406
- vector<ColumnBinding> GetColumnBindings() override {
64407
- return children[0]->GetColumnBindings();
64408
- }
64401
+ vector<ColumnBinding> GetColumnBindings() override;
64402
+
64403
+ idx_t EstimateCardinality(ClientContext &context) override;
64409
64404
 
64410
64405
  protected:
64411
- void ResolveTypes() override {
64412
- types = children[0]->types;
64413
- }
64406
+ void ResolveTypes() override;
64414
64407
  };
64415
64408
 
64416
64409
  } // namespace duckdb
@@ -150796,6 +150789,33 @@ void LogicalJoin::GetExpressionBindings(Expression &expr, unordered_set<idx_t> &
150796
150789
  } // namespace duckdb
150797
150790
 
150798
150791
 
150792
+ namespace duckdb {
150793
+
150794
+ LogicalLimit::LogicalLimit(int64_t limit_val, int64_t offset_val, unique_ptr<Expression> limit,
150795
+ unique_ptr<Expression> offset)
150796
+ : LogicalOperator(LogicalOperatorType::LOGICAL_LIMIT), limit_val(limit_val), offset_val(offset_val),
150797
+ limit(move(limit)), offset(move(offset)) {
150798
+ }
150799
+
150800
+ vector<ColumnBinding> LogicalLimit::GetColumnBindings() {
150801
+ return children[0]->GetColumnBindings();
150802
+ }
150803
+
150804
+ idx_t LogicalLimit::EstimateCardinality(ClientContext &context) {
150805
+ auto child_cardinality = children[0]->EstimateCardinality(context);
150806
+ if (limit_val >= 0 && idx_t(limit_val) < child_cardinality) {
150807
+ child_cardinality = limit_val;
150808
+ }
150809
+ return child_cardinality;
150810
+ }
150811
+
150812
+ void LogicalLimit::ResolveTypes() {
150813
+ types = children[0]->types;
150814
+ }
150815
+
150816
+ } // namespace duckdb
150817
+
150818
+
150799
150819
  namespace duckdb {
150800
150820
 
150801
150821
  LogicalProjection::LogicalProjection(idx_t table_index, vector<unique_ptr<Expression>> select_list)
@@ -150815,6 +150835,37 @@ void LogicalProjection::ResolveTypes() {
150815
150835
  } // namespace duckdb
150816
150836
 
150817
150837
 
150838
+ namespace duckdb {
150839
+
150840
+ LogicalSample::LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child)
150841
+ : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(move(sample_options_p)) {
150842
+ children.push_back(move(child));
150843
+ }
150844
+
150845
+ vector<ColumnBinding> LogicalSample::GetColumnBindings() {
150846
+ return children[0]->GetColumnBindings();
150847
+ }
150848
+
150849
+ idx_t LogicalSample::EstimateCardinality(ClientContext &context) {
150850
+ auto child_cardinality = children[0]->EstimateCardinality(context);
150851
+ if (sample_options->is_percentage) {
150852
+ return idx_t(child_cardinality * sample_options->sample_size.GetValue<double>());
150853
+ } else {
150854
+ auto sample_size = sample_options->sample_size.GetValue<uint64_t>();
150855
+ if (sample_size < child_cardinality) {
150856
+ return sample_size;
150857
+ }
150858
+ }
150859
+ return child_cardinality;
150860
+ }
150861
+
150862
+ void LogicalSample::ResolveTypes() {
150863
+ types = children[0]->types;
150864
+ }
150865
+
150866
+ } // namespace duckdb
150867
+
150868
+
150818
150869
  namespace duckdb {
150819
150870
 
150820
150871
  vector<ColumnBinding> LogicalUnnest::GetColumnBindings() {
@@ -153665,6 +153716,7 @@ void __fastpack64(const uint64_t *__restrict in, uint32_t *__restrict out);
153665
153716
  // LICENSE_CHANGE_END
153666
153717
 
153667
153718
 
153719
+
153668
153720
  #include <stdexcept>
153669
153721
 
153670
153722
  namespace duckdb_fastpforlib {
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 "20a3c6a83"
15
- #define DUCKDB_VERSION "0.3.2-dev733"
14
+ #define DUCKDB_SOURCE_ID "c9573d243"
15
+ #define DUCKDB_VERSION "0.3.2-dev772"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //