Skip to content

Commit 35dd0e1

Browse files
committed
Add migration guide entry
1 parent 83147b9 commit 35dd0e1

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!---
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
20+
# Upgrade Guides
21+
22+
## DataFusion 55.0.0
23+
24+
**Note:** DataFusion `55.0.0` has not been released yet. The information provided
25+
in this section pertains to features and changes that have already been merged
26+
to the main branch and are awaiting release in this version.
27+
28+
### Decimal / floating-point coercion now picks the floating-point type
29+
30+
Previously, any context that needed a common type for a `Decimal` and a
31+
floating-point value (`Float16`, `Float32`, or `Float64`) chose the decimal
32+
type. This produced errors for legitimate floating-point inputs that have
33+
no decimal representation:
34+
35+
```sql
36+
-- Before: errored with "Cast error: Cannot cast to Decimal128(...). Overflowing on inf"
37+
SELECT '1'::decimal(10,0) = arrow_cast('inf', 'Float64');
38+
```
39+
40+
DataFusion now coerces the decimal side to the floating-point type instead.
41+
Decimal types cannot represent `NaN`, `±Infinity`, or values outside their
42+
precision/scale range, so the float is the only choice that is always
43+
representable. This also matches the behavior of PostgreSQL, DuckDB, and the
44+
existing rule for arithmetic operators in DataFusion.
45+
46+
**Migration guide:**
47+
48+
Most queries become more correct with no source change required — previously
49+
errored queries (against `NaN`, `±Inf`, or out-of-range values) now succeed,
50+
and previously-coerced expressions that went through `Decimal128(30, 15)`
51+
are now done in the natural float type.
52+
53+
The one behavior to be aware of: a decimal value with more than ~15–17
54+
significant digits will lose precision when cast to `Float64`. If your query
55+
needs to preserve full decimal precision, cast the float operand to the
56+
decimal type explicitly, or use a decimal literal instead of a float-typed
57+
value:
58+
59+
```sql
60+
-- If high-precision decimal comparison matters, force the float into the
61+
-- decimal domain explicitly:
62+
SELECT * FROM t WHERE big_decimal_col > CAST(my_float AS DECIMAL(38, 10));
63+
```
64+
65+
See [#14272](https://github.com/apache/datafusion/issues/14272) for the
66+
original report and discussion.

docs/source/library-user-guide/upgrading/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Upgrade Guides
2121
.. toctree::
2222
:maxdepth: 1
2323

24+
DataFusion 55.0.0 <55.0.0>
2425
DataFusion 54.0.0 <54.0.0>
2526
DataFusion 53.0.0 <53.0.0>
2627
DataFusion 52.0.0 <52.0.0>

0 commit comments

Comments
 (0)