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

Interval - Timestamp should error, but succeeds #7084

Closed
alamb opened this issue Jul 25, 2023 · 2 comments · Fixed by #7086
Closed

Interval - Timestamp should error, but succeeds #7084

alamb opened this issue Jul 25, 2023 · 2 comments · Fixed by #7086
Assignees
Labels
bug Something isn't working

Comments

@alamb
Copy link
Contributor

alamb commented Jul 25, 2023

Describe the bug

Trying to compute Interval - Timestamp should raise an error, as it does not make any semantic sense

To Reproduce

This is from timestamp.slt

create table foo (val int, ts1 timestamp, ts2 timestamp, i interval) as values
(1, '2023-03-15T15:00:20.000000123'::timestamp, '2023-01-20T23:00:00.000000099'::timestamp, '1 day'::interval),
(2, '2023-02-28T12:01:55.000123456'::timestamp, '2000-02-23T11:00:00.123000001'::timestamp, '2 months'::interval),
(3, '2033-11-02T23:22:13.000123456'::timestamp, '1990-03-01T00:00:00.333000001'::timestamp, '1 day 3 hours'::interval),
(4, '2003-07-11T01:31:15.000123456'::timestamp, '2045-04-11T15:00:00.000000001'::timestamp, '1 day 7 nanoseconds'::interval);

SELECT i - ts1 from FOO;
----
2023-03-14T15:00:20.000000123
2022-12-28T12:01:55.000123456
2033-11-01T20:22:13.000123456
2003-07-10T01:31:15.000123449

Expected behavior

SELECT i - ts1 from FOO;

Should raise an error about unsupported operation

Additional context

No response

@jackwener
Copy link
Member

I prepare to fix it

@berkaysynnada
Copy link
Contributor

I think this PR changed the behavior. Besides interval - timestamp, interval - date should give an error. There are 2 wrong resulting tests here: https://github.com/apache/arrow-datafusion/blob/710ccf81084adcd46f551615a6bb6a76e71ce55a/datafusion/core/tests/sqllogictests/test_files/type_coercion.slt#L45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants