Skip to content

Commit 7e2f2cc

Browse files
committed
fix: all-fragments-pruned returns columns:[] + public API export gaps
- executeMultiFragment returned columns:[] when all fragments were pruned by partition/filter pushdown. Callers (pg-wire, show(), formatResultSummary) got empty column headers. Now returns actual schema from query.projections or first fragment's columns. - Remove dead autoCoalesceGap export (superseded by optional maxGap in coalesceRanges). - Export missing composability types from index.ts: buildPipeline, buildKeptPageIndices, canSkipPageMultiCol, FragmentSource, PipelineOptions, PipelineResult, SpillBackend.
1 parent c6a84b5 commit 7e2f2cc

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/coalesce.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ function computeGap(sorted: Range[]): number {
3333
return Math.max(16 * 1024, Math.min(256 * 1024, medianGap * 2));
3434
}
3535

36-
/** Compute optimal coalesce gap based on page density. Sorts a copy internally. */
37-
export function autoCoalesceGap(ranges: Range[]): number {
38-
if (ranges.length < 2) return 64 * 1024;
39-
const sorted = [...ranges].sort((a, b) => a.offset - b.offset);
40-
return computeGap(sorted);
41-
}
42-
4336
/** Merge nearby byte ranges into fewer R2 reads. Sorts by offset, merges if gap <= maxGap.
4437
* If maxGap is omitted, auto-computes from page density (sorts once instead of twice). */
4538
export function coalesceRanges(ranges: Range[], maxGap?: number): CoalescedRange[] {

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ export {
2323
ComputedColumnOperator, HashJoinOperator, ExternalSortOperator,
2424
InMemorySortOperator, WindowOperator, DistinctOperator, SetOperator,
2525
LimitOperator, SubqueryInOperator,
26-
drainPipeline, buildEdgePipeline, FsSpillBackend,
26+
drainPipeline, buildPipeline, buildEdgePipeline, FsSpillBackend,
27+
buildKeptPageIndices, canSkipPageMultiCol,
2728
} from "./operators.js";
28-
export type { Operator, RowBatch } from "./operators.js";
29+
export type { Operator, RowBatch, FragmentSource, PipelineOptions, PipelineResult } from "./operators.js";
2930
export { QueryModeError } from "./errors.js";
3031
export type { ErrorCode } from "./errors.js";
3132
export { LocalExecutor } from "./local-executor.js";
3233
export { bigIntReplacer } from "./decode.js";
3334
export { R2SpillBackend } from "./r2-spill.js";
35+
export type { SpillBackend } from "./r2-spill.js";
3436
export { createFromJSON, createFromCSV, createDemo } from "./convenience.js";
3537
export { formatResultSummary, formatExplain, formatBytes } from "./format.js";
3638
export type { LocalTimingInfo } from "./format.js";

src/query-do.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,9 +1687,12 @@ export class QueryDO extends DurableObject<Env> {
16871687
}
16881688

16891689
if (fragments.length === 0) {
1690-
// All fragments pruned — return empty result
1690+
// All fragments pruned — return empty result with correct schema
1691+
const cols = query.projections.length > 0
1692+
? query.projections
1693+
: (allFragments.length > 0 ? allFragments[0].columns.map(c => c.name) : []);
16911694
return {
1692-
rows: [], rowCount: 0, columns: [],
1695+
rows: [], rowCount: 0, columns: cols,
16931696
bytesRead: 0, pagesSkipped: 0, durationMs: Date.now() - t0,
16941697
r2ReadMs: 0, wasmExecMs: 0, cacheHits: 0, cacheMisses: 0,
16951698
edgeCacheHits: 0, edgeCacheMisses: 0,

0 commit comments

Comments
 (0)