duckdb 0.3.3-dev1495.0 → 0.3.3-dev1504.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-dev1495.0",
4
+ "version": "0.3.3-dev1504.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -59862,6 +59862,7 @@ struct IEJoinUnion {
59862
59862
  IEJoinUnion(ClientContext &context, const PhysicalIEJoin &op, SortedTable &t1, const idx_t b1, SortedTable &t2,
59863
59863
  const idx_t b2);
59864
59864
 
59865
+ idx_t SearchL1(idx_t pos);
59865
59866
  bool NextRow();
59866
59867
 
59867
59868
  //! Inverted loop
@@ -59890,6 +59891,7 @@ struct IEJoinUnion {
59890
59891
  //! Iteration state
59891
59892
  idx_t n;
59892
59893
  idx_t i;
59894
+ idx_t j;
59893
59895
  unique_ptr<SBIterator> op1;
59894
59896
  unique_ptr<SBIterator> off1;
59895
59897
  unique_ptr<SBIterator> op2;
@@ -60077,9 +60079,57 @@ IEJoinUnion::IEJoinUnion(ClientContext &context, const PhysicalIEJoin &op, Sorte
60077
60079
  op2 = make_unique<SBIterator>(l2->global_sort_state, cmp2);
60078
60080
  off2 = make_unique<SBIterator>(l2->global_sort_state, cmp2);
60079
60081
  i = 0;
60082
+ j = 0;
60080
60083
  (void)NextRow();
60081
60084
  }
60082
60085
 
60086
+ idx_t IEJoinUnion::SearchL1(idx_t pos) {
60087
+ // Perform an exponential search in the appropriate direction
60088
+ op1->SetIndex(pos);
60089
+
60090
+ idx_t step = 1;
60091
+ auto hi = pos;
60092
+ auto lo = pos;
60093
+ if (!op1->cmp) {
60094
+ // Scan left for loose inequality
60095
+ lo -= MinValue(step, lo);
60096
+ step *= 2;
60097
+ off1->SetIndex(lo);
60098
+ while (lo > 0 && op1->Compare(*off1)) {
60099
+ hi = lo;
60100
+ lo -= MinValue(step, lo);
60101
+ step *= 2;
60102
+ off1->SetIndex(lo);
60103
+ }
60104
+ } else {
60105
+ // Scan right for strict inequality
60106
+ hi += MinValue(step, n - hi);
60107
+ step *= 2;
60108
+ off1->SetIndex(hi);
60109
+ while (hi < n && !op1->Compare(*off1)) {
60110
+ lo = hi;
60111
+ hi += MinValue(step, n - hi);
60112
+ step *= 2;
60113
+ off1->SetIndex(hi);
60114
+ }
60115
+ }
60116
+
60117
+ // Binary search the target area
60118
+ while (lo < hi) {
60119
+ const auto mid = lo + (hi - lo) / 2;
60120
+ off1->SetIndex(mid);
60121
+ if (op1->Compare(*off1)) {
60122
+ hi = mid;
60123
+ } else {
60124
+ lo = mid + 1;
60125
+ }
60126
+ }
60127
+
60128
+ off1->SetIndex(lo);
60129
+
60130
+ return lo;
60131
+ }
60132
+
60083
60133
  bool IEJoinUnion::NextRow() {
60084
60134
  for (; i < n; ++i) {
60085
60135
  // 12. pos ← P[i]
@@ -60096,22 +60146,20 @@ bool IEJoinUnion::NextRow() {
60096
60146
  break;
60097
60147
  }
60098
60148
  const auto p2 = p[off2->GetIndex()];
60099
- bit_mask.SetValid(p2);
60100
- bloom_filter.SetValid(p2 / BLOOM_CHUNK_BITS);
60149
+ if (li[p2] < 0) {
60150
+ // Only mark rhs matches.
60151
+ bit_mask.SetValid(p2);
60152
+ bloom_filter.SetValid(p2 / BLOOM_CHUNK_BITS);
60153
+ }
60101
60154
  }
60102
60155
 
60103
60156
  // 9. if (op1 ∈ {≤,≥} and op2 ∈ {≤,≥}) eqOff = 0
60104
60157
  // 10. else eqOff = 1
60105
60158
  // No, because there could be more than one equal value.
60106
- // Scan the neighborhood instead
60107
- op1->SetIndex(pos);
60108
- off1->SetIndex(pos);
60109
- for (; off1->GetIndex() > 0 && op1->Compare(*off1); --(*off1)) {
60110
- continue;
60111
- }
60112
- for (; off1->GetIndex() < n && !op1->Compare(*off1); ++(*off1)) {
60113
- continue;
60114
- }
60159
+ // Find the leftmost off1 where L1[pos] op1 L1[off1..n]
60160
+ // These are the rows that satisfy the op1 condition
60161
+ // and that is where we should start scanning B from
60162
+ j = SearchL1(pos);
60115
60163
 
60116
60164
  return true;
60117
60165
  }
@@ -60167,7 +60215,6 @@ idx_t IEJoinUnion::JoinComplexBlocks(SelectionVector &lsel, SelectionVector &rse
60167
60215
  // 13. for (j ← pos+eqOff to n) do
60168
60216
  for (;;) {
60169
60217
  // 14. if B[j] = 1 then
60170
- auto j = off1->GetIndex();
60171
60218
 
60172
60219
  // Use the Bloom filter to find candidate blocks
60173
60220
  while (j < n) {
@@ -60184,10 +60231,10 @@ idx_t IEJoinUnion::JoinComplexBlocks(SelectionVector &lsel, SelectionVector &rse
60184
60231
  if (j >= n) {
60185
60232
  break;
60186
60233
  }
60187
- off1->SetIndex(j + 1);
60188
60234
 
60189
60235
  // Filter out tuples with the same sign (they come from the same table)
60190
60236
  const auto rrid = li[j];
60237
+ ++j;
60191
60238
 
60192
60239
  // 15. add tuples w.r.t. (L1[j], L1[i]) to join result
60193
60240
  if (lrid > 0 && rrid < 0) {
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 "b6901375c"
15
- #define DUCKDB_VERSION "v0.3.3-dev1495"
14
+ #define DUCKDB_SOURCE_ID "31db2bada"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1504"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //