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

Minor: reduce unwraps in datetime_expressions.rs #9072

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jan 30, 2024

Which issue does this PR close?

Follow on to #9040

Rationale for this change

Implement code suggestion I had while reviewing: #9040 (comment)

There are several other uses of unwrap in datetime_expressions.rs that can probably be removed for cleaner code, but I don't think it is critical.

What changes are included in this PR?

Minor refactor to remove some unwrap

Are these changes tested?

Covered by existing tests

Are there any user-facing changes?

No

@alamb alamb mentioned this pull request Jan 30, 2024
@github-actions github-actions bot added the physical-expr Physical Expressions label Jan 30, 2024
@@ -556,30 +556,25 @@ pub fn make_date(args: &[ColumnarValue]) -> Result<ColumnarValue> {
let m = u32::try_from(value_fn(&months, i)?);
let d = u32::try_from(value_fn(&days, i)?);

if m.is_err() {
let Ok(m) = m else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this syntax

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @alamb

@alamb alamb merged commit 47809d9 into apache:main Jan 31, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants