-
Notifications
You must be signed in to change notification settings - Fork 161
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
if_else() expression requires both sides to exist regardless of if the logical expression evaluates to true or false #2190
Comments
@colin-ho can you take a look? |
Hey @daveqs ! The reason for your error is because Daft is trying to create a schema from the That being said, we can make your desired behavior work, i.e. modify Let me know if this is ok for you! |
Hi @colin-ho , in my opinion what you described is the preferred behavior for if_else, and it would solve my use case (though I understand the limitation that the logical must be evaluated during query planning). Do you see any downside to implementing this behavior? |
None I can think of, I can make a PR for this this week. |
Great, thank you! |
Hey @daveqs ! Just merged in the PR for this fix, should be available in the upcoming release next week! |
Describe the bug
When applying the if_else expression following a logical expression, both sides of the logical expression must exist regardless if the logical is true or false. If one side only exists when the logical is true but does't exist when it is false, or visa versa, daft returns
ValueError: DaftError::External Unable to create logical plan node.
To Reproduce
Run the following Python example
Expected behavior
In the above example, I expect test2_df to be identical to test1_df. This would be the case if daft only evaluated the left side of the if_else() expression when the logical is is being applied to (in the example, (daft.lit(idx) > daft.lit(-1)) ) is true and the right side of the if_else() expression when its logical is false.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: