Commit 183cdf0
authored
fix: Handle NULL inputs correctly in find_in_set() (#20209)
The previous coding returned an array of the wrong type, leading to an
assertion failure.
## Rationale for this change
```
create table tt (x string);
insert into tt values ('a'), ('b,a'), ('c'), (null);
select find_in_set(tt.x, null) from tt;
select find_in_set(null, tt.x) from tt;
```
Yields:
```
Internal error: Assertion failed: result_data_type == *expected_type: Function 'find_in_set' returned value of type 'Utf8View' while the following type was promised at planning time and expected: 'Int32'.
This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues
Internal error: Assertion failed: result_data_type == *expected_type: Function 'find_in_set' returned value of type 'Utf8View' while the following type was promised at planning time and expected: 'Int32'.
This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues
```
## Are these changes tested?
Yes, added an SLT test.1 parent bc747a0 commit 183cdf0
2 files changed
Lines changed: 19 additions & 18 deletions
File tree
- datafusion
- functions/src/unicode
- sqllogictest/test_files/string
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 101 | + | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
144 | | - | |
| 143 | + | |
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
| |||
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
Lines changed: 15 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
993 | 993 | | |
994 | 994 | | |
995 | 995 | | |
996 | | - | |
| 996 | + | |
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
1001 | | - | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
1002 | 1004 | | |
1003 | 1005 | | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
1015 | 1017 | | |
1016 | 1018 | | |
1017 | 1019 | | |
| |||
0 commit comments