Add function volatility to Signature#1071
Merged
alamb merged 8 commits intoapache:masterfrom Oct 7, 2021
pjmore:function-volatility
Merged
Add function volatility to Signature#1071alamb merged 8 commits intoapache:masterfrom pjmore:function-volatility
alamb merged 8 commits intoapache:masterfrom
pjmore:function-volatility
Conversation
…nature type which has volatility calssification
houqp
reviewed
Oct 5, 2021
houqp
approved these changes
Oct 5, 2021
jorgecarleitao
approved these changes
Oct 6, 2021
Member
jorgecarleitao
left a comment
There was a problem hiding this comment.
Beautiful. Ready to go imo.
alamb
approved these changes
Oct 6, 2021
| BuiltinScalarFunction::Upper => Volatility::Immutable, | ||
| BuiltinScalarFunction::RegexpMatch => Volatility::Immutable, | ||
|
|
||
| //Stable builtin functions |
python/tests/test_df.py
Outdated
| def test_udf(df): | ||
| # is_null is a pa function over arrays | ||
| udf = f.udf(lambda x: x.is_null(), [pa.int64()], pa.bool_()) | ||
| udf = f.udf(lambda x: x.is_null(), [pa.int64()], pa.bool_(), f.Volatility.immutable()) |
Contributor
There was a problem hiding this comment.
I believe this line is causing the python code formatter to fail
You can fix it by running a command such as the following
cd datafusion
black --line-length 79 python
Contributor
|
Thanks again @pjmore ! |
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.
Which issue does this PR close?
Closes #1069.
Rationale for this change
Make volatility a first class concept for functions.
What changes are included in this PR?
Renamed the Signature enum to TypeSignature and added Signature struct which currently has 2 fields, type_signature and volatility. I initially tried adding another field containing the volatility to the original Signature enum but this felt clunky and while it could potential allow for conditionally stable\immutable functions with the OneOf variant that seemed like a fairly niche optimization.
Are there any user-facing changes?
Yes Signature was renamed and volatility has been added. There are breaking changes to the public API from this, could someone add the
api-breaklabel? I don't have permission to add labels.