Commit 6c1d328
authored
fix: fix NotEq case in anticipation of non-literals (#1260)
The code as written fails when the "other" [min, max] interval has size
greater than 1.
Call the left-hand-side's interval: `[lmin, lmax]` and the
right-hand-side's interval: `[rmin, rmax]`. The current expression is:
(lmin == rmin) && (rmin == lmax)
||
(lmin == rmax) && (rmax == lmax)
By transitivity, in either conjunction, lmin == lmax. That means the
column has a single known value: lmin (equivalently: lmax).
If the right-hand-side is only ever literals or expressions thereof, its
interval is always `[x, x]`. In that case, this expression is tantamount
to: is the column constant and equal to `x`?
If the right-hand-side is either another column or some
non-deterministic expression, the interval could be, for example: `[10,
11]`. If the column is known to be the constant value `10` (i.e. its min
and max are 10), we cannot prune this chunk! The rows where the
right-hand-side is 11 would satisfy the inequality.
I'm also open to: `(lmin == lmax) && (lmin == rmin)` with a comment
indicating that, because we only have literals, rmin is necessarily
equal to rmax and thus rmin _is_ the, known, right-hand-side value.1 parent 04af8e4 commit 6c1d328
1 file changed
+25
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
204 | 217 | | |
205 | 218 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 219 | + | |
217 | 220 | | |
218 | | - | |
| 221 | + | |
219 | 222 | | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
| |||
394 | 399 | | |
395 | 400 | | |
396 | 401 | | |
397 | | - | |
| 402 | + | |
398 | 403 | | |
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
402 | 407 | | |
403 | | - | |
| 408 | + | |
404 | 409 | | |
405 | 410 | | |
406 | | - | |
| 411 | + | |
407 | 412 | | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
419 | 416 | | |
420 | 417 | | |
| 418 | + | |
421 | 419 | | |
422 | 420 | | |
423 | 421 | | |
| |||
0 commit comments