Skip to content

Commit

Permalink
fix: use nanos for datetime (#2072)
Browse files Browse the repository at this point in the history
  • Loading branch information
universalmind303 committed Dec 18, 2021
1 parent 9a3b5af commit 71c5877
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions polars/polars-core/src/chunked_array/temporal/datetime.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;
use crate::prelude::*;
use arrow::temporal_conversions::timestamp_ms_to_datetime;
use arrow::temporal_conversions::timestamp_ns_to_datetime;

impl DatetimeChunked {
pub fn as_datetime_iter(
Expand All @@ -9,7 +9,7 @@ impl DatetimeChunked {
self.downcast_iter()
.map(|iter| {
iter.into_iter()
.map(|opt_v| opt_v.copied().map(timestamp_ms_to_datetime))
.map(|opt_v| opt_v.copied().map(timestamp_ns_to_datetime))
})
.flatten()
.trust_my_length(self.len())
Expand Down Expand Up @@ -86,7 +86,7 @@ impl DatetimeChunked {
let mut ca: Utf8Chunked = self.apply_kernel_cast(|arr| {
let arr: Utf8Array<i64> = arr
.into_iter()
.map(|opt| opt.map(|v| format!("{}", timestamp_ms_to_datetime(*v).format(fmt))))
.map(|opt| opt.map(|v| format!("{}", timestamp_ns_to_datetime(*v).format(fmt))))
.collect();
Arc::new(arr)
});
Expand Down

0 comments on commit 71c5877

Please sign in to comment.