Skip to main content

lance_namespace_reqwest_client/models/
partition_field.rs

1/*
2 * Lance Namespace Specification
3 *
4 * This OpenAPI specification is a part of the Lance namespace specification. It contains 2 parts:  The `components/schemas`, `components/responses`, `components/examples`, `tags` sections define the request and response shape for each operation in a Lance Namespace across all implementations. See https://lance.org/format/namespace/operations for more details.  The `servers`, `security`, `paths`, `components/parameters` sections are for the Lance REST Namespace implementation, which defines a complete REST server that can work with Lance datasets. See https://lance.org/format/namespace/rest for more details. 
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// PartitionField : Partition field definition
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PartitionField {
17    /// Unique identifier for this partition field (must not be renamed)
18    #[serde(rename = "field_id")]
19    pub field_id: String,
20    /// Field IDs of the source columns in the schema
21    #[serde(rename = "source_ids")]
22    pub source_ids: Vec<i32>,
23    /// Well-known partition transform. Exactly one of transform or expression must be specified.
24    #[serde(rename = "transform", skip_serializing_if = "Option::is_none")]
25    pub transform: Option<Box<models::PartitionTransform>>,
26    /// DataFusion SQL expression using col0, col1, ... as column references. Exactly one of transform or expression must be specified.
27    #[serde(rename = "expression", skip_serializing_if = "Option::is_none")]
28    pub expression: Option<String>,
29    /// The output type of the partition value (JsonArrowDataType format)
30    #[serde(rename = "result_type")]
31    pub result_type: Box<models::JsonArrowDataType>,
32}
33
34impl PartitionField {
35    /// Partition field definition
36    pub fn new(field_id: String, source_ids: Vec<i32>, result_type: models::JsonArrowDataType) -> PartitionField {
37        PartitionField {
38            field_id,
39            source_ids,
40            transform: None,
41            expression: None,
42            result_type: Box::new(result_type),
43        }
44    }
45}
46