Commit 796c7d1
feat: support f16 in coercion logic (#18944)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes #18943
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
Originally:
> As pointed out by @martin-g, even though we plan to remove `NUMERICS`
(see #18092) we should probably add f16 first so we don't conflate
adding new functionality with refactoring changes.
Updated:
> #19727 removes `NUMERICS` for us, which surfaced a bug where f16
wasn't being coerced to f64. Turns out we didn't have f16 support in the
logic calculating the potential coercions. Fixing this so f16 input to a
signature expected f64 is now allowed and coerced.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
Support coercion of f16 to f64 as specified by signature.
Add tests for regr, percentile & covar functions.
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
Added tests.
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
No.
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>1 parent 613f87d commit 796c7d1
5 files changed
Lines changed: 42 additions & 3 deletions
File tree
- datafusion
- expr-common/src
- type_coercion
- expr/src/type_coercion
- optimizer/src/analyzer
- sqllogictest/test_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1585 | 1585 | | |
1586 | 1586 | | |
1587 | 1587 | | |
| 1588 | + | |
1588 | 1589 | | |
1589 | 1590 | | |
1590 | 1591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
855 | 858 | | |
856 | 859 | | |
857 | 860 | | |
858 | | - | |
| 861 | + | |
859 | 862 | | |
860 | 863 | | |
861 | 864 | | |
| |||
868 | 871 | | |
869 | 872 | | |
870 | 873 | | |
| 874 | + | |
871 | 875 | | |
872 | 876 | | |
873 | 877 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1892 | 1892 | | |
1893 | 1893 | | |
1894 | 1894 | | |
1895 | | - | |
| 1895 | + | |
1896 | 1896 | | |
1897 | 1897 | | |
1898 | 1898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
574 | 584 | | |
575 | 585 | | |
576 | 586 | | |
| |||
1313 | 1323 | | |
1314 | 1324 | | |
1315 | 1325 | | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1316 | 1344 | | |
1317 | 1345 | | |
1318 | 1346 | | |
| |||
6719 | 6747 | | |
6720 | 6748 | | |
6721 | 6749 | | |
6722 | | - | |
| 6750 | + | |
| 6751 | + | |
| 6752 | + | |
| 6753 | + | |
| 6754 | + | |
| 6755 | + | |
6723 | 6756 | | |
6724 | 6757 | | |
6725 | 6758 | | |
| |||
0 commit comments