duckdb 0.3.2-dev330.0 → 0.3.2-dev333.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-dev330.0",
4
+ "version": "0.3.2-dev333.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -84826,14 +84826,7 @@ static void LeastGreatestFunction(DataChunk &args, ExpressionState &state, Vecto
84826
84826
  }
84827
84827
  auto result_type = VectorType::CONSTANT_VECTOR;
84828
84828
  for (idx_t col_idx = 0; col_idx < args.ColumnCount(); col_idx++) {
84829
- if (args.data[col_idx].GetVectorType() == VectorType::CONSTANT_VECTOR) {
84830
- if (ConstantVector::IsNull(args.data[col_idx])) {
84831
- // constant NULL: result is constant NULL
84832
- result.SetVectorType(VectorType::CONSTANT_VECTOR);
84833
- ConstantVector::SetNull(result, true);
84834
- return;
84835
- }
84836
- } else {
84829
+ if (args.data[col_idx].GetVectorType() != VectorType::CONSTANT_VECTOR) {
84837
84830
  // non-constant input: result is not a constant vector
84838
84831
  result_type = VectorType::FLAT_VECTOR;
84839
84832
  }
@@ -84843,60 +84836,67 @@ static void LeastGreatestFunction(DataChunk &args, ExpressionState &state, Vecto
84843
84836
  }
84844
84837
  }
84845
84838
 
84846
- // we start off performing a binary operation between the first two inputs, where we store the lowest (or highest)
84847
- // directly in the result
84848
- BinaryExecutor::ExecuteGeneric<T, T, T, BinarySingleArgumentOperatorWrapper, LeastOperator<OP>, bool>(
84849
- args.data[0], args.data[1], result, args.size(), false);
84850
-
84851
- // now we loop over the other columns and compare it to the stored result
84852
84839
  auto result_data = FlatVector::GetData<T>(result);
84853
84840
  auto &result_mask = FlatVector::Validity(result);
84854
- SelectionVector rsel;
84855
- idx_t rcount = 0;
84856
- // create a selection vector from the mask
84857
- rsel.Initialize();
84858
- for (idx_t i = 0; i < args.size(); i++) {
84859
- if (result_mask.RowIsValid(i)) {
84860
- rsel.set_index(rcount++, i);
84841
+ // copy over the first column
84842
+ bool result_has_value[STANDARD_VECTOR_SIZE];
84843
+ {
84844
+ VectorData vdata;
84845
+ args.data[0].Orrify(args.size(), vdata);
84846
+ auto input_data = (T *)vdata.data;
84847
+ for (idx_t i = 0; i < args.size(); i++) {
84848
+ auto vindex = vdata.sel->get_index(i);
84849
+ if (vdata.validity.RowIsValid(vindex)) {
84850
+ result_data[i] = input_data[vindex];
84851
+ result_has_value[i] = true;
84852
+ } else {
84853
+ result_has_value[i] = false;
84854
+ }
84861
84855
  }
84862
84856
  }
84863
- for (idx_t col_idx = 2; col_idx < args.ColumnCount(); col_idx++) {
84857
+ // now handle the remainder of the columns
84858
+ for (idx_t col_idx = 1; col_idx < args.ColumnCount(); col_idx++) {
84859
+ if (args.data[col_idx].GetVectorType() == VectorType::CONSTANT_VECTOR &&
84860
+ ConstantVector::IsNull(args.data[col_idx])) {
84861
+ // ignore null vector
84862
+ continue;
84863
+ }
84864
+
84864
84865
  VectorData vdata;
84865
84866
  args.data[col_idx].Orrify(args.size(), vdata);
84866
84867
 
84867
84868
  auto input_data = (T *)vdata.data;
84868
84869
  if (!vdata.validity.AllValid()) {
84869
84870
  // potential new null entries: have to check the null mask
84870
- idx_t new_count = 0;
84871
- for (idx_t i = 0; i < rcount; i++) {
84872
- auto rindex = rsel.get_index(i);
84873
- auto vindex = vdata.sel->get_index(rindex);
84874
- if (!vdata.validity.RowIsValid(vindex)) {
84875
- // new null entry: set nullmask
84876
- result_mask.SetInvalid(rindex);
84877
- } else {
84871
+ for (idx_t i = 0; i < args.size(); i++) {
84872
+ auto vindex = vdata.sel->get_index(i);
84873
+ if (vdata.validity.RowIsValid(vindex)) {
84878
84874
  // not a null entry: perform the operation and add to new set
84879
84875
  auto ivalue = input_data[vindex];
84880
- if (OP::template Operation<T>(ivalue, result_data[rindex])) {
84881
- result_data[rindex] = ivalue;
84876
+ if (!result_has_value[i] || OP::template Operation<T>(ivalue, result_data[i])) {
84877
+ result_has_value[i] = true;
84878
+ result_data[i] = ivalue;
84882
84879
  }
84883
- rsel.set_index(new_count++, rindex);
84884
84880
  }
84885
84881
  }
84886
- rcount = new_count;
84887
84882
  } else {
84888
84883
  // no new null entries: only need to perform the operation
84889
- for (idx_t i = 0; i < rcount; i++) {
84890
- auto rindex = rsel.get_index(i);
84891
- auto vindex = vdata.sel->get_index(rindex);
84884
+ for (idx_t i = 0; i < args.size(); i++) {
84885
+ auto vindex = vdata.sel->get_index(i);
84892
84886
 
84893
84887
  auto ivalue = input_data[vindex];
84894
- if (OP::template Operation<T>(ivalue, result_data[rindex])) {
84895
- result_data[rindex] = ivalue;
84888
+ if (!result_has_value[i] || OP::template Operation<T>(ivalue, result_data[i])) {
84889
+ result_has_value[i] = true;
84890
+ result_data[i] = ivalue;
84896
84891
  }
84897
84892
  }
84898
84893
  }
84899
84894
  }
84895
+ for (idx_t i = 0; i < args.size(); i++) {
84896
+ if (!result_has_value[i]) {
84897
+ result_mask.SetInvalid(i);
84898
+ }
84899
+ }
84900
84900
  result.SetVectorType(result_type);
84901
84901
  }
84902
84902
 
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "ae8562793"
14
- #define DUCKDB_VERSION "0.3.2-dev330"
13
+ #define DUCKDB_SOURCE_ID "efba70686"
14
+ #define DUCKDB_VERSION "0.3.2-dev333"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //