Repository navigation
Commit d33d7f1
fix: Avoid panicing when stats are not available for a file group split (apache#23277)
## Which issue does this PR close?
- Closes apache#23219.
## Rationale for this change
The query from the issue:
```sql
SELECT (((Cast(id AS BIGINT) % 1024) + 1024) % 1024) AS computed_bucket
FROM profile
ORDER BY computed_bucket,
Cast(id AS BIGINT) limit 10;
```
panics:
```
thread 'main' panicked at .../datafusion-datasource-54.0.0/src/statistics.rs:100:48:
index out of bounds: the len is 0 but the index is 0
```
The underlying issue is that the current code panics when files are
split by statistics and there are no statistics available for the column
where the sort order is defined in this case `computed_bucket`.
## What changes are included in this PR?
- Fix in `MinMaxStatistics` to check if there are stats available for a
given column
- Test
## Are these changes tested?
Yes
## Are there any user-facing changes?
No1 parent e146411 commit d33d7f1
1 file changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
| |||
890 | 898 | | |
891 | 899 | | |
892 | 900 | | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
893 | 928 | | |
0 commit comments