-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Improve error message when string functions receive Binary types #19819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lemorage
wants to merge
4
commits into
apache:main
Choose a base branch
from
lemorage:hotfix/coerce
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26
−11
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
62d712e
fix: improve error message for type coercion failures
lemorage 8fc2842
test: add tests for verifying error msg when string functions receive…
lemorage a517432
Merge branch 'main' into hotfix/coerce
lemorage 4439926
test: update test expectations for new type coercion error format
lemorage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3064,7 +3064,7 @@ NULL | |
| query error DataFusion error: Error during planning: Function 'make_date' expects 3 arguments but received 1 | ||
| select make_date(1); | ||
|
|
||
| query error Expect TypeSignatureClass::Native\(LogicalType\(Native\(Int32\), Int32\)\) but received NativeType::Interval\(MonthDayNano\), DataType: Interval\(MonthDayNano\) | ||
| query error DataFusion error: Error during planning: Function 'make_date' requires TypeSignatureClass::Native\(LogicalType\(Native\(Int32\), Int32\)\), but received Interval\(MonthDayNano\) \(DataType: Interval\(MonthDayNano\)\) | ||
| select make_date(interval '1 day', '2001-05-21'::timestamp, '2001-05-21'::timestamp); | ||
|
|
||
| ########## | ||
|
|
@@ -3337,7 +3337,7 @@ select make_time(22, '', 27); | |
| query error Cannot cast string '' to value of Int32 type | ||
| select make_time(22, 1, ''); | ||
|
|
||
| query error Expect TypeSignatureClass::Native\(LogicalType\(Native\(Int32\), Int32\)\) but received NativeType::Float64, DataType: Float64 | ||
| query error DataFusion error: Error during planning: Function 'make_time' requires TypeSignatureClass::Native\(LogicalType\(Native\(Int32\), Int32\)\), but received Float64 \(DataType: Float64\) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these messages are much nicer -- thank you @lemorage |
||
| select make_time(arrow_cast(22, 'Float64'), 1, ''); | ||
|
|
||
| ########## | ||
|
|
@@ -3952,7 +3952,7 @@ statement error | |
| select to_local_time('2024-04-01T00:00:20Z'::timestamp, 'some string'); | ||
|
|
||
| # invalid argument data type | ||
| statement error DataFusion error: Error during planning: Internal error: Expect TypeSignatureClass::Timestamp but received NativeType::String, DataType: Utf8 | ||
| statement error DataFusion error: Error during planning: Function 'to_local_time' requires TypeSignatureClass::Timestamp, but received String \(DataType: Utf8\) | ||
| select to_local_time('2024-04-01T00:00:20Z'); | ||
|
|
||
| # invalid timezone | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,10 +55,10 @@ CREATE TABLE test( | |
| ; | ||
|
|
||
| # errors | ||
| query error DataFusion error: Error during planning: Internal error: Expect TypeSignatureClass::Binary but received NativeType::Int64, DataType: Int64 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 for a planning error rather than internal error |
||
| query error DataFusion error: Error during planning: Function 'encode' requires TypeSignatureClass::Binary, but received Int64 \(DataType: Int64\) | ||
| select encode(12, 'hex'); | ||
|
|
||
| query error DataFusion error: Error during planning: Internal error: Expect TypeSignatureClass::Binary but received NativeType::Int64, DataType: Int64 | ||
| query error DataFusion error: Error during planning: Function 'decode' requires TypeSignatureClass::Binary, but received Int64 \(DataType: Int64\) | ||
| select decode(12, 'hex'); | ||
|
|
||
| query error DataFusion error: Error during planning: There is no built\-in encoding named 'non_encoding', currently supported encodings are: base64, hex | ||
|
|
@@ -73,7 +73,7 @@ select decode('', null) from test; | |
| query error DataFusion error: This feature is not implemented: Encoding must be a scalar; array specified encoding is not yet supported | ||
| select decode('', hex_field) from test; | ||
|
|
||
| query error DataFusion error: Error during planning: Internal error: Expect TypeSignatureClass::Integer but received NativeType::String, DataType: Utf8View | ||
| query error DataFusion error: Error during planning: Function 'to_hex' requires TypeSignatureClass::Integer, but received String \(DataType: Utf8View\) | ||
| select to_hex(hex_field) from test; | ||
|
|
||
| query error DataFusion error: Execution error: Failed to decode value using base64 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.