-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect column cast when coalescing array type #9098
Comments
There doesn't seem to be any tests that cover this case that I can find. |
Possibly related - I found this in the arrow_typeof.slt
Enabling that results in an error converting utf8 which I suspect may be related to what is happening here
|
@Weijun-H just merged #8902 and I think I would not at all be surprised if the type coercion logic doesn't work for coaelsce I just double checked and even on latest |
The reason that we got UTF8 is that the signature of coalesce is We should change the signature of Coalesce into VariadicEqual |
While I tried out, I failed in one of the query in
which the error is that
This error occurs because when we have type i64 and u64 in We can get the same error with One solution is that we introduce i128 like duckdb, then we can convert both u64 and i64 to i128. We can also change the edge cases like query in joins.slt to other smaller type for this issue, then fight with larger types later on |
Describe the bug
When coalescing between two arrays, datafusion will infer the type to be Utf8.
To Reproduce
Expected behavior
Postgres handles this correctly for example:
Additional context
I didn't test this extensively but I think the same is true for struct types (and by extension maybe all "complex" type?)
If someone comes accross this, I am currently working around this by replacing the coalesce with a case statement:
This preserves the type of the column.
The text was updated successfully, but these errors were encountered: