Adds support for ANSI mode in negative function#20189
Open
SubhamSinghal wants to merge 2 commits intoapache:mainfrom
Open
Adds support for ANSI mode in negative function#20189SubhamSinghal wants to merge 2 commits intoapache:mainfrom
SubhamSinghal wants to merge 2 commits intoapache:mainfrom
Conversation
comphead
reviewed
Feb 6, 2026
Contributor
comphead
left a comment
There was a problem hiding this comment.
Thanks @SubhamSinghal I'll check it soon, however ansi mode now makes me think how to better structure tests. What I mean is ANSI edge cases are rare and most of cases should have same results no matter of ANSI flag. That can generate test scenarios duplication which would be nice to avoid
Contributor
Author
|
@comphead Modified UTs to contain only overflow tests in ANSI mode. |
comphead
reviewed
Feb 7, 2026
| let result: PrimitiveArray<Int8Type> = if enable_ansi_mode { | ||
| array.try_unary(|x| { | ||
| x.checked_neg().ok_or_else(|| { | ||
| ArrowError::ComputeError(format!( |
Contributor
There was a problem hiding this comment.
lets use
exec_err! to be in sync with other functions
comphead
reviewed
Feb 7, 2026
| let array = array.as_primitive::<Decimal128Type>(); | ||
| let result: PrimitiveArray<Decimal128Type> = | ||
| array.unary(|x| x.wrapping_neg()); | ||
| let result: PrimitiveArray<Decimal128Type> = if enable_ansi_mode { |
Contributor
There was a problem hiding this comment.
I would suggest having a local macro or generic to reduce boilerplate
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?
#20034
Rationale for this change
ANSI mode support for negative function
What changes are included in this PR?
Added support for ANSI mode for negative function
Are these changes tested?
yes through UT
Are there any user-facing changes?
yes, adds ANSI support to existing function.