From 2d1efda176aaac819be4c2d0296914ee84f4c9b6 Mon Sep 17 00:00:00 2001 From: Andrey Avtomonov <7889985+andreybavt@users.noreply.github.com> Date: Mon, 11 May 2026 20:23:37 +0200 Subject: [PATCH] test: verify historic sql pattern shard work units --- .../adapters/historic-sql/historic-sql.adapter.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/context/src/ingest/adapters/historic-sql/historic-sql.adapter.test.ts b/packages/context/src/ingest/adapters/historic-sql/historic-sql.adapter.test.ts index ddc63ded..c2c679e5 100644 --- a/packages/context/src/ingest/adapters/historic-sql/historic-sql.adapter.test.ts +++ b/packages/context/src/ingest/adapters/historic-sql/historic-sql.adapter.test.ts @@ -47,7 +47,8 @@ describe('HistoricSqlSourceAdapter', () => { async *fetchAggregated() { yield { templateId: 'pg:1', - canonicalSql: 'select status, count(*) from public.orders group by status', + canonicalSql: + 'select o.status, count(*) from public.orders o join public.customers c on c.id = o.customer_id group by o.status', dialect: 'postgres', stats: { executions: 25, @@ -72,8 +73,8 @@ describe('HistoricSqlSourceAdapter', () => { [ 'pg:1', { - tablesTouched: ['public.orders'], - columnsByClause: { select: ['status'], groupBy: ['status'] }, + tablesTouched: ['public.orders', 'public.customers'], + columnsByClause: { select: ['status'], join: ['customer_id', 'id'], groupBy: ['status'] }, }, ], ]); @@ -94,8 +95,9 @@ describe('HistoricSqlSourceAdapter', () => { await expect(adapter.detect(stagedDir)).resolves.toBe(true); await expect(adapter.chunk(stagedDir)).resolves.toMatchObject({ workUnits: [ + { unitKey: 'historic-sql-table-public-customers' }, { unitKey: 'historic-sql-table-public-orders' }, - { unitKey: 'historic-sql-patterns' }, + { unitKey: 'historic-sql-patterns-part-0001' }, ], }); });