Skip to content
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

Minor: improve error message for interval subtraction #6230

Closed
wants to merge 2 commits into from

Conversation

alamb
Copy link
Contributor

@alamb alamb commented May 4, 2023

Draft as it builds on #6201

Which issue does this PR close?

Follow on from #6201

Rationale for this change

@crepererum noticed that the error messages could be improved when trying to subtract things from intervals -- see https://github.com/apache/arrow-datafusion/pull/6201/files#r1183584830

What changes are included in this PR?

Improve error message

Are these changes tested?

yes

Are there any user-facing changes?

@alamb alamb marked this pull request as draft May 4, 2023 14:55
@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt) labels May 4, 2023
@@ -1031,7 +1031,7 @@ SELECT '2000-01-01T00:00:00'::timestamp - '2010-01-01T00:00:00'::timestamp;
0 years 0 mons -3653 days 0 hours 0 mins 0.000000000 secs

# Interval - Timestamp => error
statement error DataFusion error: Error during planning: interval can't subtract timestamp/date
statement error DataFusion error: Error during planning: Invalid interval subtraction: Interval\(MonthDayNano\) \- Timestamp\(Nanosecond, None\)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to hear opinions on this new message. I think it is better but still not great as it has references to the detailed Arrow types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is better than status quo.

@alamb alamb changed the title Alamb/better error message Minor: improve error message for interval subtraction May 5, 2023
@alamb alamb force-pushed the alamb/better_error_message branch from 1b3a4cf to f32bc1e Compare May 5, 2023 11:14
@alamb alamb marked this pull request as ready for review May 5, 2023 11:15
@alamb
Copy link
Contributor Author

alamb commented May 8, 2023

Given this logic was refactored substantially, I think I am going to punt on any possible improvements now so closing this PR

@alamb alamb closed this May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants