diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e795ba3..0fd2a80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,16 +38,6 @@ jobs: unit: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Update Rust Stable - run: rustup update stable - - name: Test - run: cargo test --all-targets --all-features - - integration-tests: - runs-on: ubuntu-latest - needs: unit steps: - uses: actions/checkout@v3 - name: Update Rust Stable @@ -59,9 +49,5 @@ jobs: uses: abatilo/actions-poetry@v2 with: poetry-version: "1.5.1" - - name: Build rust - run: cargo build --all-features - - name: Run tests - run: | - cd tests/integration - bash run.sh + - name: Test + run: cargo test --all-targets --all-features \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index de82019..0b81d91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ async-trait = "0.1" apache-avro = { version = "0.15", features = ["derive"] } arrow = { version = ">=40, <45" } bytes = "1" -futures = "0.3" opendal = ">=0.37, <0.40" uuid = { version = "1", features = ["v4"] } serde = "1" @@ -35,5 +34,8 @@ env_logger = "0.10.0" csv = "1" url = "2" regex = "1" -clap = { version = "4", features = ["derive"]} +clap = { version = "4", features = ["derive"] } ordered-float = "3.7.0" +confique = "0.2" +libtest-mimic = "0.6" +futures = { version = "0.3", features = ["executor"]} diff --git a/rest_api/src/apis/catalog_api_api.rs b/rest_api/src/apis/catalog_api_api.rs index 000ff48..6e433b8 100644 --- a/rest_api/src/apis/catalog_api_api.rs +++ b/rest_api/src/apis/catalog_api_api.rs @@ -4,16 +4,14 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - use reqwest; +use super::{configuration, Error}; use crate::apis::ResponseContent; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_namespace`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -206,18 +204,27 @@ pub enum UpdateTableError { UnknownValue(serde_json::Value), } - /// Create a namespace, with an optional set of properties. The server might also add properties, such as `last_modified_time` etc. -pub async fn create_namespace(configuration: &configuration::Configuration, prefix: &str, create_namespace_request: Option) -> Result> { +pub async fn create_namespace( + configuration: &configuration::Configuration, + prefix: &str, + create_namespace_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -236,23 +243,40 @@ pub async fn create_namespace(configuration: &configuration::Configuration, pref if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Create a table or start a create transaction, like atomic CTAS. If `stage-create` is false, the table is created immediately. If `stage-create` is true, the table is not created, but table metadata is initialized and returned. The service should prepare as needed for a commit to the table commit endpoint to complete the create transaction. The client uses the returned metadata to begin a transaction. To commit the transaction, the client sends all create and subsequent changes to the table commit route. Changes from the table create operation include changes like AddSchemaUpdate and SetCurrentSchemaUpdate that set the initial table state. -pub async fn create_table(configuration: &configuration::Configuration, prefix: &str, namespace: &str, create_table_request: Option) -> Result> { +pub async fn create_table( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + create_table_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -271,22 +295,38 @@ pub async fn create_table(configuration: &configuration::Configuration, prefix: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn drop_namespace(configuration: &configuration::Configuration, prefix: &str, namespace: &str) -> Result<(), Error> { +pub async fn drop_namespace( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -304,26 +344,46 @@ pub async fn drop_namespace(configuration: &configuration::Configuration, prefix if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Remove a table from the catalog -pub async fn drop_table(configuration: &configuration::Configuration, prefix: &str, namespace: &str, table: &str, purge_requested: Option) -> Result<(), Error> { +pub async fn drop_table( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + table: &str, + purge_requested: Option, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace), table=crate::apis::urlencode(table)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace), + table = crate::apis::urlencode(table) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_str) = purge_requested { - local_var_req_builder = local_var_req_builder.query(&[("purgeRequested", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("purgeRequested", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -341,26 +401,42 @@ pub async fn drop_table(configuration: &configuration::Configuration, prefix: &s if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// List all namespaces at a certain level, optionally starting from a given parent namespace. For example, if table accounting.tax.paid exists, using 'SELECT NAMESPACE IN accounting' would translate into `GET /namespaces?parent=accounting` and must return a namespace, [\"accounting\", \"tax\"]. If `parent` is not provided, all top-level namespaces should be listed. -pub async fn list_namespaces(configuration: &configuration::Configuration, prefix: &str, parent: Option<&str>) -> Result> { +pub async fn list_namespaces( + configuration: &configuration::Configuration, + prefix: &str, + parent: Option<&str>, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = parent { - local_var_req_builder = local_var_req_builder.query(&[("parent", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("parent", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -378,23 +454,39 @@ pub async fn list_namespaces(configuration: &configuration::Configuration, prefi if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Return all table identifiers under this namespace -pub async fn list_tables(configuration: &configuration::Configuration, prefix: &str, namespace: &str) -> Result> { +pub async fn list_tables( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -412,23 +504,39 @@ pub async fn list_tables(configuration: &configuration::Configuration, prefix: & if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Return all stored metadata properties for a given namespace -pub async fn load_namespace_metadata(configuration: &configuration::Configuration, prefix: &str, namespace: &str) -> Result> { +pub async fn load_namespace_metadata( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -446,26 +554,46 @@ pub async fn load_namespace_metadata(configuration: &configuration::Configuratio if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Load a table from the catalog. The response contains both configuration and table metadata. The configuration, if non-empty is used as additional configuration for the table that overrides catalog configuration. For example, this configuration may change the FileIO implementation to be used for the table. The response also contains the table's full metadata, matching the table metadata JSON file. The catalog configuration may contain credentials that should be used for subsequent requests for the table. The configuration key \"token\" is used to pass an access token to be used as a bearer token for table requests. Otherwise, a token may be passed using a RFC 8693 token type as a configuration key. For example, \"urn:ietf:params:oauth:token-type:jwt=\". -pub async fn load_table(configuration: &configuration::Configuration, prefix: &str, namespace: &str, table: &str, snapshots: Option<&str>) -> Result> { +pub async fn load_table( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + table: &str, + snapshots: Option<&str>, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace), table=crate::apis::urlencode(table)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace), + table = crate::apis::urlencode(table) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = snapshots { - local_var_req_builder = local_var_req_builder.query(&[("snapshots", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("snapshots", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -483,23 +611,38 @@ pub async fn load_table(configuration: &configuration::Configuration, prefix: &s if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Rename a table from one identifier to another. It's valid to move a table across namespaces, but the server implementation is not required to support it. -pub async fn rename_table(configuration: &configuration::Configuration, prefix: &str, rename_table_request: crate::models::RenameTableRequest) -> Result<(), Error> { +pub async fn rename_table( + configuration: &configuration::Configuration, + prefix: &str, + rename_table_request: crate::models::RenameTableRequest, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/tables/rename", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/tables/rename", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -518,22 +661,41 @@ pub async fn rename_table(configuration: &configuration::Configuration, prefix: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn report_metrics(configuration: &configuration::Configuration, prefix: &str, namespace: &str, table: &str, report_metrics_request: crate::models::ReportMetricsRequest) -> Result<(), Error> { +pub async fn report_metrics( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + table: &str, + report_metrics_request: crate::models::ReportMetricsRequest, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace), table=crate::apis::urlencode(table)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace), + table = crate::apis::urlencode(table) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -552,23 +714,41 @@ pub async fn report_metrics(configuration: &configuration::Configuration, prefix if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Check if a table exists within a given namespace. This request does not return a response body. -pub async fn table_exists(configuration: &configuration::Configuration, prefix: &str, namespace: &str, table: &str) -> Result<(), Error> { +pub async fn table_exists( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + table: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace), table=crate::apis::urlencode(table)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace), + table = crate::apis::urlencode(table) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -586,23 +766,40 @@ pub async fn table_exists(configuration: &configuration::Configuration, prefix: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Set and/or remove properties on a namespace. The request body specifies a list of properties to remove and a map of key value pairs to update. Properties that are not in the request are not modified or removed by this call. Server implementations are not required to support namespace properties. -pub async fn update_properties(configuration: &configuration::Configuration, prefix: &str, namespace: &str, update_namespace_properties_request: Option) -> Result> { +pub async fn update_properties( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + update_namespace_properties_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/properties", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/properties", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -621,23 +818,42 @@ pub async fn update_properties(configuration: &configuration::Configuration, pre if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Commit updates to a table. Commits have two parts, requirements and updates. Requirements are assertions that will be validated before attempting to make and commit changes. For example, `assert-ref-snapshot-id` will check that a named ref's snapshot ID has a certain value. Updates are changes to make to table metadata. For example, after asserting that the current main ref is at the expected snapshot, a commit may add a new child snapshot and set the ref to the new snapshot id. Create table transactions that are started by createTable with `stage-create` set to true are committed using this route. Transactions should include all changes to the table, including table initialization, like AddSchemaUpdate and SetCurrentSchemaUpdate. The `assert-create` requirement is used to ensure that the table was not created concurrently. -pub async fn update_table(configuration: &configuration::Configuration, prefix: &str, namespace: &str, table: &str, commit_table_request: Option) -> Result> { +pub async fn update_table( + configuration: &configuration::Configuration, + prefix: &str, + namespace: &str, + table: &str, + commit_table_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", local_var_configuration.base_path, prefix=crate::apis::urlencode(prefix), namespace=crate::apis::urlencode(namespace), table=crate::apis::urlencode(table)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/v1/{prefix}/namespaces/{namespace}/tables/{table}", + local_var_configuration.base_path, + prefix = crate::apis::urlencode(prefix), + namespace = crate::apis::urlencode(namespace), + table = crate::apis::urlencode(table) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -656,9 +872,13 @@ pub async fn update_table(configuration: &configuration::Configuration, prefix: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/rest_api/src/apis/configuration.rs b/rest_api/src/apis/configuration.rs index 9c07428..ea68adf 100644 --- a/rest_api/src/apis/configuration.rs +++ b/rest_api/src/apis/configuration.rs @@ -4,12 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -30,7 +28,6 @@ pub struct ApiKey { pub key: String, } - impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -47,7 +44,6 @@ impl Default for Configuration { oauth_access_token: None, bearer_access_token: None, api_key: None, - } } } diff --git a/rest_api/src/apis/configuration_api_api.rs b/rest_api/src/apis/configuration_api_api.rs index ae0665b..2f03ce1 100644 --- a/rest_api/src/apis/configuration_api_api.rs +++ b/rest_api/src/apis/configuration_api_api.rs @@ -4,16 +4,14 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - use reqwest; +use super::{configuration, Error}; use crate::apis::ResponseContent; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_config`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -28,21 +26,26 @@ pub enum GetConfigError { UnknownValue(serde_json::Value), } - -/// All REST clients should first call this route to get catalog configuration properties from the server to configure the catalog and its HTTP client. Configuration from the server consists of two sets of key/value pairs. - defaults - properties that should be used as default configuration; applied before client configuration - overrides - properties that should be used to override client configuration; applied after defaults and client configuration Catalog configuration is constructed by setting the defaults, then client- provided configuration, and finally overrides. The final property set is then used to configure the catalog. For example, a default configuration property might set the size of the client pool, which can be replaced with a client-specific setting. An override might be used to set the warehouse location, which is stored on the server rather than in client configuration. Common catalog configuration settings are documented at https://iceberg.apache.org/configuration/#catalog-properties -pub async fn get_config(configuration: &configuration::Configuration, warehouse: Option<&str>) -> Result> { +/// All REST clients should first call this route to get catalog configuration properties from the server to configure the catalog and its HTTP client. Configuration from the server consists of two sets of key/value pairs. - defaults - properties that should be used as default configuration; applied before client configuration - overrides - properties that should be used to override client configuration; applied after defaults and client configuration Catalog configuration is constructed by setting the defaults, then client- provided configuration, and finally overrides. The final property set is then used to configure the catalog. For example, a default configuration property might set the size of the client pool, which can be replaced with a client-specific setting. An override might be used to set the warehouse location, which is stored on the server rather than in client configuration. Common catalog configuration settings are documented at https://iceberg.apache.org/configuration/#catalog-properties +pub async fn get_config( + configuration: &configuration::Configuration, + warehouse: Option<&str>, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/v1/config", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = warehouse { - local_var_req_builder = local_var_req_builder.query(&[("warehouse", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("warehouse", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -60,9 +63,13 @@ pub async fn get_config(configuration: &configuration::Configuration, warehouse: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/rest_api/src/apis/mod.rs b/rest_api/src/apis/mod.rs index 516833d..7dbf72b 100644 --- a/rest_api/src/apis/mod.rs +++ b/rest_api/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - }, - serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } diff --git a/rest_api/src/apis/o_auth2_api_api.rs b/rest_api/src/apis/o_auth2_api_api.rs index 240d6e7..975e326 100644 --- a/rest_api/src/apis/o_auth2_api_api.rs +++ b/rest_api/src/apis/o_auth2_api_api.rs @@ -4,16 +4,14 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - use reqwest; +use super::{configuration, Error}; use crate::apis::ResponseContent; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_token`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -25,18 +23,30 @@ pub enum GetTokenError { UnknownValue(serde_json::Value), } - /// Exchange credentials for a token using the OAuth2 client credentials flow or token exchange. This endpoint is used for three purposes - 1. To exchange client credentials (client ID and secret) for an access token This uses the client credentials flow. 2. To exchange a client token and an identity token for a more specific access token This uses the token exchange flow. 3. To exchange an access token for one with the same claims and a refreshed expiration period This uses the token exchange flow. For example, a catalog client may be configured with client credentials from the OAuth2 Authorization flow. This client would exchange its client ID and secret for an access token using the client credentials request with this endpoint (1). Subsequent requests would then use that access token. Some clients may also handle sessions that have additional user context. These clients would use the token exchange flow to exchange a user token (the \"subject\" token) from the session for a more specific access token for that user, using the catalog's access token as the \"actor\" token (2). The user ID token is the \"subject\" token and can be any token type allowed by the OAuth2 token exchange flow, including a unsecured JWT token with a sub claim. This request should use the catalog's bearer token in the \"Authorization\" header. Clients may also use the token exchange flow to refresh a token that is about to expire by sending a token exchange request (3). The request's \"subject\" token should be the expiring token. This request should use the subject token in the \"Authorization\" header. -pub async fn get_token(configuration: &configuration::Configuration, grant_type: &str, client_id: &str, client_secret: &str, subject_token: &str, subject_token_type: crate::models::TokenType, scope: Option<&str>, requested_token_type: Option, actor_token: Option<&str>, actor_token_type: Option) -> Result> { +pub async fn get_token( + configuration: &configuration::Configuration, + grant_type: &str, + client_id: &str, + client_secret: &str, + subject_token: &str, + subject_token_type: crate::models::TokenType, + scope: Option<&str>, + requested_token_type: Option, + actor_token: Option<&str>, + actor_token_type: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/v1/oauth/tokens", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); @@ -74,8 +84,11 @@ pub async fn get_token(configuration: &configuration::Configuration, grant_type: serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/rest_api/src/models/add_partition_spec_update.rs b/rest_api/src/models/add_partition_spec_update.rs index 96d600a..28a2cd9 100644 --- a/rest_api/src/models/add_partition_spec_update.rs +++ b/rest_api/src/models/add_partition_spec_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddPartitionSpecUpdate { #[serde(rename = "action")] @@ -28,7 +25,7 @@ impl AddPartitionSpecUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/add_partition_spec_update_all_of.rs b/rest_api/src/models/add_partition_spec_update_all_of.rs index 496c698..765f0fe 100644 --- a/rest_api/src/models/add_partition_spec_update_all_of.rs +++ b/rest_api/src/models/add_partition_spec_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddPartitionSpecUpdateAllOf { #[serde(rename = "spec")] @@ -24,5 +21,3 @@ impl AddPartitionSpecUpdateAllOf { } } } - - diff --git a/rest_api/src/models/add_schema_update.rs b/rest_api/src/models/add_schema_update.rs index 2f1c23c..0685aea 100644 --- a/rest_api/src/models/add_schema_update.rs +++ b/rest_api/src/models/add_schema_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddSchemaUpdate { #[serde(rename = "action")] @@ -28,7 +25,7 @@ impl AddSchemaUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/add_schema_update_all_of.rs b/rest_api/src/models/add_schema_update_all_of.rs index 24f25d1..a8319c9 100644 --- a/rest_api/src/models/add_schema_update_all_of.rs +++ b/rest_api/src/models/add_schema_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddSchemaUpdateAllOf { #[serde(rename = "schema")] @@ -24,5 +21,3 @@ impl AddSchemaUpdateAllOf { } } } - - diff --git a/rest_api/src/models/add_snapshot_update.rs b/rest_api/src/models/add_snapshot_update.rs index 4f6844a..e1d8258 100644 --- a/rest_api/src/models/add_snapshot_update.rs +++ b/rest_api/src/models/add_snapshot_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddSnapshotUpdate { #[serde(rename = "action")] @@ -28,7 +25,7 @@ impl AddSnapshotUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/add_snapshot_update_all_of.rs b/rest_api/src/models/add_snapshot_update_all_of.rs index 6e16323..c4ce461 100644 --- a/rest_api/src/models/add_snapshot_update_all_of.rs +++ b/rest_api/src/models/add_snapshot_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddSnapshotUpdateAllOf { #[serde(rename = "snapshot")] @@ -24,5 +21,3 @@ impl AddSnapshotUpdateAllOf { } } } - - diff --git a/rest_api/src/models/add_sort_order_update.rs b/rest_api/src/models/add_sort_order_update.rs index b23dcb7..843484b 100644 --- a/rest_api/src/models/add_sort_order_update.rs +++ b/rest_api/src/models/add_sort_order_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddSortOrderUpdate { #[serde(rename = "action")] @@ -28,7 +25,7 @@ impl AddSortOrderUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/add_sort_order_update_all_of.rs b/rest_api/src/models/add_sort_order_update_all_of.rs index 5a8840e..633db7f 100644 --- a/rest_api/src/models/add_sort_order_update_all_of.rs +++ b/rest_api/src/models/add_sort_order_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AddSortOrderUpdateAllOf { #[serde(rename = "sort-order")] @@ -24,5 +21,3 @@ impl AddSortOrderUpdateAllOf { } } } - - diff --git a/rest_api/src/models/and_or_expression.rs b/rest_api/src/models/and_or_expression.rs index eb6887d..9f689ab 100644 --- a/rest_api/src/models/and_or_expression.rs +++ b/rest_api/src/models/and_or_expression.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct AndOrExpression { #[serde(rename = "type")] @@ -22,7 +19,11 @@ pub struct AndOrExpression { } impl AndOrExpression { - pub fn new(r#type: String, left: crate::models::Expression, right: crate::models::Expression) -> AndOrExpression { + pub fn new( + r#type: String, + left: crate::models::Expression, + right: crate::models::Expression, + ) -> AndOrExpression { AndOrExpression { r#type, left: Box::new(left), @@ -30,5 +31,3 @@ impl AndOrExpression { } } } - - diff --git a/rest_api/src/models/base_update.rs b/rest_api/src/models/base_update.rs index 55b7ff3..9cdbeac 100644 --- a/rest_api/src/models/base_update.rs +++ b/rest_api/src/models/base_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct BaseUpdate { #[serde(rename = "action")] @@ -19,13 +16,11 @@ pub struct BaseUpdate { impl BaseUpdate { pub fn new(action: Action) -> BaseUpdate { - BaseUpdate { - action, - } + BaseUpdate { action } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -63,4 +58,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/catalog_config.rs b/rest_api/src/models/catalog_config.rs index 83ff7f0..2c31bd1 100644 --- a/rest_api/src/models/catalog_config.rs +++ b/rest_api/src/models/catalog_config.rs @@ -4,14 +4,12 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ /// CatalogConfig : Server-provided configuration for the catalog. - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CatalogConfig { /// Properties that should be used to override client configuration; applied after defaults and client configuration. @@ -24,12 +22,13 @@ pub struct CatalogConfig { impl CatalogConfig { /// Server-provided configuration for the catalog. - pub fn new(overrides: ::std::collections::HashMap, defaults: ::std::collections::HashMap) -> CatalogConfig { + pub fn new( + overrides: ::std::collections::HashMap, + defaults: ::std::collections::HashMap, + ) -> CatalogConfig { CatalogConfig { overrides, defaults, } } } - - diff --git a/rest_api/src/models/commit_report.rs b/rest_api/src/models/commit_report.rs index 03e5cb1..791e379 100644 --- a/rest_api/src/models/commit_report.rs +++ b/rest_api/src/models/commit_report.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CommitReport { #[serde(rename = "table-name")] @@ -28,7 +25,13 @@ pub struct CommitReport { } impl CommitReport { - pub fn new(table_name: String, snapshot_id: i64, sequence_number: i64, operation: String, metrics: ::std::collections::HashMap) -> CommitReport { + pub fn new( + table_name: String, + snapshot_id: i64, + sequence_number: i64, + operation: String, + metrics: ::std::collections::HashMap, + ) -> CommitReport { CommitReport { table_name, snapshot_id, @@ -39,5 +42,3 @@ impl CommitReport { } } } - - diff --git a/rest_api/src/models/commit_table_request.rs b/rest_api/src/models/commit_table_request.rs index 3afd080..13a15cc 100644 --- a/rest_api/src/models/commit_table_request.rs +++ b/rest_api/src/models/commit_table_request.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CommitTableRequest { #[serde(rename = "requirements")] @@ -20,12 +17,13 @@ pub struct CommitTableRequest { } impl CommitTableRequest { - pub fn new(requirements: Vec, updates: Vec) -> CommitTableRequest { + pub fn new( + requirements: Vec, + updates: Vec, + ) -> CommitTableRequest { CommitTableRequest { requirements, updates, } } } - - diff --git a/rest_api/src/models/commit_table_response.rs b/rest_api/src/models/commit_table_response.rs index a14d0db..808d7c5 100644 --- a/rest_api/src/models/commit_table_response.rs +++ b/rest_api/src/models/commit_table_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CommitTableResponse { #[serde(rename = "metadata-location")] @@ -20,12 +17,13 @@ pub struct CommitTableResponse { } impl CommitTableResponse { - pub fn new(metadata_location: String, metadata: crate::models::TableMetadata) -> CommitTableResponse { + pub fn new( + metadata_location: String, + metadata: crate::models::TableMetadata, + ) -> CommitTableResponse { CommitTableResponse { metadata_location, metadata: Box::new(metadata), } } } - - diff --git a/rest_api/src/models/counter_result.rs b/rest_api/src/models/counter_result.rs index 8d8f339..33c69ef 100644 --- a/rest_api/src/models/counter_result.rs +++ b/rest_api/src/models/counter_result.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CounterResult { #[serde(rename = "unit")] @@ -21,11 +18,6 @@ pub struct CounterResult { impl CounterResult { pub fn new(unit: String, value: i64) -> CounterResult { - CounterResult { - unit, - value, - } + CounterResult { unit, value } } } - - diff --git a/rest_api/src/models/create_namespace_request.rs b/rest_api/src/models/create_namespace_request.rs index 2bf2387..13af6f8 100644 --- a/rest_api/src/models/create_namespace_request.rs +++ b/rest_api/src/models/create_namespace_request.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CreateNamespaceRequest { /// Reference to one or more levels of a namespace @@ -29,5 +26,3 @@ impl CreateNamespaceRequest { } } } - - diff --git a/rest_api/src/models/create_namespace_response.rs b/rest_api/src/models/create_namespace_response.rs index 121c90f..d1b51d6 100644 --- a/rest_api/src/models/create_namespace_response.rs +++ b/rest_api/src/models/create_namespace_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CreateNamespaceResponse { /// Reference to one or more levels of a namespace @@ -29,5 +26,3 @@ impl CreateNamespaceResponse { } } } - - diff --git a/rest_api/src/models/create_table_request.rs b/rest_api/src/models/create_table_request.rs index a0f3c41..1d39ec0 100644 --- a/rest_api/src/models/create_table_request.rs +++ b/rest_api/src/models/create_table_request.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct CreateTableRequest { #[serde(rename = "name")] @@ -42,5 +39,3 @@ impl CreateTableRequest { } } } - - diff --git a/rest_api/src/models/error_model.rs b/rest_api/src/models/error_model.rs index 157c687..3e14530 100644 --- a/rest_api/src/models/error_model.rs +++ b/rest_api/src/models/error_model.rs @@ -4,14 +4,12 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ /// ErrorModel : JSON error payload returned in a response with further details on the error - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ErrorModel { /// Human-readable error message @@ -38,5 +36,3 @@ impl ErrorModel { } } } - - diff --git a/rest_api/src/models/expression.rs b/rest_api/src/models/expression.rs index d8531fc..984a1bb 100644 --- a/rest_api/src/models/expression.rs +++ b/rest_api/src/models/expression.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct Expression { #[serde(rename = "type")] @@ -30,7 +27,15 @@ pub struct Expression { } impl Expression { - pub fn new(r#type: String, left: crate::models::Expression, right: crate::models::Expression, child: crate::models::Expression, term: crate::models::Term, values: Vec, value: serde_json::Value) -> Expression { + pub fn new( + r#type: String, + left: crate::models::Expression, + right: crate::models::Expression, + child: crate::models::Expression, + term: crate::models::Term, + values: Vec, + value: serde_json::Value, + ) -> Expression { Expression { r#type, left: Box::new(left), @@ -42,5 +47,3 @@ impl Expression { } } } - - diff --git a/rest_api/src/models/get_namespace_response.rs b/rest_api/src/models/get_namespace_response.rs index c90c112..923bae0 100644 --- a/rest_api/src/models/get_namespace_response.rs +++ b/rest_api/src/models/get_namespace_response.rs @@ -4,20 +4,22 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct GetNamespaceResponse { /// Reference to one or more levels of a namespace #[serde(rename = "namespace")] pub namespace: Vec, /// Properties stored on the namespace, if supported by the server. If the server does not support namespace properties, it should return null for this field. If namespace properties are supported, but none are set, it should return an empty object. - #[serde(rename = "properties", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "properties", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub properties: Option>>, } @@ -29,5 +31,3 @@ impl GetNamespaceResponse { } } } - - diff --git a/rest_api/src/models/iceberg_error_response.rs b/rest_api/src/models/iceberg_error_response.rs index ba52be5..26964ac 100644 --- a/rest_api/src/models/iceberg_error_response.rs +++ b/rest_api/src/models/iceberg_error_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct IcebergErrorResponse { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] @@ -19,10 +16,6 @@ pub struct IcebergErrorResponse { impl IcebergErrorResponse { pub fn new() -> IcebergErrorResponse { - IcebergErrorResponse { - error: None, - } + IcebergErrorResponse { error: None } } } - - diff --git a/rest_api/src/models/list_namespaces_response.rs b/rest_api/src/models/list_namespaces_response.rs index 93929fa..30090a5 100644 --- a/rest_api/src/models/list_namespaces_response.rs +++ b/rest_api/src/models/list_namespaces_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ListNamespacesResponse { #[serde(rename = "namespaces", skip_serializing_if = "Option::is_none")] @@ -19,10 +16,6 @@ pub struct ListNamespacesResponse { impl ListNamespacesResponse { pub fn new() -> ListNamespacesResponse { - ListNamespacesResponse { - namespaces: None, - } + ListNamespacesResponse { namespaces: None } } } - - diff --git a/rest_api/src/models/list_tables_response.rs b/rest_api/src/models/list_tables_response.rs index eb98701..51144fd 100644 --- a/rest_api/src/models/list_tables_response.rs +++ b/rest_api/src/models/list_tables_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ListTablesResponse { #[serde(rename = "identifiers", skip_serializing_if = "Option::is_none")] @@ -19,10 +16,6 @@ pub struct ListTablesResponse { impl ListTablesResponse { pub fn new() -> ListTablesResponse { - ListTablesResponse { - identifiers: None, - } + ListTablesResponse { identifiers: None } } } - - diff --git a/rest_api/src/models/list_type.rs b/rest_api/src/models/list_type.rs index 5210703..f7b5342 100644 --- a/rest_api/src/models/list_type.rs +++ b/rest_api/src/models/list_type.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ListType { #[serde(rename = "type")] @@ -24,7 +21,12 @@ pub struct ListType { } impl ListType { - pub fn new(r#type: RHashType, element_id: i32, element: crate::models::Type, element_required: bool) -> ListType { + pub fn new( + r#type: RHashType, + element_id: i32, + element: crate::models::Type, + element_required: bool, + ) -> ListType { ListType { r#type, element_id, @@ -34,7 +36,7 @@ impl ListType { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "list")] @@ -46,4 +48,3 @@ impl Default for RHashType { Self::List } } - diff --git a/rest_api/src/models/literal_expression.rs b/rest_api/src/models/literal_expression.rs index b158c54..e539860 100644 --- a/rest_api/src/models/literal_expression.rs +++ b/rest_api/src/models/literal_expression.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct LiteralExpression { #[serde(rename = "type")] @@ -22,7 +19,11 @@ pub struct LiteralExpression { } impl LiteralExpression { - pub fn new(r#type: String, term: crate::models::Term, value: serde_json::Value) -> LiteralExpression { + pub fn new( + r#type: String, + term: crate::models::Term, + value: serde_json::Value, + ) -> LiteralExpression { LiteralExpression { r#type, term: Box::new(term), @@ -30,5 +31,3 @@ impl LiteralExpression { } } } - - diff --git a/rest_api/src/models/load_table_result.rs b/rest_api/src/models/load_table_result.rs index 37dccc0..8491ea8 100644 --- a/rest_api/src/models/load_table_result.rs +++ b/rest_api/src/models/load_table_result.rs @@ -4,13 +4,11 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ -/// LoadTableResult : Result used when a table is successfully loaded. The table metadata JSON is returned in the `metadata` field. The corresponding file location of table metadata should be returned in the `metadata-location` field, unless the metadata is not yet committed. For example, a create transaction may return metadata that is staged but not committed. Clients can check whether metadata has changed by comparing metadata locations after the table has been created. The `config` map returns table-specific configuration for the table's resources, including its HTTP client and FileIO. For example, config may contain a specific FileIO implementation class for the table depending on its underlying storage. The following configurations should be respected by clients: ## General Configurations - `token`: Authorization bearer token to use for table requests if OAuth2 security is enabled ## AWS Configurations The following configurations should be respected when working with tables stored in AWS S3 - `client.region`: region to configure client for making requests to AWS - `s3.access-key-id`: id for for credentials that provide access to the data in S3 - `s3.secret-access-key`: secret for credentials that provide access to data in S3 - `s3.session-token`: if present, this value should be used for as the session token - `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification - - +/// LoadTableResult : Result used when a table is successfully loaded. The table metadata JSON is returned in the `metadata` field. The corresponding file location of table metadata should be returned in the `metadata-location` field, unless the metadata is not yet committed. For example, a create transaction may return metadata that is staged but not committed. Clients can check whether metadata has changed by comparing metadata locations after the table has been created. The `config` map returns table-specific configuration for the table's resources, including its HTTP client and FileIO. For example, config may contain a specific FileIO implementation class for the table depending on its underlying storage. The following configurations should be respected by clients: ## General Configurations - `token`: Authorization bearer token to use for table requests if OAuth2 security is enabled ## AWS Configurations The following configurations should be respected when working with tables stored in AWS S3 - `client.region`: region to configure client for making requests to AWS - `s3.access-key-id`: id for for credentials that provide access to the data in S3 - `s3.secret-access-key`: secret for credentials that provide access to data in S3 - `s3.session-token`: if present, this value should be used for as the session token - `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct LoadTableResult { @@ -24,7 +22,7 @@ pub struct LoadTableResult { } impl LoadTableResult { - /// Result used when a table is successfully loaded. The table metadata JSON is returned in the `metadata` field. The corresponding file location of table metadata should be returned in the `metadata-location` field, unless the metadata is not yet committed. For example, a create transaction may return metadata that is staged but not committed. Clients can check whether metadata has changed by comparing metadata locations after the table has been created. The `config` map returns table-specific configuration for the table's resources, including its HTTP client and FileIO. For example, config may contain a specific FileIO implementation class for the table depending on its underlying storage. The following configurations should be respected by clients: ## General Configurations - `token`: Authorization bearer token to use for table requests if OAuth2 security is enabled ## AWS Configurations The following configurations should be respected when working with tables stored in AWS S3 - `client.region`: region to configure client for making requests to AWS - `s3.access-key-id`: id for for credentials that provide access to the data in S3 - `s3.secret-access-key`: secret for credentials that provide access to data in S3 - `s3.session-token`: if present, this value should be used for as the session token - `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification + /// Result used when a table is successfully loaded. The table metadata JSON is returned in the `metadata` field. The corresponding file location of table metadata should be returned in the `metadata-location` field, unless the metadata is not yet committed. For example, a create transaction may return metadata that is staged but not committed. Clients can check whether metadata has changed by comparing metadata locations after the table has been created. The `config` map returns table-specific configuration for the table's resources, including its HTTP client and FileIO. For example, config may contain a specific FileIO implementation class for the table depending on its underlying storage. The following configurations should be respected by clients: ## General Configurations - `token`: Authorization bearer token to use for table requests if OAuth2 security is enabled ## AWS Configurations The following configurations should be respected when working with tables stored in AWS S3 - `client.region`: region to configure client for making requests to AWS - `s3.access-key-id`: id for for credentials that provide access to the data in S3 - `s3.secret-access-key`: secret for credentials that provide access to data in S3 - `s3.session-token`: if present, this value should be used for as the session token - `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification pub fn new(metadata: crate::models::TableMetadata) -> LoadTableResult { LoadTableResult { metadata_location: None, @@ -33,5 +31,3 @@ impl LoadTableResult { } } } - - diff --git a/rest_api/src/models/map_type.rs b/rest_api/src/models/map_type.rs index 9c57f0c..38759bc 100644 --- a/rest_api/src/models/map_type.rs +++ b/rest_api/src/models/map_type.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct MapType { #[serde(rename = "type")] @@ -28,7 +25,14 @@ pub struct MapType { } impl MapType { - pub fn new(r#type: RHashType, key_id: i32, key: crate::models::Type, value_id: i32, value: crate::models::Type, value_required: bool) -> MapType { + pub fn new( + r#type: RHashType, + key_id: i32, + key: crate::models::Type, + value_id: i32, + value: crate::models::Type, + value_required: bool, + ) -> MapType { MapType { r#type, key_id, @@ -40,7 +44,7 @@ impl MapType { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "map")] @@ -52,4 +56,3 @@ impl Default for RHashType { Self::Map } } - diff --git a/rest_api/src/models/metadata_log_inner.rs b/rest_api/src/models/metadata_log_inner.rs index 6095e68..0742cd1 100644 --- a/rest_api/src/models/metadata_log_inner.rs +++ b/rest_api/src/models/metadata_log_inner.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct MetadataLogInner { #[serde(rename = "metadata-file")] @@ -27,5 +24,3 @@ impl MetadataLogInner { } } } - - diff --git a/rest_api/src/models/metric_result.rs b/rest_api/src/models/metric_result.rs index 8ecbadb..8b4f084 100644 --- a/rest_api/src/models/metric_result.rs +++ b/rest_api/src/models/metric_result.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct MetricResult { #[serde(rename = "unit")] @@ -26,7 +23,13 @@ pub struct MetricResult { } impl MetricResult { - pub fn new(unit: String, value: i64, time_unit: String, count: i64, total_duration: i64) -> MetricResult { + pub fn new( + unit: String, + value: i64, + time_unit: String, + count: i64, + total_duration: i64, + ) -> MetricResult { MetricResult { unit, value, @@ -36,5 +39,3 @@ impl MetricResult { } } } - - diff --git a/rest_api/src/models/model_type.rs b/rest_api/src/models/model_type.rs index 1ca1642..06febad 100644 --- a/rest_api/src/models/model_type.rs +++ b/rest_api/src/models/model_type.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct Type { #[serde(rename = "type")] @@ -36,7 +33,18 @@ pub struct Type { } impl Type { - pub fn new(r#type: RHashType, fields: Vec, element_id: i32, element: crate::models::Type, element_required: bool, key_id: i32, key: crate::models::Type, value_id: i32, value: crate::models::Type, value_required: bool) -> Type { + pub fn new( + r#type: RHashType, + fields: Vec, + element_id: i32, + element: crate::models::Type, + element_required: bool, + key_id: i32, + key: crate::models::Type, + value_id: i32, + value: crate::models::Type, + value_required: bool, + ) -> Type { Type { r#type, fields, @@ -52,7 +60,7 @@ impl Type { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "map")] @@ -64,4 +72,3 @@ impl Default for RHashType { Self::Map } } - diff --git a/rest_api/src/models/not_expression.rs b/rest_api/src/models/not_expression.rs index be5514d..013a99c 100644 --- a/rest_api/src/models/not_expression.rs +++ b/rest_api/src/models/not_expression.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct NotExpression { #[serde(rename = "type")] @@ -27,5 +24,3 @@ impl NotExpression { } } } - - diff --git a/rest_api/src/models/null_order.rs b/rest_api/src/models/null_order.rs index ee55898..b372390 100644 --- a/rest_api/src/models/null_order.rs +++ b/rest_api/src/models/null_order.rs @@ -4,19 +4,17 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum NullOrder { #[serde(rename = "nulls-first")] First, #[serde(rename = "nulls-last")] Last, - } impl ToString for NullOrder { @@ -33,7 +31,3 @@ impl Default for NullOrder { Self::First } } - - - - diff --git a/rest_api/src/models/o_auth_error.rs b/rest_api/src/models/o_auth_error.rs index f1112af..e627e6e 100644 --- a/rest_api/src/models/o_auth_error.rs +++ b/rest_api/src/models/o_auth_error.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct OAuthError { #[serde(rename = "error")] @@ -31,7 +28,7 @@ impl OAuthError { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Error { #[serde(rename = "invalid_request")] @@ -53,4 +50,3 @@ impl Default for Error { Self::InvalidRequest } } - diff --git a/rest_api/src/models/o_auth_token_response.rs b/rest_api/src/models/o_auth_token_response.rs index d07f955..194268d 100644 --- a/rest_api/src/models/o_auth_token_response.rs +++ b/rest_api/src/models/o_auth_token_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct OAuthTokenResponse { /// The access token, for client credentials or token exchange @@ -61,4 +58,3 @@ impl Default for TokenType { Self::Bearer } } - diff --git a/rest_api/src/models/partition_field.rs b/rest_api/src/models/partition_field.rs index d91f581..1b1a1e4 100644 --- a/rest_api/src/models/partition_field.rs +++ b/rest_api/src/models/partition_field.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct PartitionField { #[serde(rename = "field-id", skip_serializing_if = "Option::is_none")] @@ -33,5 +30,3 @@ impl PartitionField { } } } - - diff --git a/rest_api/src/models/partition_spec.rs b/rest_api/src/models/partition_spec.rs index 99945d4..8fc25d0 100644 --- a/rest_api/src/models/partition_spec.rs +++ b/rest_api/src/models/partition_spec.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct PartitionSpec { #[serde(rename = "spec-id", skip_serializing_if = "Option::is_none")] @@ -27,5 +24,3 @@ impl PartitionSpec { } } } - - diff --git a/rest_api/src/models/remove_properties_update.rs b/rest_api/src/models/remove_properties_update.rs index 450d46d..a23bdef 100644 --- a/rest_api/src/models/remove_properties_update.rs +++ b/rest_api/src/models/remove_properties_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RemovePropertiesUpdate { #[serde(rename = "action")] @@ -21,14 +18,11 @@ pub struct RemovePropertiesUpdate { impl RemovePropertiesUpdate { pub fn new(action: Action, removals: Vec) -> RemovePropertiesUpdate { - RemovePropertiesUpdate { - action, - removals, - } + RemovePropertiesUpdate { action, removals } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +60,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/remove_properties_update_all_of.rs b/rest_api/src/models/remove_properties_update_all_of.rs index 6f7972a..2010da2 100644 --- a/rest_api/src/models/remove_properties_update_all_of.rs +++ b/rest_api/src/models/remove_properties_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RemovePropertiesUpdateAllOf { #[serde(rename = "removals")] @@ -19,10 +16,6 @@ pub struct RemovePropertiesUpdateAllOf { impl RemovePropertiesUpdateAllOf { pub fn new(removals: Vec) -> RemovePropertiesUpdateAllOf { - RemovePropertiesUpdateAllOf { - removals, - } + RemovePropertiesUpdateAllOf { removals } } } - - diff --git a/rest_api/src/models/remove_snapshot_ref_update.rs b/rest_api/src/models/remove_snapshot_ref_update.rs index 5f4910b..4d312f9 100644 --- a/rest_api/src/models/remove_snapshot_ref_update.rs +++ b/rest_api/src/models/remove_snapshot_ref_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RemoveSnapshotRefUpdate { #[serde(rename = "action")] @@ -21,14 +18,11 @@ pub struct RemoveSnapshotRefUpdate { impl RemoveSnapshotRefUpdate { pub fn new(action: Action, ref_name: String) -> RemoveSnapshotRefUpdate { - RemoveSnapshotRefUpdate { - action, - ref_name, - } + RemoveSnapshotRefUpdate { action, ref_name } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +60,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/remove_snapshots_update.rs b/rest_api/src/models/remove_snapshots_update.rs index 3750ce0..6cbcfc2 100644 --- a/rest_api/src/models/remove_snapshots_update.rs +++ b/rest_api/src/models/remove_snapshots_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RemoveSnapshotsUpdate { #[serde(rename = "action")] @@ -28,7 +25,7 @@ impl RemoveSnapshotsUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/remove_snapshots_update_all_of.rs b/rest_api/src/models/remove_snapshots_update_all_of.rs index 7d5c07a..bf2a48c 100644 --- a/rest_api/src/models/remove_snapshots_update_all_of.rs +++ b/rest_api/src/models/remove_snapshots_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RemoveSnapshotsUpdateAllOf { #[serde(rename = "snapshot-ids")] @@ -19,10 +16,6 @@ pub struct RemoveSnapshotsUpdateAllOf { impl RemoveSnapshotsUpdateAllOf { pub fn new(snapshot_ids: Vec) -> RemoveSnapshotsUpdateAllOf { - RemoveSnapshotsUpdateAllOf { - snapshot_ids, - } + RemoveSnapshotsUpdateAllOf { snapshot_ids } } } - - diff --git a/rest_api/src/models/rename_table_request.rs b/rest_api/src/models/rename_table_request.rs index 156f3c6..b4d50cb 100644 --- a/rest_api/src/models/rename_table_request.rs +++ b/rest_api/src/models/rename_table_request.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RenameTableRequest { #[serde(rename = "source")] @@ -20,12 +17,13 @@ pub struct RenameTableRequest { } impl RenameTableRequest { - pub fn new(source: crate::models::TableIdentifier, destination: crate::models::TableIdentifier) -> RenameTableRequest { + pub fn new( + source: crate::models::TableIdentifier, + destination: crate::models::TableIdentifier, + ) -> RenameTableRequest { RenameTableRequest { source: Box::new(source), destination: Box::new(destination), } } } - - diff --git a/rest_api/src/models/report_metrics_request.rs b/rest_api/src/models/report_metrics_request.rs index 165cd49..2a87afe 100644 --- a/rest_api/src/models/report_metrics_request.rs +++ b/rest_api/src/models/report_metrics_request.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ReportMetricsRequest { #[serde(rename = "report-type")] @@ -38,7 +35,18 @@ pub struct ReportMetricsRequest { } impl ReportMetricsRequest { - pub fn new(report_type: String, table_name: String, snapshot_id: i64, filter: crate::models::Expression, schema_id: i32, projected_field_ids: Vec, projected_field_names: Vec, metrics: ::std::collections::HashMap, sequence_number: i64, operation: String) -> ReportMetricsRequest { + pub fn new( + report_type: String, + table_name: String, + snapshot_id: i64, + filter: crate::models::Expression, + schema_id: i32, + projected_field_ids: Vec, + projected_field_names: Vec, + metrics: ::std::collections::HashMap, + sequence_number: i64, + operation: String, + ) -> ReportMetricsRequest { ReportMetricsRequest { report_type, table_name, @@ -54,5 +62,3 @@ impl ReportMetricsRequest { } } } - - diff --git a/rest_api/src/models/scan_report.rs b/rest_api/src/models/scan_report.rs index 2251415..7428933 100644 --- a/rest_api/src/models/scan_report.rs +++ b/rest_api/src/models/scan_report.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ScanReport { #[serde(rename = "table-name")] @@ -32,7 +29,15 @@ pub struct ScanReport { } impl ScanReport { - pub fn new(table_name: String, snapshot_id: i64, filter: crate::models::Expression, schema_id: i32, projected_field_ids: Vec, projected_field_names: Vec, metrics: ::std::collections::HashMap) -> ScanReport { + pub fn new( + table_name: String, + snapshot_id: i64, + filter: crate::models::Expression, + schema_id: i32, + projected_field_ids: Vec, + projected_field_names: Vec, + metrics: ::std::collections::HashMap, + ) -> ScanReport { ScanReport { table_name, snapshot_id, @@ -45,5 +50,3 @@ impl ScanReport { } } } - - diff --git a/rest_api/src/models/schema.rs b/rest_api/src/models/schema.rs index 5a00cae..2c06f9e 100644 --- a/rest_api/src/models/schema.rs +++ b/rest_api/src/models/schema.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct Schema { #[serde(rename = "type")] @@ -19,7 +16,10 @@ pub struct Schema { pub fields: Vec, #[serde(rename = "schema-id", skip_serializing_if = "Option::is_none")] pub schema_id: Option, - #[serde(rename = "identifier-field-ids", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "identifier-field-ids", + skip_serializing_if = "Option::is_none" + )] pub identifier_field_ids: Option>, } @@ -34,7 +34,7 @@ impl Schema { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "struct")] @@ -46,4 +46,3 @@ impl Default for RHashType { Self::Struct } } - diff --git a/rest_api/src/models/schema_all_of.rs b/rest_api/src/models/schema_all_of.rs index 8da02cf..50fec36 100644 --- a/rest_api/src/models/schema_all_of.rs +++ b/rest_api/src/models/schema_all_of.rs @@ -4,18 +4,18 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SchemaAllOf { #[serde(rename = "schema-id", skip_serializing_if = "Option::is_none")] pub schema_id: Option, - #[serde(rename = "identifier-field-ids", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "identifier-field-ids", + skip_serializing_if = "Option::is_none" + )] pub identifier_field_ids: Option>, } @@ -27,5 +27,3 @@ impl SchemaAllOf { } } } - - diff --git a/rest_api/src/models/set_current_schema_update.rs b/rest_api/src/models/set_current_schema_update.rs index 39f8f74..268e0bb 100644 --- a/rest_api/src/models/set_current_schema_update.rs +++ b/rest_api/src/models/set_current_schema_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetCurrentSchemaUpdate { #[serde(rename = "action")] @@ -22,14 +19,11 @@ pub struct SetCurrentSchemaUpdate { impl SetCurrentSchemaUpdate { pub fn new(action: Action, schema_id: i32) -> SetCurrentSchemaUpdate { - SetCurrentSchemaUpdate { - action, - schema_id, - } + SetCurrentSchemaUpdate { action, schema_id } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -67,4 +61,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/set_current_schema_update_all_of.rs b/rest_api/src/models/set_current_schema_update_all_of.rs index 4ac1843..82ba330 100644 --- a/rest_api/src/models/set_current_schema_update_all_of.rs +++ b/rest_api/src/models/set_current_schema_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetCurrentSchemaUpdateAllOf { /// Schema ID to set as current, or -1 to set last added schema @@ -20,10 +17,6 @@ pub struct SetCurrentSchemaUpdateAllOf { impl SetCurrentSchemaUpdateAllOf { pub fn new(schema_id: i32) -> SetCurrentSchemaUpdateAllOf { - SetCurrentSchemaUpdateAllOf { - schema_id, - } + SetCurrentSchemaUpdateAllOf { schema_id } } } - - diff --git a/rest_api/src/models/set_default_sort_order_update.rs b/rest_api/src/models/set_default_sort_order_update.rs index 6d4e6e7..9e54afe 100644 --- a/rest_api/src/models/set_default_sort_order_update.rs +++ b/rest_api/src/models/set_default_sort_order_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetDefaultSortOrderUpdate { #[serde(rename = "action")] @@ -29,7 +26,7 @@ impl SetDefaultSortOrderUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -67,4 +64,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/set_default_sort_order_update_all_of.rs b/rest_api/src/models/set_default_sort_order_update_all_of.rs index 0d9c0ec..aa6999f 100644 --- a/rest_api/src/models/set_default_sort_order_update_all_of.rs +++ b/rest_api/src/models/set_default_sort_order_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetDefaultSortOrderUpdateAllOf { /// Sort order ID to set as the default, or -1 to set last added sort order @@ -20,10 +17,6 @@ pub struct SetDefaultSortOrderUpdateAllOf { impl SetDefaultSortOrderUpdateAllOf { pub fn new(sort_order_id: i32) -> SetDefaultSortOrderUpdateAllOf { - SetDefaultSortOrderUpdateAllOf { - sort_order_id, - } + SetDefaultSortOrderUpdateAllOf { sort_order_id } } } - - diff --git a/rest_api/src/models/set_default_spec_update.rs b/rest_api/src/models/set_default_spec_update.rs index 0f8b558..6e24b8a 100644 --- a/rest_api/src/models/set_default_spec_update.rs +++ b/rest_api/src/models/set_default_spec_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetDefaultSpecUpdate { #[serde(rename = "action")] @@ -22,14 +19,11 @@ pub struct SetDefaultSpecUpdate { impl SetDefaultSpecUpdate { pub fn new(action: Action, spec_id: i32) -> SetDefaultSpecUpdate { - SetDefaultSpecUpdate { - action, - spec_id, - } + SetDefaultSpecUpdate { action, spec_id } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -67,4 +61,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/set_default_spec_update_all_of.rs b/rest_api/src/models/set_default_spec_update_all_of.rs index 472f8ec..6d66bd4 100644 --- a/rest_api/src/models/set_default_spec_update_all_of.rs +++ b/rest_api/src/models/set_default_spec_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetDefaultSpecUpdateAllOf { /// Partition spec ID to set as the default, or -1 to set last added spec @@ -20,10 +17,6 @@ pub struct SetDefaultSpecUpdateAllOf { impl SetDefaultSpecUpdateAllOf { pub fn new(spec_id: i32) -> SetDefaultSpecUpdateAllOf { - SetDefaultSpecUpdateAllOf { - spec_id, - } + SetDefaultSpecUpdateAllOf { spec_id } } } - - diff --git a/rest_api/src/models/set_expression.rs b/rest_api/src/models/set_expression.rs index 41b4be5..287e5c9 100644 --- a/rest_api/src/models/set_expression.rs +++ b/rest_api/src/models/set_expression.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetExpression { #[serde(rename = "type")] @@ -22,7 +19,11 @@ pub struct SetExpression { } impl SetExpression { - pub fn new(r#type: String, term: crate::models::Term, values: Vec) -> SetExpression { + pub fn new( + r#type: String, + term: crate::models::Term, + values: Vec, + ) -> SetExpression { SetExpression { r#type, term: Box::new(term), @@ -30,5 +31,3 @@ impl SetExpression { } } } - - diff --git a/rest_api/src/models/set_location_update.rs b/rest_api/src/models/set_location_update.rs index 117a2a5..db9046c 100644 --- a/rest_api/src/models/set_location_update.rs +++ b/rest_api/src/models/set_location_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetLocationUpdate { #[serde(rename = "action")] @@ -21,14 +18,11 @@ pub struct SetLocationUpdate { impl SetLocationUpdate { pub fn new(action: Action, location: String) -> SetLocationUpdate { - SetLocationUpdate { - action, - location, - } + SetLocationUpdate { action, location } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +60,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/set_location_update_all_of.rs b/rest_api/src/models/set_location_update_all_of.rs index 85375b9..6e5404e 100644 --- a/rest_api/src/models/set_location_update_all_of.rs +++ b/rest_api/src/models/set_location_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetLocationUpdateAllOf { #[serde(rename = "location")] @@ -19,10 +16,6 @@ pub struct SetLocationUpdateAllOf { impl SetLocationUpdateAllOf { pub fn new(location: String) -> SetLocationUpdateAllOf { - SetLocationUpdateAllOf { - location, - } + SetLocationUpdateAllOf { location } } } - - diff --git a/rest_api/src/models/set_properties_update.rs b/rest_api/src/models/set_properties_update.rs index b8f5810..cf1fdf8 100644 --- a/rest_api/src/models/set_properties_update.rs +++ b/rest_api/src/models/set_properties_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetPropertiesUpdate { #[serde(rename = "action")] @@ -20,15 +17,15 @@ pub struct SetPropertiesUpdate { } impl SetPropertiesUpdate { - pub fn new(action: Action, updates: ::std::collections::HashMap) -> SetPropertiesUpdate { - SetPropertiesUpdate { - action, - updates, - } + pub fn new( + action: Action, + updates: ::std::collections::HashMap, + ) -> SetPropertiesUpdate { + SetPropertiesUpdate { action, updates } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/set_properties_update_all_of.rs b/rest_api/src/models/set_properties_update_all_of.rs index f81239f..4234e28 100644 --- a/rest_api/src/models/set_properties_update_all_of.rs +++ b/rest_api/src/models/set_properties_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetPropertiesUpdateAllOf { #[serde(rename = "updates")] @@ -19,10 +16,6 @@ pub struct SetPropertiesUpdateAllOf { impl SetPropertiesUpdateAllOf { pub fn new(updates: ::std::collections::HashMap) -> SetPropertiesUpdateAllOf { - SetPropertiesUpdateAllOf { - updates, - } + SetPropertiesUpdateAllOf { updates } } } - - diff --git a/rest_api/src/models/set_snapshot_ref_update.rs b/rest_api/src/models/set_snapshot_ref_update.rs index 879fd83..b96361d 100644 --- a/rest_api/src/models/set_snapshot_ref_update.rs +++ b/rest_api/src/models/set_snapshot_ref_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetSnapshotRefUpdate { #[serde(rename = "action")] @@ -21,16 +18,27 @@ pub struct SetSnapshotRefUpdate { pub snapshot_id: i64, #[serde(rename = "max-ref-age-ms", skip_serializing_if = "Option::is_none")] pub max_ref_age_ms: Option, - #[serde(rename = "max-snapshot-age-ms", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "max-snapshot-age-ms", + skip_serializing_if = "Option::is_none" + )] pub max_snapshot_age_ms: Option, - #[serde(rename = "min-snapshots-to-keep", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "min-snapshots-to-keep", + skip_serializing_if = "Option::is_none" + )] pub min_snapshots_to_keep: Option, #[serde(rename = "ref-name")] pub ref_name: String, } impl SetSnapshotRefUpdate { - pub fn new(action: Action, r#type: RHashType, snapshot_id: i64, ref_name: String) -> SetSnapshotRefUpdate { + pub fn new( + action: Action, + r#type: RHashType, + snapshot_id: i64, + ref_name: String, + ) -> SetSnapshotRefUpdate { SetSnapshotRefUpdate { action, r#type, @@ -43,7 +51,7 @@ impl SetSnapshotRefUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -81,7 +89,7 @@ impl Default for Action { Self::UpgradeFormatVersion } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "tag")] @@ -95,4 +103,3 @@ impl Default for RHashType { Self::Tag } } - diff --git a/rest_api/src/models/set_snapshot_ref_update_all_of.rs b/rest_api/src/models/set_snapshot_ref_update_all_of.rs index 45282a8..a19e9bd 100644 --- a/rest_api/src/models/set_snapshot_ref_update_all_of.rs +++ b/rest_api/src/models/set_snapshot_ref_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SetSnapshotRefUpdateAllOf { #[serde(rename = "ref-name")] @@ -19,10 +16,6 @@ pub struct SetSnapshotRefUpdateAllOf { impl SetSnapshotRefUpdateAllOf { pub fn new(ref_name: String) -> SetSnapshotRefUpdateAllOf { - SetSnapshotRefUpdateAllOf { - ref_name, - } + SetSnapshotRefUpdateAllOf { ref_name } } } - - diff --git a/rest_api/src/models/snapshot.rs b/rest_api/src/models/snapshot.rs index d4de3ee..5dc5d71 100644 --- a/rest_api/src/models/snapshot.rs +++ b/rest_api/src/models/snapshot.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct Snapshot { #[serde(rename = "snapshot-id")] @@ -31,7 +28,12 @@ pub struct Snapshot { } impl Snapshot { - pub fn new(snapshot_id: i64, timestamp_ms: i64, manifest_list: String, summary: crate::models::SnapshotSummary) -> Snapshot { + pub fn new( + snapshot_id: i64, + timestamp_ms: i64, + manifest_list: String, + summary: crate::models::SnapshotSummary, + ) -> Snapshot { Snapshot { snapshot_id, parent_snapshot_id: None, @@ -43,5 +45,3 @@ impl Snapshot { } } } - - diff --git a/rest_api/src/models/snapshot_log_inner.rs b/rest_api/src/models/snapshot_log_inner.rs index f5b6b9c..d654cb5 100644 --- a/rest_api/src/models/snapshot_log_inner.rs +++ b/rest_api/src/models/snapshot_log_inner.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SnapshotLogInner { #[serde(rename = "snapshot-id")] @@ -27,5 +24,3 @@ impl SnapshotLogInner { } } } - - diff --git a/rest_api/src/models/snapshot_reference.rs b/rest_api/src/models/snapshot_reference.rs index bc1514d..9ea123f 100644 --- a/rest_api/src/models/snapshot_reference.rs +++ b/rest_api/src/models/snapshot_reference.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SnapshotReference { #[serde(rename = "type")] @@ -19,9 +16,15 @@ pub struct SnapshotReference { pub snapshot_id: i64, #[serde(rename = "max-ref-age-ms", skip_serializing_if = "Option::is_none")] pub max_ref_age_ms: Option, - #[serde(rename = "max-snapshot-age-ms", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "max-snapshot-age-ms", + skip_serializing_if = "Option::is_none" + )] pub max_snapshot_age_ms: Option, - #[serde(rename = "min-snapshots-to-keep", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "min-snapshots-to-keep", + skip_serializing_if = "Option::is_none" + )] pub min_snapshots_to_keep: Option, } @@ -37,7 +40,7 @@ impl SnapshotReference { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "tag")] @@ -51,4 +54,3 @@ impl Default for RHashType { Self::Tag } } - diff --git a/rest_api/src/models/snapshot_summary.rs b/rest_api/src/models/snapshot_summary.rs index 5101502..44ce828 100644 --- a/rest_api/src/models/snapshot_summary.rs +++ b/rest_api/src/models/snapshot_summary.rs @@ -4,18 +4,18 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SnapshotSummary { #[serde(rename = "operation")] pub operation: Operation, - #[serde(rename = "additionalProperties", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "additionalProperties", + skip_serializing_if = "Option::is_none" + )] pub additional_properties: Option, } @@ -28,7 +28,7 @@ impl SnapshotSummary { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Operation { #[serde(rename = "append")] @@ -46,4 +46,3 @@ impl Default for Operation { Self::Append } } - diff --git a/rest_api/src/models/sort_direction.rs b/rest_api/src/models/sort_direction.rs index 138ed10..6d59988 100644 --- a/rest_api/src/models/sort_direction.rs +++ b/rest_api/src/models/sort_direction.rs @@ -4,19 +4,17 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum SortDirection { #[serde(rename = "asc")] Asc, #[serde(rename = "desc")] Desc, - } impl ToString for SortDirection { @@ -33,7 +31,3 @@ impl Default for SortDirection { Self::Asc } } - - - - diff --git a/rest_api/src/models/sort_field.rs b/rest_api/src/models/sort_field.rs index 252e1fb..9072b5d 100644 --- a/rest_api/src/models/sort_field.rs +++ b/rest_api/src/models/sort_field.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SortField { #[serde(rename = "source-id")] @@ -24,7 +21,12 @@ pub struct SortField { } impl SortField { - pub fn new(source_id: i32, transform: String, direction: crate::models::SortDirection, null_order: crate::models::NullOrder) -> SortField { + pub fn new( + source_id: i32, + transform: String, + direction: crate::models::SortDirection, + null_order: crate::models::NullOrder, + ) -> SortField { SortField { source_id, transform, @@ -33,5 +35,3 @@ impl SortField { } } } - - diff --git a/rest_api/src/models/sort_order.rs b/rest_api/src/models/sort_order.rs index d411404..d8d8c7c 100644 --- a/rest_api/src/models/sort_order.rs +++ b/rest_api/src/models/sort_order.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct SortOrder { #[serde(rename = "order-id")] @@ -21,11 +18,6 @@ pub struct SortOrder { impl SortOrder { pub fn new(order_id: i32, fields: Vec) -> SortOrder { - SortOrder { - order_id, - fields, - } + SortOrder { order_id, fields } } } - - diff --git a/rest_api/src/models/struct_field.rs b/rest_api/src/models/struct_field.rs index 350801b..754383f 100644 --- a/rest_api/src/models/struct_field.rs +++ b/rest_api/src/models/struct_field.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct StructField { #[serde(rename = "id")] @@ -36,5 +33,3 @@ impl StructField { } } } - - diff --git a/rest_api/src/models/struct_type.rs b/rest_api/src/models/struct_type.rs index d1975ca..b5e86b5 100644 --- a/rest_api/src/models/struct_type.rs +++ b/rest_api/src/models/struct_type.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct StructType { #[serde(rename = "type")] @@ -21,14 +18,11 @@ pub struct StructType { impl StructType { pub fn new(r#type: RHashType, fields: Vec) -> StructType { - StructType { - r#type, - fields, - } + StructType { r#type, fields } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "struct")] @@ -40,4 +34,3 @@ impl Default for RHashType { Self::Struct } } - diff --git a/rest_api/src/models/table_identifier.rs b/rest_api/src/models/table_identifier.rs index 419fb98..d4d88c0 100644 --- a/rest_api/src/models/table_identifier.rs +++ b/rest_api/src/models/table_identifier.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct TableIdentifier { /// Reference to one or more levels of a namespace @@ -22,11 +19,6 @@ pub struct TableIdentifier { impl TableIdentifier { pub fn new(namespace: Vec, name: String) -> TableIdentifier { - TableIdentifier { - namespace, - name, - } + TableIdentifier { namespace, name } } } - - diff --git a/rest_api/src/models/table_metadata.rs b/rest_api/src/models/table_metadata.rs index 4b8b336..85d2bd7 100644 --- a/rest_api/src/models/table_metadata.rs +++ b/rest_api/src/models/table_metadata.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct TableMetadata { #[serde(rename = "format-version")] @@ -37,13 +34,19 @@ pub struct TableMetadata { pub last_partition_id: Option, #[serde(rename = "sort-orders", skip_serializing_if = "Option::is_none")] pub sort_orders: Option>, - #[serde(rename = "default-sort-order-id", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "default-sort-order-id", + skip_serializing_if = "Option::is_none" + )] pub default_sort_order_id: Option, #[serde(rename = "snapshots", skip_serializing_if = "Option::is_none")] pub snapshots: Option>, #[serde(rename = "refs", skip_serializing_if = "Option::is_none")] pub refs: Option<::std::collections::HashMap>, - #[serde(rename = "current-snapshot-id", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "current-snapshot-id", + skip_serializing_if = "Option::is_none" + )] pub current_snapshot_id: Option, #[serde(rename = "snapshot-log", skip_serializing_if = "Option::is_none")] pub snapshot_log: Option>, @@ -75,5 +78,3 @@ impl TableMetadata { } } } - - diff --git a/rest_api/src/models/table_requirement.rs b/rest_api/src/models/table_requirement.rs index 689884a..2c34a77 100644 --- a/rest_api/src/models/table_requirement.rs +++ b/rest_api/src/models/table_requirement.rs @@ -4,14 +4,12 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ /// TableRequirement : Assertions from the client that must be valid for the commit to succeed. Assertions are identified by `type` - - `assert-create` - the table must not already exist; used for create transactions - `assert-table-uuid` - the table UUID must match the requirement's `uuid` - `assert-ref-snapshot-id` - the table branch or tag identified by the requirement's `ref` must reference the requirement's `snapshot-id`; if `snapshot-id` is `null` or missing, the ref must not already exist - `assert-last-assigned-field-id` - the table's last assigned column id must match the requirement's `last-assigned-field-id` - `assert-current-schema-id` - the table's current schema id must match the requirement's `current-schema-id` - `assert-last-assigned-partition-id` - the table's last assigned partition id must match the requirement's `last-assigned-partition-id` - `assert-default-spec-id` - the table's default spec id must match the requirement's `default-spec-id` - `assert-default-sort-order-id` - the table's default sort order id must match the requirement's `default-sort-order-id` - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct TableRequirement { #[serde(rename = "requirement")] @@ -22,15 +20,24 @@ pub struct TableRequirement { pub uuid: Option, #[serde(rename = "snapshot-id", skip_serializing_if = "Option::is_none")] pub snapshot_id: Option, - #[serde(rename = "last-assigned-field-id", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "last-assigned-field-id", + skip_serializing_if = "Option::is_none" + )] pub last_assigned_field_id: Option, #[serde(rename = "current-schema-id", skip_serializing_if = "Option::is_none")] pub current_schema_id: Option, - #[serde(rename = "last-assigned-partition-id", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "last-assigned-partition-id", + skip_serializing_if = "Option::is_none" + )] pub last_assigned_partition_id: Option, #[serde(rename = "default-spec-id", skip_serializing_if = "Option::is_none")] pub default_spec_id: Option, - #[serde(rename = "default-sort-order-id", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "default-sort-order-id", + skip_serializing_if = "Option::is_none" + )] pub default_sort_order_id: Option, } @@ -51,7 +58,7 @@ impl TableRequirement { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Requirement { #[serde(rename = "assert-create")] @@ -77,4 +84,3 @@ impl Default for Requirement { Self::Create } } - diff --git a/rest_api/src/models/table_update.rs b/rest_api/src/models/table_update.rs index 7b35df3..fe9ff12 100644 --- a/rest_api/src/models/table_update.rs +++ b/rest_api/src/models/table_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct TableUpdate { #[serde(rename = "action")] @@ -40,9 +37,15 @@ pub struct TableUpdate { pub snapshot_id: i64, #[serde(rename = "max-ref-age-ms", skip_serializing_if = "Option::is_none")] pub max_ref_age_ms: Option, - #[serde(rename = "max-snapshot-age-ms", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "max-snapshot-age-ms", + skip_serializing_if = "Option::is_none" + )] pub max_snapshot_age_ms: Option, - #[serde(rename = "min-snapshots-to-keep", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "min-snapshots-to-keep", + skip_serializing_if = "Option::is_none" + )] pub min_snapshots_to_keep: Option, #[serde(rename = "ref-name")] pub ref_name: String, @@ -57,7 +60,24 @@ pub struct TableUpdate { } impl TableUpdate { - pub fn new(action: Action, format_version: i32, schema: crate::models::Schema, schema_id: i32, spec: crate::models::PartitionSpec, spec_id: i32, sort_order: crate::models::SortOrder, sort_order_id: i32, snapshot: crate::models::Snapshot, r#type: RHashType, snapshot_id: i64, ref_name: String, snapshot_ids: Vec, location: String, updates: ::std::collections::HashMap, removals: Vec) -> TableUpdate { + pub fn new( + action: Action, + format_version: i32, + schema: crate::models::Schema, + schema_id: i32, + spec: crate::models::PartitionSpec, + spec_id: i32, + sort_order: crate::models::SortOrder, + sort_order_id: i32, + snapshot: crate::models::Snapshot, + r#type: RHashType, + snapshot_id: i64, + ref_name: String, + snapshot_ids: Vec, + location: String, + updates: ::std::collections::HashMap, + removals: Vec, + ) -> TableUpdate { TableUpdate { action, format_version, @@ -82,7 +102,7 @@ impl TableUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -120,7 +140,7 @@ impl Default for Action { Self::UpgradeFormatVersion } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "tag")] @@ -134,4 +154,3 @@ impl Default for RHashType { Self::Tag } } - diff --git a/rest_api/src/models/term.rs b/rest_api/src/models/term.rs index e09a650..9cfcba4 100644 --- a/rest_api/src/models/term.rs +++ b/rest_api/src/models/term.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct Term { #[serde(rename = "type")] @@ -31,7 +28,7 @@ impl Term { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "transform")] @@ -43,4 +40,3 @@ impl Default for RHashType { Self::Transform } } - diff --git a/rest_api/src/models/timer_result.rs b/rest_api/src/models/timer_result.rs index 1c59463..8eb1fe2 100644 --- a/rest_api/src/models/timer_result.rs +++ b/rest_api/src/models/timer_result.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct TimerResult { #[serde(rename = "time-unit")] @@ -30,5 +27,3 @@ impl TimerResult { } } } - - diff --git a/rest_api/src/models/token_type.rs b/rest_api/src/models/token_type.rs index eab51ed..d795952 100644 --- a/rest_api/src/models/token_type.rs +++ b/rest_api/src/models/token_type.rs @@ -4,7 +4,7 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,7 +25,6 @@ pub enum TokenType { Saml2, #[serde(rename = "urn:ietf:params:oauth:token-type:jwt")] Jwt, - } impl ToString for TokenType { @@ -46,7 +45,3 @@ impl Default for TokenType { Self::AccessToken } } - - - - diff --git a/rest_api/src/models/transform_term.rs b/rest_api/src/models/transform_term.rs index bb579f6..fd8f286 100644 --- a/rest_api/src/models/transform_term.rs +++ b/rest_api/src/models/transform_term.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct TransformTerm { #[serde(rename = "type")] @@ -31,7 +28,7 @@ impl TransformTerm { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum RHashType { #[serde(rename = "transform")] @@ -43,4 +40,3 @@ impl Default for RHashType { Self::Transform } } - diff --git a/rest_api/src/models/unary_expression.rs b/rest_api/src/models/unary_expression.rs index 7a54eb9..1a50f7f 100644 --- a/rest_api/src/models/unary_expression.rs +++ b/rest_api/src/models/unary_expression.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct UnaryExpression { #[serde(rename = "type")] @@ -22,7 +19,11 @@ pub struct UnaryExpression { } impl UnaryExpression { - pub fn new(r#type: String, term: crate::models::Term, value: serde_json::Value) -> UnaryExpression { + pub fn new( + r#type: String, + term: crate::models::Term, + value: serde_json::Value, + ) -> UnaryExpression { UnaryExpression { r#type, term: Box::new(term), @@ -30,5 +31,3 @@ impl UnaryExpression { } } } - - diff --git a/rest_api/src/models/update_namespace_properties_request.rs b/rest_api/src/models/update_namespace_properties_request.rs index 7f143db..41008b1 100644 --- a/rest_api/src/models/update_namespace_properties_request.rs +++ b/rest_api/src/models/update_namespace_properties_request.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct UpdateNamespacePropertiesRequest { #[serde(rename = "removals", skip_serializing_if = "Option::is_none")] @@ -27,5 +24,3 @@ impl UpdateNamespacePropertiesRequest { } } } - - diff --git a/rest_api/src/models/update_namespace_properties_response.rs b/rest_api/src/models/update_namespace_properties_response.rs index 1aa4452..0a7dde5 100644 --- a/rest_api/src/models/update_namespace_properties_response.rs +++ b/rest_api/src/models/update_namespace_properties_response.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct UpdateNamespacePropertiesResponse { /// List of property keys that were added or updated @@ -20,7 +17,12 @@ pub struct UpdateNamespacePropertiesResponse { #[serde(rename = "removed")] pub removed: Vec, /// List of properties requested for removal that were not found in the namespace's properties. Represents a partial success response. Server's do not need to implement this. - #[serde(rename = "missing", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "missing", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub missing: Option>>, } @@ -33,5 +35,3 @@ impl UpdateNamespacePropertiesResponse { } } } - - diff --git a/rest_api/src/models/upgrade_format_version_update.rs b/rest_api/src/models/upgrade_format_version_update.rs index 3298832..48f74e7 100644 --- a/rest_api/src/models/upgrade_format_version_update.rs +++ b/rest_api/src/models/upgrade_format_version_update.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct UpgradeFormatVersionUpdate { #[serde(rename = "action")] @@ -28,7 +25,7 @@ impl UpgradeFormatVersionUpdate { } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Action { #[serde(rename = "upgrade-format-version")] @@ -66,4 +63,3 @@ impl Default for Action { Self::UpgradeFormatVersion } } - diff --git a/rest_api/src/models/upgrade_format_version_update_all_of.rs b/rest_api/src/models/upgrade_format_version_update_all_of.rs index df08ad5..d30048e 100644 --- a/rest_api/src/models/upgrade_format_version_update_all_of.rs +++ b/rest_api/src/models/upgrade_format_version_update_all_of.rs @@ -4,13 +4,10 @@ * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ - - - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct UpgradeFormatVersionUpdateAllOf { #[serde(rename = "format-version")] @@ -19,10 +16,6 @@ pub struct UpgradeFormatVersionUpdateAllOf { impl UpgradeFormatVersionUpdateAllOf { pub fn new(format_version: i32) -> UpgradeFormatVersionUpdateAllOf { - UpgradeFormatVersionUpdateAllOf { - format_version, - } + UpgradeFormatVersionUpdateAllOf { format_version } } } - - diff --git a/tests/integration/run.sh b/tests/integration/run.sh deleted file mode 100644 index a15797e..0000000 --- a/tests/integration/run.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -PROJ_DIR="$SCRIPT_DIR/../.." - -cd "$SCRIPT_DIR"/docker - -docker compose up -d --wait spark - -cd "$SCRIPT_DIR"/python -poetry update -poetry run python init.py -s sc://localhost:15002 -f "$SCRIPT_DIR"/testdata/insert1.csv - -"$PROJ_DIR"/target/debug/icelake-integration-tests \ - --s3-bucket icebergdata \ - --s3-endpoint http://localhost:9000 \ - --s3-username admin \ - --s3-password password \ - --s3-region us-east-1 \ - -t "demo/s1/t1" \ - -c "$SCRIPT_DIR"/testdata/insert2.csv - - - -cd "$SCRIPT_DIR"/python -poetry run python check.py -s sc://localhost:15002 -f "$SCRIPT_DIR"/testdata/query1.csv - -cd "$SCRIPT_DIR"/docker -docker compose down -v --remove-orphans diff --git a/tests/integration/rust/Cargo.toml b/tests/integration/rust/Cargo.toml index 1c59b37..201d172 100644 --- a/tests/integration/rust/Cargo.toml +++ b/tests/integration/rust/Cargo.toml @@ -14,4 +14,11 @@ opendal = { workspace = true } serde = { workspace = true } csv = { workspace = true } arrow = { workspace = true } -clap = { workspace = true } +confique = { workspace = true } +libtest-mimic = { workspace = true } +futures = { workspace = true } + +[[test]] +name = "integration-test" +path = "src/tests.rs" +harness = false \ No newline at end of file diff --git a/tests/integration/rust/src/append.rs b/tests/integration/rust/src/append.rs new file mode 100644 index 0000000..21ed046 --- /dev/null +++ b/tests/integration/rust/src/append.rs @@ -0,0 +1,197 @@ +//! This module contains append only tests. + +use arrow::csv::ReaderBuilder; +use arrow::datatypes::{DataType, Field, Schema}; +use arrow::record_batch::RecordBatch; +use confique::Config; +use icelake::transaction::Transaction; +use icelake::Table; +use opendal::services::S3; +use opendal::Operator; +use std::fs::File; +use std::path::Path; +use std::process::Command; +use std::sync::Arc; +use tokio::runtime::Builder; + +#[derive(Config, Debug)] +struct TestConfig { + s3_bucket: String, + s3_endpoint: String, + s3_username: String, + s3_password: String, + s3_region: String, + + table_path: String, + csv_file: String, + + spark_url: String, +} + +struct TestFixture { + args: TestConfig, +} + +impl TestFixture { + async fn write_data_with_icelake(&mut self) { + let mut table = create_icelake_table(&self.args).await; + log::info!( + "Real path of table is: {}", + table.current_table_metadata().location + ); + + let records = read_records_to_arrow(self.args.csv_file.as_str()); + + let mut task_writer = table.task_writer().await.unwrap(); + + for record_batch in &records { + log::info!( + "Insert record batch with {} records using icelake.", + record_batch.num_rows() + ); + task_writer.write(record_batch).await.unwrap(); + } + + let result = task_writer.close().await.unwrap(); + log::debug!("Insert {} data files: {:?}", result.len(), result); + + // Commit table transaction + { + let mut tx = Transaction::new(&mut table); + tx.append_file(result); + tx.commit().await.unwrap(); + } + } +} + +async fn prepare_env() -> TestFixture { + env_logger::init(); + + TestFixture { + args: Config::from_file(path_of("../testdata/config.toml")).unwrap(), + } +} + +async fn create_icelake_table(args: &TestConfig) -> Table { + let mut builder = S3::default(); + builder.root(args.table_path.as_str()); + builder.bucket(args.s3_bucket.as_str()); + builder.endpoint(args.s3_endpoint.as_str()); + builder.access_key_id(args.s3_username.as_str()); + builder.secret_access_key(args.s3_password.as_str()); + builder.region(args.s3_region.as_str()); + + let op = Operator::new(builder).unwrap().finish(); + Table::open_with_op(op).await.unwrap() +} + +fn read_records_to_arrow(filename: &str) -> Vec { + let schema = Schema::new(vec![ + Field::new("id", DataType::Int64, false), + Field::new("name", DataType::Utf8, false), + Field::new("distance", DataType::Int64, false), + ]); + + let csv_reader = ReaderBuilder::new(Arc::new(schema)) + .has_header(false) + .build(File::open(path_of(format!("../testdata/{}", filename))).unwrap()) + .unwrap(); + + csv_reader.map(|r| r.unwrap()).collect::>() +} + +fn run_command(mut cmd: Command, desc: impl ToString) { + let desc = desc.to_string(); + log::info!("Starting to {}, command: {:?}", &desc, cmd); + let exit = cmd.status().unwrap(); + if exit.success() { + log::info!("{} succeed!", desc.to_string()) + } else { + panic!("{} failed: {:?}", desc, exit); + } +} + +fn run_poetry_update() { + let mut cmd = Command::new("poetry"); + cmd.arg("update").current_dir(path_of("../python")); + + run_command(cmd, "poetry update") +} + +fn path_of>(relative_path: P) -> String { + Path::new(env!("CARGO_MANIFEST_DIR")) + .join(relative_path) + .to_str() + .unwrap() + .to_string() +} + +fn start_docker_compose() { + let mut cmd = Command::new("docker"); + cmd.args(["compose", "up", "-d", "--wait", "spark"]) + .current_dir(path_of("../docker")); + + run_command(cmd, "start docker compose"); +} + +fn init_iceberg_table_with_spark(config: &TestConfig) { + let mut cmd = Command::new("poetry"); + cmd.args([ + "run", + "python", + "init.py", + "-s", + config.spark_url.as_str(), + "-f", + path_of("../testdata/insert1.csv").as_str(), + ]) + .current_dir(path_of("../python")); + + run_command(cmd, "init iceberg table") +} + +fn check_iceberg_table_with_spark(config: &TestConfig) { + let mut cmd = Command::new("poetry"); + cmd.args([ + "run", + "python", + "check.py", + "-s", + config.spark_url.as_str(), + "-f", + path_of("../testdata/query1.csv").as_str(), + ]) + .current_dir(path_of("../python")); + + run_command(cmd, "check iceberg table") +} + +fn shutdown_docker_compose() { + let mut cmd = Command::new("docker"); + cmd.args(["compose", "down", "-v", "--remove-orphans"]) + .current_dir(path_of("../docker")); + + run_command(cmd, "shutdown docker compose"); +} + +async fn do_test_append_data() { + let mut fixture = prepare_env().await; + start_docker_compose(); + + run_poetry_update(); + init_iceberg_table_with_spark(&fixture.args); + + fixture.write_data_with_icelake().await; + + check_iceberg_table_with_spark(&fixture.args); + shutdown_docker_compose(); +} + +pub fn test_append_data() { + let rt = Builder::new_multi_thread() + .enable_all() + .worker_threads(1) + .build() + .unwrap(); + rt.block_on(async { do_test_append_data().await }); +} diff --git a/tests/integration/rust/src/lib.rs b/tests/integration/rust/src/lib.rs new file mode 100644 index 0000000..1b1a30a --- /dev/null +++ b/tests/integration/rust/src/lib.rs @@ -0,0 +1 @@ +pub mod append; diff --git a/tests/integration/rust/src/main.rs b/tests/integration/rust/src/main.rs deleted file mode 100644 index df6814c..0000000 --- a/tests/integration/rust/src/main.rs +++ /dev/null @@ -1,108 +0,0 @@ -use arrow::csv::ReaderBuilder; -use arrow::datatypes::{DataType, Field, Schema}; -use arrow::record_batch::RecordBatch; -use clap::Parser; -use icelake::transaction::Transaction; -use icelake::Table; -use opendal::services::S3; -use opendal::Operator; -use std::fs::File; -use std::sync::Arc; - -#[derive(Parser, Debug)] -struct Args { - #[arg(long)] - s3_bucket: String, - #[arg(long)] - s3_endpoint: String, - #[arg(long)] - s3_username: String, - #[arg(long)] - s3_password: String, - #[arg(long)] - s3_region: String, - - #[arg(short, long)] - table_path: String, - #[arg(short, long)] - csv_file: String, -} - -struct TestFixture { - args: Args, -} - -impl TestFixture { - async fn write_data_with_icelake(&mut self) { - let mut table = create_icelake_table(&self.args).await; - log::info!( - "Real path of table is: {}", - table.current_table_metadata().location - ); - - let records = read_records_to_arrow(self.args.csv_file.as_str()); - - let mut task_writer = table.task_writer().await.unwrap(); - - for record_batch in &records { - log::info!( - "Insert record batch with {} records using icelake.", - record_batch.num_rows() - ); - task_writer.write(record_batch).await.unwrap(); - } - - let result = task_writer.close().await.unwrap(); - log::debug!("Insert {} data files: {:?}", result.len(), result); - - // Commit table transaction - { - let mut tx = Transaction::new(&mut table); - tx.append_file(result); - tx.commit().await.unwrap(); - } - } -} - -async fn prepare_env() -> TestFixture { - env_logger::init(); - - TestFixture { - args: Args::parse(), - } -} - -async fn create_icelake_table(args: &Args) -> Table { - let mut builder = S3::default(); - builder.root(args.table_path.as_str()); - builder.bucket(args.s3_bucket.as_str()); - builder.endpoint(args.s3_endpoint.as_str()); - builder.access_key_id(args.s3_username.as_str()); - builder.secret_access_key(args.s3_password.as_str()); - builder.region(args.s3_region.as_str()); - - let op = Operator::new(builder).unwrap().finish(); - Table::open_with_op(op).await.unwrap() -} - -fn read_records_to_arrow(path: &str) -> Vec { - let schema = Schema::new(vec![ - Field::new("id", DataType::Int64, false), - Field::new("name", DataType::Utf8, false), - Field::new("distance", DataType::Int64, false), - ]); - - let csv_reader = ReaderBuilder::new(Arc::new(schema)) - .has_header(false) - .build(File::open(path).unwrap()) - .unwrap(); - - csv_reader.map(|r| r.unwrap()).collect::>() -} - -#[tokio::main] -async fn main() { - let mut fixture = prepare_env().await; - - fixture.write_data_with_icelake().await; -} diff --git a/tests/integration/rust/src/tests.rs b/tests/integration/rust/src/tests.rs new file mode 100644 index 0000000..6b601d5 --- /dev/null +++ b/tests/integration/rust/src/tests.rs @@ -0,0 +1,16 @@ +use icelake_integration_tests::append::test_append_data; +use libtest_mimic::{Arguments, Trial}; + +fn main() { + // Parse command line arguments + let args = Arguments::from_args(); + + // Create a list of tests and/or benchmarks (in this case: two dummy tests). + let tests = vec![Trial::test("test_append_data", move || { + test_append_data(); + Ok(()) + })]; + + // Run all tests and exit the application appropriatly. + libtest_mimic::run(&args, tests).exit(); +} diff --git a/tests/integration/testdata/config.toml b/tests/integration/testdata/config.toml new file mode 100644 index 0000000..4a9227b --- /dev/null +++ b/tests/integration/testdata/config.toml @@ -0,0 +1,8 @@ +spark_url="sc://localhost:15002" +s3_bucket="icebergdata" +s3_endpoint="http://localhost:9000" +s3_username="admin" +s3_password="password" +s3_region="us-east-1" +table_path="demo/s1/t1" +csv_file="insert2.csv"