Skip to content

Commit f03f2b0

Browse files
committed
feat: formatExplain shows fragmentsSkipped, estimatedRows, partitionCatalog, fanOut
Enriches the human-readable explain output with fragment pruning stats, estimated rows after pruning, partition catalog info, and fan-out status. Also adds fragment-level pruning to local-executor's WASM scan path.
1 parent 335bc10 commit f03f2b0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/format.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ export function formatExplain(plan: ExplainResult): string {
8383
lines.push(`Table: ${plan.table} (${plan.format})`);
8484

8585
const totalRowsFormatted = plan.totalRows.toLocaleString();
86-
lines.push(`Total rows: ${totalRowsFormatted} | Fragments: ${plan.fragments}`);
86+
const fragInfo = plan.fragmentsSkipped
87+
? `Fragments: ${plan.fragments} (${plan.fragmentsSkipped} skipped)`
88+
: `Fragments: ${plan.fragments}`;
89+
lines.push(`Total rows: ${totalRowsFormatted} | ${fragInfo}`);
8790

8891
lines.push(`Columns: ${plan.columns.length} scanned`);
8992
for (const col of plan.columns) {
@@ -109,6 +112,18 @@ export function formatExplain(plan: ExplainResult): string {
109112

110113
lines.push(`Estimated: ${formatBytes(plan.estimatedBytes)} across ${plan.estimatedR2Reads} read${plan.estimatedR2Reads !== 1 ? "s" : ""}`);
111114

115+
if (plan.estimatedRows !== plan.totalRows) {
116+
lines.push(`Estimated rows after pruning: ${plan.estimatedRows.toLocaleString()}`);
117+
}
118+
119+
if (plan.partitionCatalog) {
120+
lines.push(`Partition catalog: ${plan.partitionCatalog.column} (${plan.partitionCatalog.partitionValues} values)`);
121+
}
122+
123+
if (plan.fanOut) {
124+
lines.push(`Fan-out: yes${plan.hierarchicalReduction ? ` (${plan.reducerTiers} reducer tiers)` : ""}`);
125+
}
126+
112127
if (plan.metaCached) {
113128
lines.push("Meta: cached");
114129
}

0 commit comments

Comments
 (0)