Commit cf76352
authored
Improve error message when string functions receive Binary types (#19819)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Related to #19004 and #19809.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
Change internal error to user-facing error when function type coercion
fails. Add helpful hint when Binary types are used with string
functions.
Before:
```
Internal error: Expect TypeSignatureClass::Native(...) but received NativeType::Binary, DataType: Binary
```
After:
```
Error: Function 'split_part' requires String, but received Binary (DataType: Binary).
Hint: Binary types are not automatically coerced to String. Use CAST(column AS VARCHAR) to convert Binary data to String.
```1 parent 7a09e27 commit cf76352
File tree
7 files changed
+26
-11
lines changed- datafusion
- expr/src/type_coercion
- sqllogictest/test_files
- datetime
7 files changed
+26
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
640 | 645 | | |
641 | 646 | | |
642 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3064 | 3064 | | |
3065 | 3065 | | |
3066 | 3066 | | |
3067 | | - | |
| 3067 | + | |
3068 | 3068 | | |
3069 | 3069 | | |
3070 | 3070 | | |
| |||
3337 | 3337 | | |
3338 | 3338 | | |
3339 | 3339 | | |
3340 | | - | |
| 3340 | + | |
3341 | 3341 | | |
3342 | 3342 | | |
3343 | 3343 | | |
| |||
3952 | 3952 | | |
3953 | 3953 | | |
3954 | 3954 | | |
3955 | | - | |
| 3955 | + | |
3956 | 3956 | | |
3957 | 3957 | | |
3958 | 3958 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2069 | 2069 | | |
2070 | 2070 | | |
2071 | 2071 | | |
2072 | | - | |
| 2072 | + | |
2073 | 2073 | | |
2074 | 2074 | | |
2075 | 2075 | | |
| |||
0 commit comments