Skip to content

Commit 4427d4d

Browse files
committed
test(sea): F4 round-3 — inline-result-set (SELECT 1) edge case
DA F4 round-1 M1 finding (partial): the existing 5 fetch-all e2e cases (range(0,100) row-count, range(0,0) empty, multi-column, drain-twice, drain-after-close) all flow through the row-set generator path. A literal `SELECT 1` returns a single inline batch and exercises a distinct code path inside SeaOperationBackend.fetchChunk → ResultSlicer → ArrowResultConverter that the other 5 do not. One new `it()` block: - Open session, execute `SELECT 1 AS x`, drain via `fetchAll()`. - Assert array of length 1; row has property `x` with non-null, non-undefined value. Type pinning is deliberately loose so the test stays forward-compatible with converter promotion changes; the load-bearing assertion is the single-row inline-batch drain. Drop-in form follows DA's round-3 snippet verbatim (modulo the loosened type pin per the comment above). Gates (touched file only): - `node_modules/.bin/eslint tests/e2e/sea/fetch-all-e2e.test.ts` EXIT=0, zero errors. - `node_modules/.bin/tsc --noEmit` baseline 21 → current 21 (delta 0; the only error in the touched file is a pre-existing `import.meta` issue at line 57 carried over from the F4 round-1 H1 fix — not touched by this commit). Live e2e against pecotesting via `TS_NODE_TRANSPILE_ONLY=true yarn e2e tests/e2e/sea/fetch-all-e2e.test.ts`: 6/6 passing in 4s, with the new test landing at 445ms. Closes the round-3 F4-M1 audit item; F3-M3 closed in 9f1a967; matrix scope-down landed by team-lead on PR #77 (dfea75a). Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent 9f1a967 commit 4427d4d

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

tests/e2e/sea/fetch-all-e2e.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,41 @@ describe('SEA fetchAll — Array<object> row drain', function suite() {
258258
await client.close();
259259
}
260260
});
261+
262+
it('drains a single inline result-set row (SELECT 1)', async () => {
263+
// `SELECT 1` returns a single row inline, exercising the
264+
// small-batch code path the other tests don't hit. `range(0, n)`
265+
// queries go through the row-set generator; `range(0, 0)` is
266+
// the empty branch. A literal scalar pin-points the inline-batch
267+
// path inside SeaOperationBackend.fetchChunk → ResultSlicer →
268+
// ArrowResultConverter, which is otherwise untested here.
269+
const client = await connect();
270+
try {
271+
const session = await client.openSession();
272+
try {
273+
const operation = await session.executeStatement('SELECT 1 AS x');
274+
try {
275+
const rows = await operation.fetchAll();
276+
expect(rows).to.be.an('array');
277+
expect(rows.length).to.equal(1);
278+
const row = rows[0] as Record<string, unknown>;
279+
expect(row).to.have.property('x');
280+
// SEA-side converter promotes a literal int to a number
281+
// primitive; Thrift on the same query produces the same
282+
// shape. We don't pin the exact JS type beyond "not null/
283+
// undefined" to keep the test forward-compatible with
284+
// converter changes — the load-bearing assertion is the
285+
// single-row inline-batch drain.
286+
expect(row.x).to.not.equal(null);
287+
expect(row.x).to.not.equal(undefined);
288+
} finally {
289+
await operation.close();
290+
}
291+
} finally {
292+
await session.close();
293+
}
294+
} finally {
295+
await client.close();
296+
}
297+
});
261298
});

0 commit comments

Comments
 (0)