Skip to main content

nominal_api/conjure/objects/ingest/api/
parquet_opts.rs

1/// Options for ingesting parquet files.
2/// Supported file formats include .parquet, .parquet.gz
3/// and archives such as .tar, .tar.gz, and .zip (must set the isArchive flag).
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    PartialEq,
10    Eq,
11    PartialOrd,
12    Ord,
13    Hash
14)]
15#[serde(crate = "conjure_object::serde")]
16#[conjure_object::private::staged_builder::staged_builder]
17#[builder(crate = conjure_object::private::staged_builder, update, inline)]
18pub struct ParquetOpts {
19    #[builder(custom(type = super::IngestSource, convert = Box::new))]
20    #[serde(rename = "source")]
21    source: Box<super::IngestSource>,
22    #[builder(custom(type = super::DatasetIngestTarget, convert = Box::new))]
23    #[serde(rename = "target")]
24    target: Box<super::DatasetIngestTarget>,
25    #[builder(custom(type = super::TimestampMetadata, convert = Box::new))]
26    #[serde(rename = "timestampMetadata")]
27    timestamp_metadata: Box<super::TimestampMetadata>,
28    #[builder(default)]
29    #[serde(rename = "channelPrefix", skip_serializing_if = "Option::is_none", default)]
30    channel_prefix: super::ChannelPrefix,
31    #[builder(default, into)]
32    #[serde(
33        rename = "tagKeysFromColumns",
34        skip_serializing_if = "Option::is_none",
35        default
36    )]
37    tag_keys_from_columns: Option<std::collections::BTreeSet<String>>,
38    #[builder(default, into)]
39    #[serde(rename = "tagColumns", skip_serializing_if = "Option::is_none", default)]
40    tag_columns: Option<std::collections::BTreeMap<String, String>>,
41    #[builder(default, into)]
42    #[serde(
43        rename = "additionalFileTags",
44        skip_serializing_if = "Option::is_none",
45        default
46    )]
47    additional_file_tags: Option<std::collections::BTreeMap<String, String>>,
48    #[builder(default, into)]
49    #[serde(rename = "isArchive", skip_serializing_if = "Option::is_none", default)]
50    is_archive: Option<bool>,
51    #[builder(default, set(item(type = String, into)))]
52    #[serde(
53        rename = "excludeColumns",
54        skip_serializing_if = "std::collections::BTreeSet::is_empty",
55        default
56    )]
57    exclude_columns: std::collections::BTreeSet<String>,
58}
59impl ParquetOpts {
60    /// Constructs a new instance of the type.
61    #[inline]
62    pub fn new(
63        source: super::IngestSource,
64        target: super::DatasetIngestTarget,
65        timestamp_metadata: super::TimestampMetadata,
66    ) -> Self {
67        Self::builder()
68            .source(source)
69            .target(target)
70            .timestamp_metadata(timestamp_metadata)
71            .build()
72    }
73    #[inline]
74    pub fn source(&self) -> &super::IngestSource {
75        &*self.source
76    }
77    #[inline]
78    pub fn target(&self) -> &super::DatasetIngestTarget {
79        &*self.target
80    }
81    #[inline]
82    pub fn timestamp_metadata(&self) -> &super::TimestampMetadata {
83        &*self.timestamp_metadata
84    }
85    #[inline]
86    pub fn channel_prefix(&self) -> &super::ChannelPrefix {
87        &self.channel_prefix
88    }
89    #[deprecated(note = "Deprecated in favor of tagColumns.")]
90    #[inline]
91    pub fn tag_keys_from_columns(&self) -> Option<&std::collections::BTreeSet<String>> {
92        self.tag_keys_from_columns.as_ref().map(|o| &*o)
93    }
94    /// A map of tag names to column names to derive the tag values from.
95    #[inline]
96    pub fn tag_columns(&self) -> Option<&std::collections::BTreeMap<String, String>> {
97        self.tag_columns.as_ref().map(|o| &*o)
98    }
99    /// Specifies a tag set to apply to all data in the file.
100    #[inline]
101    pub fn additional_file_tags(
102        &self,
103    ) -> Option<&std::collections::BTreeMap<String, String>> {
104        self.additional_file_tags.as_ref().map(|o| &*o)
105    }
106    /// If true, the file is an archive. Supported archive formats include
107    /// .tar, .tar.gz, and .zip. Only files ending in .parquet
108    /// within the archive will be ingested. If field not provided, defaults to false.
109    #[inline]
110    pub fn is_archive(&self) -> Option<bool> {
111        self.is_archive.as_ref().map(|o| *o)
112    }
113    /// A set of column names to exclude from ingestion. These columns will not be
114    /// ingested as channels. Useful for excluding columns that contain unsupported
115    /// data types like multidimensional arrays.
116    #[inline]
117    pub fn exclude_columns(&self) -> &std::collections::BTreeSet<String> {
118        &self.exclude_columns
119    }
120}