feat: implement cos, sin, and log operations for polars compiler#2170
Merged
feat: implement cos, sin, and log operations for polars compiler#2170
Conversation
| ) -> pl.Expr: | ||
| import polars as pl | ||
|
|
||
| return pl.when(input < -1).then(float("nan")).otherwise((input + 1).log()) |
Contributor
There was a problem hiding this comment.
not input <= -1 and likewise for other log ops?
Collaborator
Author
There was a problem hiding this comment.
Good catch. log(0) is out of the domain. I have also updated this in the SQLGlot implementation that inspired this.
| ) -> pl.Expr: | ||
| import polars as pl | ||
|
|
||
| return pl.when(input <= 0).then(float("nan")).otherwise(input.sqrt()) |
Contributor
There was a problem hiding this comment.
seems sqrt 0 should be 0, not nan?
Collaborator
Author
There was a problem hiding this comment.
Yep. Just pushed some commits fixing.
Collaborator
Author
|
Samples failure: e2e failures: timeout on tests/system/large/functions/test_remote_function.py::test_remote_function_unnamed_removed_w_session_cleanup These seem unrelated to my change. |
TrevorBergeron
approved these changes
Oct 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Towards #2147 (using Polars in more doctests) 🦕