lance_namespace_reqwest_client/models/create_materialized_view_request.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CreateMaterializedViewRequest {
16 #[serde(rename = "identity", skip_serializing_if = "Option::is_none")]
17 pub identity: Option<Box<models::Identity>>,
18 /// View identifier path (namespace + view name)
19 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
20 pub id: Option<Vec<String>>,
21 /// The materialized view kind. - `query` — plain query-backed view (no UDTF), 1:1 rows. - `udtf` — batch UDTF-backed view (N:M rows, full refresh). - `chunker`, aka 'scalar_udtf' — chunker view (1:N row expansion, incremental refresh).
22 #[serde(rename = "kind")]
23 pub kind: Kind,
24 /// Opaque serialized representation of the source query that defines the view's input. The format is defined by the client; the namespace server stores it without interpreting it.
25 #[serde(rename = "source_query")]
26 pub source_query: String,
27 /// Base64-encoded Arrow schema of the view output
28 #[serde(rename = "output_schema")]
29 pub output_schema: String,
30 #[serde(rename = "udtf_spec", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31 pub udtf_spec: Option<Option<Box<models::MaterializedViewUdtfEntry>>>,
32 /// If false, the server kicks off an initial refresh immediately after creating the view and the response includes a job ID.
33 #[serde(rename = "with_no_data", skip_serializing_if = "Option::is_none")]
34 pub with_no_data: Option<bool>,
35 /// If true, the view is automatically refreshed when source-table data changes past the deployment-level threshold. Boolean opt-in only; the threshold and cooldown are configured on the deployment, not per-view.
36 #[serde(rename = "auto_refresh", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37 pub auto_refresh: Option<Option<bool>>,
38}
39
40impl CreateMaterializedViewRequest {
41 pub fn new(kind: Kind, source_query: String, output_schema: String) -> CreateMaterializedViewRequest {
42 CreateMaterializedViewRequest {
43 identity: None,
44 id: None,
45 kind,
46 source_query,
47 output_schema,
48 udtf_spec: None,
49 with_no_data: None,
50 auto_refresh: None,
51 }
52 }
53}
54/// The materialized view kind. - `query` — plain query-backed view (no UDTF), 1:1 rows. - `udtf` — batch UDTF-backed view (N:M rows, full refresh). - `chunker`, aka 'scalar_udtf' — chunker view (1:N row expansion, incremental refresh).
55#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
56pub enum Kind {
57 #[serde(rename = "query")]
58 Query,
59 #[serde(rename = "udtf")]
60 Udtf,
61 #[serde(rename = "chunker")]
62 Chunker,
63}
64
65impl Default for Kind {
66 fn default() -> Kind {
67 Self::Query
68 }
69}
70