common_primitives/parquet/
numeric.rs

1use serde::{Deserialize, Serialize};
2
3/// Parquet numeric 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 ParquetNumericType {
7	/// Integers
8	Integer(ParquetInteger),
9	/// Decimals
10	Decimal(ParquetDecimal),
11}
12
13/// Parquet Integers
14#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
15pub struct ParquetInteger {
16	/// The number of bits allocated to the parquet integer
17	pub bit_width: u8,
18	/// Whether the integer is signed
19	pub sign: bool,
20}
21
22/// Parquet Decimals
23#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
24pub struct ParquetDecimal {
25	scale: u8,
26
27	// Note: in theory, precision is unbounded. But a u8 should be fine for practical cases
28	precision: u8,
29}