Skip to content

Commit 30c353a

Browse files
ci: apply automated fixes
1 parent 7f37925 commit 30c353a

File tree

3 files changed

+35
-45
lines changed

3 files changed

+35
-45
lines changed

packages/db-ivm/src/operators/groupedTopKWithFractionalIndex.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { DifferenceStreamWriter, UnaryOperator } from '../graph.js'
22
import { StreamBuilder } from '../d2.js'
33
import { MultiSet } from '../multiset.js'
4-
import {
5-
TopKArray,
6-
createKeyedComparator,
7-
} from './topKWithFractionalIndex.js'
4+
import { TopKArray, createKeyedComparator } from './topKWithFractionalIndex.js'
85
import type { DifferenceStreamReader } from '../graph.js'
96
import type { IStreamBuilder, PipedOperator } from '../types.js'
107
import type {

packages/db-ivm/src/operators/topKWithFractionalIndex.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,3 @@ export function topKWithFractionalIndex<KType extends string | number, T>(
458458
return output
459459
}
460460
}
461-

packages/db-ivm/tests/operators/groupedTopKWithFractionalIndex.test.ts

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ describe(`Operators`, () => {
99
describe(`GroupedTopKWithFractionalIndex operator`, () => {
1010
it(`should maintain separate topK per group`, () => {
1111
const graph = new D2()
12-
const input = graph.newInput<
13-
[string, { id: string; group: string; value: number }]
14-
>()
12+
const input =
13+
graph.newInput<[string, { id: string; group: string; value: number }]>()
1514
const tracker = new MessageTracker<
1615
[string, [{ id: string; group: string; value: number }, string]]
1716
>()
@@ -69,9 +68,8 @@ describe(`Operators`, () => {
6968

7069
it(`should handle incremental updates within a group`, () => {
7170
const graph = new D2()
72-
const input = graph.newInput<
73-
[string, { id: string; group: string; value: number }]
74-
>()
71+
const input =
72+
graph.newInput<[string, { id: string; group: string; value: number }]>()
7573
const tracker = new MessageTracker<
7674
[string, [{ id: string; group: string; value: number }, string]]
7775
>()
@@ -129,9 +127,8 @@ describe(`Operators`, () => {
129127

130128
it(`should handle removal of elements from topK`, () => {
131129
const graph = new D2()
132-
const input = graph.newInput<
133-
[string, { id: string; group: string; value: number }]
134-
>()
130+
const input =
131+
graph.newInput<[string, { id: string; group: string; value: number }]>()
135132
const tracker = new MessageTracker<
136133
[string, [{ id: string; group: string; value: number }, string]]
137134
>()
@@ -181,9 +178,8 @@ describe(`Operators`, () => {
181178

182179
it(`should handle multiple groups independently`, () => {
183180
const graph = new D2()
184-
const input = graph.newInput<
185-
[string, { id: string; group: string; value: number }]
186-
>()
181+
const input =
182+
graph.newInput<[string, { id: string; group: string; value: number }]>()
187183
const tracker = new MessageTracker<
188184
[string, [{ id: string; group: string; value: number }, string]]
189185
>()
@@ -224,7 +220,9 @@ describe(`Operators`, () => {
224220
const updateResult = tracker.getResult()
225221
// Only group1 should be affected
226222
const affectedGroups = new Set(
227-
updateResult.messages.map(([[_key, [value, _idx]], _mult]) => value.group),
223+
updateResult.messages.map(
224+
([[_key, [value, _idx]], _mult]) => value.group,
225+
),
228226
)
229227
expect(affectedGroups.size).toBe(1)
230228
expect(affectedGroups.has(`group1`)).toBe(true)
@@ -233,9 +231,8 @@ describe(`Operators`, () => {
233231

234232
it(`should support offset within groups`, () => {
235233
const graph = new D2()
236-
const input = graph.newInput<
237-
[string, { id: string; group: string; value: number }]
238-
>()
234+
const input =
235+
graph.newInput<[string, { id: string; group: string; value: number }]>()
239236
const tracker = new MessageTracker<
240237
[string, [{ id: string; group: string; value: number }, string]]
241238
>()
@@ -276,9 +273,7 @@ describe(`Operators`, () => {
276273
it(`should use groupKeyFn to extract group from key with delimiter`, () => {
277274
const graph = new D2()
278275
// Use keys with format "group:itemId"
279-
const input = graph.newInput<
280-
[string, { id: string; value: number }]
281-
>()
276+
const input = graph.newInput<[string, { id: string; value: number }]>()
282277
const tracker = new MessageTracker<
283278
[string, [{ id: string; value: number }, string]]
284279
>()
@@ -330,9 +325,8 @@ describe(`Operators`, () => {
330325

331326
it(`should support infinite limit (no limit)`, () => {
332327
const graph = new D2()
333-
const input = graph.newInput<
334-
[string, { id: string; group: string; value: number }]
335-
>()
328+
const input =
329+
graph.newInput<[string, { id: string; group: string; value: number }]>()
336330
const tracker = new MessageTracker<
337331
[string, [{ id: string; group: string; value: number }, string]]
338332
>()
@@ -370,9 +364,8 @@ describe(`Operators`, () => {
370364

371365
it(`should maintain fractional indices correctly within groups`, () => {
372366
const graph = new D2()
373-
const input = graph.newInput<
374-
[string, { id: string; group: string; value: number }]
375-
>()
367+
const input =
368+
graph.newInput<[string, { id: string; group: string; value: number }]>()
376369
const tracker = new MessageTracker<
377370
[string, [{ id: string; group: string; value: number }, string]]
378371
>()
@@ -401,11 +394,13 @@ describe(`Operators`, () => {
401394
const result = tracker.getResult(compareFractionalIndex)
402395

403396
// Check fractional indices are in correct order
404-
const indexedItems = result.sortedResults.map(([key, [value, index]]) => ({
405-
key,
406-
value: value.value,
407-
index,
408-
}))
397+
const indexedItems = result.sortedResults.map(
398+
([key, [value, index]]) => ({
399+
key,
400+
value: value.value,
401+
index,
402+
}),
403+
)
409404

410405
// Sort by value to verify fractional indices match sort order
411406
indexedItems.sort((a, b) => a.value - b.value)
@@ -418,9 +413,8 @@ describe(`Operators`, () => {
418413

419414
it(`should handle setSizeCallback correctly`, () => {
420415
const graph = new D2()
421-
const input = graph.newInput<
422-
[string, { id: string; group: string; value: number }]
423-
>()
416+
const input =
417+
graph.newInput<[string, { id: string; group: string; value: number }]>()
424418
let getSize: (() => number) | undefined
425419

426420
input.pipe(
@@ -456,13 +450,14 @@ describe(`Operators`, () => {
456450

457451
it(`should handle moving window with setWindowFn`, () => {
458452
const graph = new D2()
459-
const input = graph.newInput<
460-
[string, { id: string; group: string; value: number }]
461-
>()
453+
const input =
454+
graph.newInput<[string, { id: string; group: string; value: number }]>()
462455
const tracker = new MessageTracker<
463456
[string, [{ id: string; group: string; value: number }, string]]
464457
>()
465-
let windowFn: ((options: { offset?: number; limit?: number }) => void) | undefined
458+
let windowFn:
459+
| ((options: { offset?: number; limit?: number }) => void)
460+
| undefined
466461

467462
input.pipe(
468463
groupedTopKWithFractionalIndex((a, b) => a.value - b.value, {
@@ -511,9 +506,8 @@ describe(`Operators`, () => {
511506

512507
it(`should cleanup empty groups`, () => {
513508
const graph = new D2()
514-
const input = graph.newInput<
515-
[string, { id: string; group: string; value: number }]
516-
>()
509+
const input =
510+
graph.newInput<[string, { id: string; group: string; value: number }]>()
517511
const tracker = new MessageTracker<
518512
[string, [{ id: string; group: string; value: number }, string]]
519513
>()

0 commit comments

Comments
 (0)