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

Adding sub day seconds to Date64 is ignored. #6198

Closed
tshauck opened this issue Aug 5, 2024 · 2 comments
Closed

Adding sub day seconds to Date64 is ignored. #6198

tshauck opened this issue Aug 5, 2024 · 2 comments
Labels
arrow Changes to the arrow crate bug

Comments

@tshauck
Copy link
Contributor

tshauck commented Aug 5, 2024

Describe the bug

The second part of add_month_day_nano is seemingly ignored, so if you try to add like an hour to a Date64Type, you actually get back the same date.

To Reproduce

This test will pass on main, but it shouldn't (added to arrow-array/src/types.rs).

#[cfg(test)]
mod tests {
    use super::*;
    use arrow_data::{layout, BufferSpec};

    #[test]
    fn add_month_day_nano() {
        let date_64 = Date64Type::default_value();
        let interval = IntervalMonthDayNanoType::make_value(0, 0, 1_000_000_000 * 3600);

        let result = Date64Type::add_month_day_nano(date_64, interval);

        // result equals date_64, but should be an hour after.
        assert_eq!(result, date_64);
    }
}

Expected behavior

For date64s adding increments less than a day should be supported.

Additional context

I think the result is from coercion to a NaiveDate instead of a NaiveDateTime. I have a working branch, I'll open a PR for... https://github.com/apache/arrow-rs/compare/master...tshauck:add-sub-day-increments-to-date64type?expand=1

@tustvold
Copy link
Contributor

tustvold commented Aug 8, 2024

See discussion on #6199

@tustvold tustvold closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2024
@alamb alamb added the arrow Changes to the arrow crate label Aug 31, 2024
@alamb
Copy link
Contributor

alamb commented Aug 31, 2024

label_issue.py automatically added labels {'arrow'} from #6199

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 bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants