common_primitives/parquet/
temporal.rs

1use serde::{Deserialize, Serialize};
2
3/// Parquet temporal types: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md>
4#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
5#[serde(rename_all = "UPPERCASE")]
6pub enum ParquetTemporalType {
7	/// Parquet dates
8	Date,
9	/// Parquet intervals: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#interval>
10	Interval,
11	/// Time
12	Time(ParquetTime),
13	/// Timestamps
14	Timestamp(ParquetTimestamp),
15}
16
17/// Parquet time: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md>
18#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
19pub struct ParquetTime {
20	is_adjusted_to_utc: bool,
21	unit: ParquetTimeUnit,
22}
23
24/// Parquet timestamps: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md>
25#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
26pub struct ParquetTimestamp {
27	is_adjusted_to_utc: bool,
28	unit: ParquetTimeUnit,
29}
30
31/// Units of time
32#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
33#[serde(rename_all = "UPPERCASE")]
34enum ParquetTimeUnit {
35	/// Millisecond precision for time: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#time>
36	Millis,
37	/// Microsecond precision for time: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#time>
38	Micros,
39	/// Manosecond precision for time: <https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#time>
40	Nanos,
41}