Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/d2ts/src/multiset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DefaultMap } from './utils.js'
import { DefaultMap, chunkedArrayPush } from './utils.js'

export type MultiSetArray<T> = [T, number][]
export type KeyedData<T> = [key: string, value: T]
Expand Down Expand Up @@ -55,8 +55,8 @@ export class MultiSet<T> {
*/
concat(other: MultiSet<T>): MultiSet<T> {
const out: MultiSetArray<T> = []
out.push(...this.#inner)
out.push(...other.#inner)
chunkedArrayPush(out, this.#inner)
chunkedArrayPush(out, other.getInner())
return new MultiSet(out)
}

Expand Down Expand Up @@ -93,7 +93,7 @@ export class MultiSet<T> {
const out: MultiSetArray<KeyedData<[T, U]>> = []

for (const [[k1, v1], d1] of this.#inner as MultiSetArray<KeyedData<T>>) {
for (const [[k2, v2], d2] of other.#inner) {
for (const [[k2, v2], d2] of other.getInner()) {
if (k1 === k2) {
out.push([[k1, [v1, v2]], d1 * d2])
}
Expand Down Expand Up @@ -283,11 +283,8 @@ export class MultiSet<T> {
}

extend(other: MultiSet<T> | MultiSetArray<T>): void {
if (other instanceof MultiSet) {
this.#inner.push(...other.getInner())
} else {
this.#inner.push(...other)
}
const otherArray = other instanceof MultiSet ? other.getInner() : other
chunkedArrayPush(this.#inner, otherArray)
}

getInner(): MultiSetArray<T> {
Expand Down
4 changes: 2 additions & 2 deletions packages/d2ts/src/sqlite/operators/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class JoinOperatorSQLite<K, V1, V2> extends BinaryOperator<
super(id, inputA, inputB, output, initialFrontier)
this.#indexA = new SQLIndex<K, V1>(db, `join_a_${id}`)
this.#indexB = new SQLIndex<K, V2>(db, `join_b_${id}`)
this.#deltaA = new SQLIndex<K, V1>(db, `join_delta_a_${id}`)
this.#deltaB = new SQLIndex<K, V2>(db, `join_delta_b_${id}`)
this.#deltaA = new SQLIndex<K, V1>(db, `join_delta_a_${id}`, true)
this.#deltaB = new SQLIndex<K, V2>(db, `join_delta_b_${id}`, true)
}

run(): void {
Expand Down
Loading
Loading