Back to all reviewers

Use consistent temporal types

pola-rs/polars
Based on 2 comments
Rust

When implementing or modifying temporal operations, maintain consistent data types that align with existing temporal functions. Specifically, use Int8 for datetime components with small ranges (months, days, hours, minutes, seconds) and Int32/Int64 for larger values (years, microseconds). This approach reduces unnecessary type casting, improves code...

Temporal Rust

Reviewer Prompt

When implementing or modifying temporal operations, maintain consistent data types that align with existing temporal functions. Specifically, use Int8 for datetime components with small ranges (months, days, hours, minutes, seconds) and Int32/Int64 for larger values (years, microseconds). This approach reduces unnecessary type casting, improves code readability, and ensures consistency with temporal functions like .month() that return specific types.

Example:

// Recommended approach - consistent types
let mut month = month.cast(&DataType::Int8)?;
let month = month.i8()?;

// Instead of
// let mut month = month.cast(&DataType::UInt32)?;
// let month = month.u32()?;
2
Comments Analyzed
Rust
Primary Language
Temporal
Category

Source Discussions