Skip to content

[DISCUSS] A catalog loader api. #1228

Open
@liurenjie1024

Description

@liurenjie1024

When developing iceberg-playground and the integration test framework, I realized that it would be convenient to have a catalog loader api. I have following design in mind:

pub trait CatalogBuilder {
   type C: Catalog;
   fn with_name(self, name: &str) -> Self;
   fn with_uri(self, uri: &str) -> Self;
   fn with_warehouse(self, warehouse: &str) -> Self;
   fn with_prop(self, key: &str, value: &str) -> Self;
   fn build(self) -> Result<Self::C>;
}

And we need to have all catalogs to implement this trait:

pub struct RestCatalogBuilder {
  ...
}

impl CatalogBuilder for RestCatalogBuilder {
  ....
}

impl RestCatalogBuilder {
  fn with_rest_client(self, client: Client) -> Self {
  ...
 }
}

Then we will have a catalog loader api like this:

fn load_catalog(r#type: &str) -> CatalogBuilder {
  match r#type {
     "rest" => RestCatalogBuilder::new()
     "hive" => ....
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions