You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "findepi (via GitHub)" <gi...@apache.org> on 2024/09/02 13:07:37 UTC
[I] UNION schema depends on branch order in case of array values [datafusion]
findepi opened a new issue, #12292:
URL: https://github.com/apache/datafusion/issues/12292
### Describe the bug
```
> SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(2) x UNION ALL SELECT make_array(now()) x);
+---------------------------+
| arrow_typeof(x[Int64(0)]) |
+---------------------------+
| Int64 |
+---------------------------+
```
but same query with union branches swapped gives different return type
```
> SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(now()) x UNION ALL SELECT make_array(2) x);
+---------------------------------------+
| arrow_typeof(x[Int64(0)]) |
+---------------------------------------+
| Timestamp(Nanosecond, Some("+00:00")) |
+---------------------------------------+
```
### To Reproduce
```
SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(2) x UNION ALL SELECT make_array(now()) x);
SELECT DISTINCT arrow_typeof(x[0]) FROM (SELECT make_array(now()) x UNION ALL SELECT make_array(2) x);
```
### Expected behavior
The schema (output type) of `UNION ALL` should not depend on syntactic order of union's branches.
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] UNION schema depends on branch order in case of array values [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on issue #12292:
URL: https://github.com/apache/datafusion/issues/12292#issuecomment-2324827013
We should return error since integer is not able to cast to timestamp and vice versa
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] UNION schema depends on branch order in case of array values [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on issue #12292:
URL: https://github.com/apache/datafusion/issues/12292#issuecomment-2326281114
> @jayzhan211 agree with you. I created #12291 for this separately. Once this is solved, do you think there won't be any latent case where UNION schema depends on branch syntactical order?
I guess we would need `type_union_resolution` for `Union` somewhere 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] UNION schema depends on branch order in case of array values [datafusion]
Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on issue #12292:
URL: https://github.com/apache/datafusion/issues/12292#issuecomment-2326257766
@jayzhan211 agree with you. I created https://github.com/apache/datafusion/issues/12291 for this separately.
Once this is solved, do you think there won't be any latent case where UNION schema depends on branch syntactical order?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] UNION schema depends on branch order in case of array values [datafusion]
Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on issue #12292:
URL: https://github.com/apache/datafusion/issues/12292#issuecomment-2324723406
So far i did not reproduce the problem for queries without arrays, so it **might** be array specific and thus related to https://github.com/apache/datafusion/issues/12291.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org