-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SimplifyExpressions errors when simplifying power
fn
#5996
Comments
I am not sure why this is happening -- I think some debugging is in order. Maybe one way to start is to figure out what the two schema are: |
I am looking into this |
For the simple example in the unit test, the plan is:
And the two schemas in the error message are:
The first one is from the Project and the other is from the Scan. After spending some time looking at this today I think I might have a potential fix, will draft a PR tomorrow. |
I believe the upstream fix is now available in IOx after https://github.com/influxdata/influxdb_iox/pull/7630 |
Describe the bug
When calling the
power
function with a constant in the second argument, I get an error:To Reproduce
with
datafusion-cli
:I was also able to reproduce this with a unit test in
datafusion/optimizer/src/simplify_expressions/simlify_exprs.rs
:Expected behavior
Calling
power
with a constant is a reasonable thing to want to do, so I would expect this to work.Additional context
Unless the optimizer is configured with
skip_failed_rules
set tofalse
, this could manifest in other, or the query might succeed just fine.Related issue: #4685
I found this specifically when invoking
power
but this same issue probably occurs when simplifying other expressions.In IOx we want to run with
skip_failed_rules
set tofalse
specifically so we can return reasonable error messages to the user: https://github.com/influxdata/influxdb_iox/issues/7330This test failure seems to happen in
simpl_pow
when trying to get the data type of the exponent argument:https://github.com/apache/arrow-datafusion/blob/fcd8b899e2a62f798413c536f47078289ece9d05/datafusion/optimizer/src/simplify_expressions/utils.rs#L403
And then the
SimplifyContext
can't get the type because there is "more than one schema":https://github.com/apache/arrow-datafusion/blob/fcd8b899e2a62f798413c536f47078289ece9d05/datafusion/optimizer/src/simplify_expressions/context.rs#L135
The text was updated successfully, but these errors were encountered: