common_primitives/parquet/
column.rs

1/// The model for Parquet data
2use scale_info::prelude::string::String;
3use serde::{Deserialize, Serialize};
4
5use crate::parquet::{column_compression_codec::ColumnCompressionCodec, types::ParquetType};
6
7/// Encapsulation for a single Parquet column
8#[derive(Clone, PartialEq, Debug, Eq, Serialize, Deserialize)]
9#[serde(deny_unknown_fields)]
10pub struct ParquetColumn {
11	/// The label for what this column represents
12	name: String,
13	/// Parquet type labels
14	column_type: ParquetType,
15	/// Compression for column
16	compression: ColumnCompressionCodec,
17	/// Whether or not to use a bloom filter
18	bloom_filter: bool,
19	/// Whether the field is optional
20	optional: Option<bool>,
21}
22
23impl ParquetColumn {
24	/// Creates instance of struct
25	pub fn new(
26		name: String,
27		column_type: ParquetType,
28		compression: ColumnCompressionCodec,
29		bloom_filter: bool,
30		optional: bool,
31	) -> ParquetColumn {
32		ParquetColumn {
33			name,
34			column_type,
35			compression,
36			bloom_filter,
37			optional: optional.then_some(true),
38		}
39	}
40}