Skip to content

Commit

Permalink
fix: fix symmetric hash join memory issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswr committed May 18, 2024
1 parent d3ace4c commit 94c880f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions join/SymmetricHashJoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,18 @@ class SymmetricHashJoin extends AsyncIterator
}

let hash = this.funHash(item);
let map = this.usedLeft ? this.leftMap : this.rightMap;
if (!map.has(hash))
map.set(hash, []);
let arr = map.get(hash);
arr.push(item);

if (this.usedLeft && this.right.done) {
this.leftMap = null;
} else if (this.left.done) {
this.rightMap = null;
} else {
let map = this.usedLeft ? this.leftMap : this.rightMap;
if (!map.has(hash))
map.set(hash, []);
let arr = map.get(hash);
arr.push(item);
}

this.match = item;
this.matches = (this.usedLeft ? this.rightMap : this.leftMap).get(hash) || [];
Expand Down

0 comments on commit 94c880f

Please sign in to comment.