-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
array[]
/ make_array()
will error if the types can not be coerced to a common type
#3170
Comments
I actually think in general the coercion rules for |
@alamb I checked 3 options
here I can see nonconsistent behaviuor. I suppose all 3 should try coerce to first datatype and fail if its not possible? |
I think that would make sense -- thank you for looking into this @comphead |
@alamb it appears we have 2 code bases for supporting arrays:
All those constructions do the same work, but they can be out of sync like now. do we need to support all 2 branches? |
I am sorry for the delay in response. The short answer is I don't really know what the desired / correct behavior is here -- I think |
Yes, we can support all 3 of them. My concern there are 2 different codebases, and no easy way to find a common denominator for them. I can make all 3 functions works the same way, but in future those codebases can be out of sync again, leading |
🤔 |
@alamb one more thing I found |
Ideally we would follow some well established model (like posgres) but if that is too challenging I think we can keep the existing behavior too |
Describe the bug
make_array()
will error if the types can not be coerced to a common type, as in postgres and sparkTo Reproduce
Run this query (see
query_array_scalar_coerce
test added in #3122)This results in an error:
Expected behavior
I expect this to return like postgres where it has coerced all the arguments to int (tried to coerce all arguments to the same type as the first, which in this case is
1
and thusint
alamb=# select array[1, 2, '3']; array --------- {1,2,3} (1 row)
Additional context
Found in #3122
The text was updated successfully, but these errors were encountered: