You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a8a3ad4
Browse filesBrowse the repository at this point in the historyBrowse files
fix: preserve nested log and power results (apache#25138)
## Which issue does this PR close?
Closesapache#25137.
## Rationale for this change
For column exponents of 2000 and -2000, a log-of-power query returned
the exponents instead of positive and negative infinity. The query now
preserves the evaluated results.
## What changes are included in this PR?
Remove the logarithm identities and inverse power/log cancellation.
Literal calls still fold through constant evaluation. Null propagation,
negative-scale decimal handling and zero/one-exponent power rules remain
unchanged.
## What is the testing strategy for this PR?
The SQL regression compares nested log/power with explicit evaluation.
These CLI checks ran on macOS arm64 with Rust 1.98.1:
```sh
cargo run --locked --profile ci -j6 --target-dir target -p datafusion-cli -- --quiet --rc -c "SELECT log(2.0, power(2.0, a)), ln(power(2.0, a)) / ln(2.0) FROM (VALUES (2000.0::double), (-2000.0::double)) t(a);"
DATAFUSION_EXPLAIN_FORMAT=indent cargo run --locked --profile ci -j6 --target-dir target -p datafusion-cli -- --quiet --rc -c "EXPLAIN SELECT log(2.0, 1.0) AS zero, log(2.0, 2.0) AS one;"
```
<details><summary>Raw logs</summary>
Before, on
apache@0661d60:
```text
| 2000.0 | inf |
| -2000.0 | -inf |
```
After, the same query through the CLI:
```text
| inf | inf |
| -inf | -inf |
cli_exit_code=0
```
Literal calls still fold:
```text
| logical_plan | Projection: Float64(0) AS zero, Float64(1) AS one |
| physical_plan | ProjectionExec: expr=[0 as zero, 1 as one] |
```
</details>
## Are there any user-facing changes?
These are result corrections. There is no public API change.
---------
Signed-off-by: 1fanwang <[email protected]>
Copy file name to clipboardExpand all lines: datafusion/sqllogictest/test_files/math.slt
+32-4Lines changed: 32 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1213,7 +1213,9 @@ physical_plan
1213
1213
01)ProjectionExec: expr=[log(column1@0, 1) as l1, log(column1@0, column1@0) as la, power(column1@0, 0) as p0, power(column1@0, log(column1@0, column2@1)) as pl]
0 commit comments