Skip to content

Commit 5d7a0ea

Browse files
committed
fix: lance-v2 computePageStats now handles uint8/uint16/uint32/uint64
The numericTypes set included unsigned types but the switch statement only handled signed variants — uint columns silently got no min/max stats, disabling page-level pruning for those columns.
1 parent c10f577 commit 5d7a0ea

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/lance-v2.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,46 @@ function computePageStats(
526526
}
527527
return min <= max ? { min, max } : null;
528528
}
529+
case "uint64": {
530+
let min = BigInt("18446744073709551615"), max = 0n;
531+
for (let i = 0; i < numValues; i++) {
532+
if (isNull(i)) continue;
533+
const v = view.getBigUint64(i * 8, true);
534+
if (v < min) min = v;
535+
if (v > max) max = v;
536+
}
537+
return min <= max ? { min, max } : null;
538+
}
539+
case "uint32": {
540+
let min = 4294967295, max = 0;
541+
for (let i = 0; i < numValues; i++) {
542+
if (isNull(i)) continue;
543+
const v = view.getUint32(i * 4, true);
544+
if (v < min) min = v;
545+
if (v > max) max = v;
546+
}
547+
return min <= max ? { min, max } : null;
548+
}
549+
case "uint16": {
550+
let min = 65535, max = 0;
551+
for (let i = 0; i < numValues; i++) {
552+
if (isNull(i)) continue;
553+
const v = view.getUint16(i * 2, true);
554+
if (v < min) min = v;
555+
if (v > max) max = v;
556+
}
557+
return min <= max ? { min, max } : null;
558+
}
559+
case "uint8": {
560+
let min = 255, max = 0;
561+
for (let i = 0; i < numValues; i++) {
562+
if (isNull(i)) continue;
563+
const v = view.getUint8(i);
564+
if (v < min) min = v;
565+
if (v > max) max = v;
566+
}
567+
return min <= max ? { min, max } : null;
568+
}
529569
default:
530570
return null;
531571
}

0 commit comments

Comments
 (0)