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

bug: Interval type, no comparison available #17056

Open
1 of 2 tasks
rad-pat opened this issue Dec 16, 2024 · 3 comments
Open
1 of 2 tasks

bug: Interval type, no comparison available #17056

rad-pat opened this issue Dec 16, 2024 · 3 comments
Assignees
Labels
C-bug Category: something isn't working

Comments

@rad-pat
Copy link

rad-pat commented Dec 16, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.2.673

What's Wrong?

I realise this is very new, but I'm trying to add new Interval type to Databend SQLAlchemy dialect and receive error message during test run.

FAILED [100%]
../../py312/lib/python3.12/site-packages/sqlalchemy/testing/suite/test_types.py:478 (IntervalTest_databend+databend_1_2_673.test_literal)
Traceback (most recent call last):
  File "/home/plaid/src/databend-sqlalchemy/databend_sqlalchemy/connector.py", line 190, in execute
    rows = self._db.query_iter(query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: APIError: QueryFailed: [1065]error: 
  --> SQL:3:11
  |
1 | SELECT t.x 
2 | FROM t 
3 | WHERE t.x = to_interval('86404.0 seconds')
  |           ^ no function matches signature `eq(Interval NULL, Interval)`, you might need to add explicit type casts.

candidate functions:
  eq(Variant, Variant) :: Boolean                               : unable to unify `Interval NULL` with `Variant`
  eq(Variant NULL, Variant NULL) :: Boolean NULL                : unable to unify `Interval` with `Variant`
  eq(String, String) :: Boolean                                 : unable to unify `Interval NULL` with `String`
... and 31 more

How to Reproduce?

CREATE TABLE t (
	x INTERVAL
);
INSERT INTO t (x) VALUES (to_interval('86404.0 seconds'));
INSERT INTO t (x) VALUES (NULL);
SELECT t.x 
FROM t 
WHERE t.x = to_interval('86404.0 seconds');

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@TCeason
Copy link
Collaborator

TCeason commented Dec 17, 2024

Yes we should support some interval function.

You can append in this issue

#17060

@TCeason
Copy link
Collaborator

TCeason commented Dec 17, 2024

The interval should not support a comparison.

e.g. 1 month and 28 days.

@TCeason
Copy link
Collaborator

TCeason commented Dec 17, 2024

The interval should not support a comparison.

e.g. 1 month and 28 days.

In interval comparison,

1 month will eq 30 days.
1 year will eq 12 months eq 360 days.

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

No branches or pull requests

2 participants