You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "RyanLin5967 (via GitHub)" <gi...@apache.org> on 2026/09/11 21:19:26 UTC
[I] power and log simplifications check the base's nullability but not its value [datafusion]
RyanLin5967 opened a new issue, #25209:
URL: https://github.com/apache/datafusion/issues/25209
### Describe the bug
Currently, `power`/`log` rewrites check the base's nullability but not its value, so degenerate bases fold wrong.
### To Reproduce
```sql
CREATE VIEW nn AS SELECT * FROM (VALUES (1.0), (0.0), (-2.0), (2.0)) s(a);
CREATE VIEW nb AS SELECT a FROM (VALUES (1.0),(0.0),(-2.0),(2.0),(NULL)) s(a) WHERE a IS NOT NULL;
CREATE VIEW t AS SELECT * FROM (VALUES (2.0), (3.0)) s(b);
SELECT a, log(a, 1.0), log(a, a) FROM nn;
-- 0.0 and 1.0 on all four rows, a = 1.0, 0.0 and -2.0 included
SELECT a, log(a, 1.0), log(a, a) FROM nb;
-- NaN NaN / -0.0 NaN / NaN NaN / 0.0 1.0, so only the schema's nullability differs
SELECT b, power(1.0, log(1.0, b)), log(1.0, power(1.0, b)) FROM t;
-- both b; should be 1.0 and NaN
SELECT count(*) FROM t WHERE power(1.0, log(1.0, b)) = 2.0;
-- 1, should be 0
SELECT power(1.0, log(1.0, 2.0)), log(1.0, 2.0);
-- 1.0 and inf, so the all-literal form is evaluated rather than rewritten
```
### Expected behavior
What the nullable-base rows already print: `NaN` where the identity does not hold, and `1.0` for `power(1.0, log(1.0, b))`.
### Additional context
The four are `power(a, log(a,b))`, `log(a,1)`, `log(a,a)` and `log(a, power(a,b))`, each gated only on `!base_nullable`.
All four hold only for `a > 0, a != 1`.
Reproduced on `datafusion-cli 55.0.0`; `power.rs` is byte-identical on main.
--
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] power and log simplifications check the base's nullability but not its value [datafusion]
Posted by "RyanLin5967 (via GitHub)" <gi...@apache.org>.
RyanLin5967 closed issue #25209: power and log simplifications check the base's nullability but not its value
URL: https://github.com/apache/datafusion/issues/25209
--
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] power and log simplifications check the base's nullability but not its value [datafusion]
Posted by "RyanLin5967 (via GitHub)" <gi...@apache.org>.
RyanLin5967 commented on issue #25209:
URL: https://github.com/apache/datafusion/issues/25209#issuecomment-5640902878
Duplicate of #25137, which reports the same defect. Closing this one.
--
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