Skip to content
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

Add negate kernels (#4488) #4494

Merged
merged 4 commits into from
Jul 10, 2023
Merged

Add negate kernels (#4488) #4494

merged 4 commits into from
Jul 10, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Jul 9, 2023

Which issue does this PR close?

Closes #4488

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jul 9, 2023
@tustvold
Copy link
Contributor Author

tustvold commented Jul 9, 2023

Will add interval tests shortly, realise I forgot

@alamb
Copy link
Contributor

alamb commented Jul 10, 2023

Will add interval tests shortly, realise I forgot

Should I wait to review this PR until you wrote those tests? Or did you add them to #4493 ?

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tustvold -- looks great to me

}};
}

/// Perform `!array`, returning an error on overflow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Perform `!array`, returning an error on overflow
/// Negates each element of `array`, returning an error on overflow

I am not really sure what "Performs !array" means

/// Perform `!array`, returning an error on overflow
///
/// Note: negation of unsigned arrays is not supported and will return in an error,
/// for wrapping unsigned negation consider using [`neg_wrapping()`]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// for wrapping unsigned negation consider using [`neg_wrapping()`]
/// for wrapping unsigned negation consider using [`neg_wrapping`]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary to avoid ambiguity, will change to a link

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry it just looked strange to me

}
}

/// Perform `!array`, wrapping on overflow for [`DataType::is_integer`]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Perform `!array`, wrapping on overflow for [`DataType::is_integer`]
/// Negates each element of `array` , wrapping on overflow for [`DataType::is_integer`]

Duration(Millisecond) => neg_checked!(DurationMillisecondType, array),
Duration(Microsecond) => neg_checked!(DurationMicrosecondType, array),
Duration(Nanosecond) => neg_checked!(DurationNanosecondType, array),
Interval(YearMonth) => neg_checked!(IntervalYearMonthType, array),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked that YearMonth intervals are stored as number of whole intervals and thus don't need to be treated field by field

@tustvold tustvold merged commit 20af94b into apache:master Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interval Negation Incorrect
2 participants