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

Arrays of non-coercible types are coercible #12291

Open
findepi opened this issue Sep 2, 2024 · 2 comments · May be fixed by #13452
Open

Arrays of non-coercible types are coercible #12291

findepi opened this issue Sep 2, 2024 · 2 comments · May be fixed by #13452
Assignees
Labels
bug Something isn't working

Comments

@findepi
Copy link
Member

findepi commented Sep 2, 2024

Describe the bug

Int64 and timestamp with time zone are not coercible:

> SELECT 2 x UNION ALL SELECT now() x;
type_coercion
caused by
Error during planning: Incompatible inputs for Union: Previous inputs were of type Int64, but got incompatible type Timestamp(Nanosecond, Some("+00:00")) on column 'x'

yet, the arrays of these types are

> SELECT make_array(2) x UNION ALL SELECT make_array(now()) x;
+-----------------------+
| x                     |
+-----------------------+
| [2]                   |
| [1725282161929740000] |
+-----------------------+
> SELECT make_array(now()) x UNION ALL SELECT make_array(2) x;
+----------------------------------+
| x                                |
+----------------------------------+
| [1970-01-01T00:00:00.000000002Z] |
| [2024-09-02T13:03:02.257080Z]    |
+----------------------------------+

To Reproduce

SELECT make_array(2) x UNION ALL SELECT make_array(now()) x;

Expected behavior

Failure, because array element types cannot be coerced.

Additional context

No response

@findepi findepi added the bug Something isn't working label Sep 2, 2024
@findepi findepi changed the title Arrays of of non-coercible types are coercible Arrays of non-coercible types are coercible Sep 2, 2024
@findepi
Copy link
Member Author

findepi commented Sep 3, 2024

Quoting @jayzhan211 #12292 (comment)

We should return error since integer is not able to cast to timestamp and vice versa

D SELECT DISTINCT x[0] FROM (SELECT [now()] x UNION ALL SELECT [2] x);
Conversion Error: Unimplemented type for cast (INTEGER -> TIMESTAMP WITH TIME ZONE)
LINE 1: ...OM (SELECT [now()] x UNION ALL SELECT [2] x);

@blaginin
Copy link
Contributor

take

@blaginin blaginin linked a pull request Nov 16, 2024 that will close this issue
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.

2 participants