Commit c48e993
authored
Return None for cardinality overflow (#22309)
## Which issue does this PR close?
Closes #22232
(cc @Dandandan )
## Rationale for this change
Prevent `Interval::cardinality()` from overflowing on the full `i64`
range.
## What changes are included in this PR?
- use `checked_add(1)` instead of `+ 1`
- add a regression test for the full `i64` range
## Are these changes tested?
- `cargo fmt --all --check`
- `cargo test -p datafusion-expr-common
test_cardinality_full_i64_range_does_not_overflow --lib`
- `cargo clippy --all-targets --all-features -- -D warnings` could not
run locally because `cmake` is not installed
## Are there any user-facing changes?
- No1 parent c3f3b7a commit c48e993
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
944 | 944 | | |
945 | 945 | | |
946 | 946 | | |
947 | | - | |
| 947 | + | |
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
| |||
4157 | 4157 | | |
4158 | 4158 | | |
4159 | 4159 | | |
| 4160 | + | |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
| 4167 | + | |
| 4168 | + | |
| 4169 | + | |
4160 | 4170 | | |
| 4171 | + | |
| 4172 | + | |
| 4173 | + | |
| 4174 | + | |
| 4175 | + | |
4161 | 4176 | | |
4162 | 4177 | | |
4163 | 4178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
960 | 960 | | |
961 | 961 | | |
962 | 962 | | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
963 | 969 | | |
964 | 970 | | |
965 | 971 | | |
| |||
0 commit comments