Commit acbaa0b
fix(reader): zone-map pruning compares in the column's type domain (#159)
ScanIterator's comparator caught ClassCastException and returned 0, which
canPruneChunk reads as "cannot prune". Stats decode integers as Long and floats
as Float/Double, so a filter value boxed at a different width (Integer for I64,
Float for F32) threw internally and silently disabled pruning — a valid,
selective predicate degraded to a full scan with no signal.
The comparison now keys off the *column* type, not the boxed operand:
- floating column -> Double.compare;
- unsigned int column -> Long.compareUnsigned (U64 stats/values store raw bits,
so a value >= 2^63 is a negative Long; signed compare keeps/drops the wrong
chunks). U8/U16/U32 zero-extend to a positive Long, unaffected;
- signed int column -> Long.compare.
Keying off the column also avoids routing an integer column through
double-compare, which would lose precision past 2^53 and mis-prune.
Eq/Neq previously had their own inline comparator with the same swallow; they now
route through the shared one. A genuinely incomparable filter value (e.g. a
String against a numeric column) now raises VortexException instead of a silent
no-prune — a behaviour change, noted in the changelog.
Adds DType.isUnsigned() (exhaustive over the sealed set) to classify the column.
Coverage — ZoneMapPruningTest (27): BoxedWidth (Integer == Long, all six
operators), Unsigned (U64 >= 2^63 keep/prune correctness), FloatWidths (F32 stat
vs Double/Float filters), IntegerColumnFloatFilter (Double filter on I64 compares
in the integer domain past 2^53), TypeMismatch (String throws). Plus
DTypeIsUnsignedTest.
Closes #159.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 354bb8a commit acbaa0b
5 files changed
Lines changed: 364 additions & 26 deletions
File tree
- core/src
- main/java/io/github/dfa1/vortex/core/model
- test/java/io/github/dfa1/vortex/core/model
- reader/src/main/java/io/github/dfa1/vortex/reader
- writer/src/test/java/io/github/dfa1/vortex/writer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
8 | 18 | | |
9 | 19 | | |
10 | 20 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
Lines changed: 59 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
186 | 212 | | |
187 | 213 | | |
188 | | - | |
189 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
190 | 220 | | |
191 | 221 | | |
192 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
193 | 238 | | |
194 | 239 | | |
195 | 240 | | |
| |||
708 | 753 | | |
709 | 754 | | |
710 | 755 | | |
711 | | - | |
| 756 | + | |
712 | 757 | | |
713 | 758 | | |
714 | 759 | | |
715 | 760 | | |
716 | 761 | | |
717 | 762 | | |
718 | 763 | | |
719 | | - | |
| 764 | + | |
720 | 765 | | |
721 | 766 | | |
722 | 767 | | |
723 | 768 | | |
724 | 769 | | |
725 | 770 | | |
726 | 771 | | |
727 | | - | |
| 772 | + | |
728 | 773 | | |
729 | 774 | | |
730 | 775 | | |
731 | 776 | | |
732 | 777 | | |
733 | 778 | | |
734 | 779 | | |
735 | | - | |
| 780 | + | |
736 | 781 | | |
737 | 782 | | |
738 | 783 | | |
| |||
745 | 790 | | |
746 | 791 | | |
747 | 792 | | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
755 | 797 | | |
756 | 798 | | |
757 | 799 | | |
| |||
764 | 806 | | |
765 | 807 | | |
766 | 808 | | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
774 | 812 | | |
775 | 813 | | |
776 | 814 | | |
| |||
0 commit comments