Skip to content

Commit 64fd8e4

Browse files
committed
add catalog list with no prefix for rest catalog
1 parent cfdc769 commit 64fd8e4

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

catalogs/iceberg-rest-catalog/src/catalog.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,45 @@ impl CatalogList for RestCatalogList {
514514
}
515515
}
516516

517+
#[derive(Debug, Clone)]
518+
pub struct RestNoPrefixCatalogList {
519+
name: String,
520+
configuration: Configuration,
521+
object_store_builder: ObjectStoreBuilder,
522+
}
523+
524+
impl RestNoPrefixCatalogList {
525+
pub fn new(
526+
name: &str,
527+
configuration: Configuration,
528+
object_store_builder: ObjectStoreBuilder,
529+
) -> Self {
530+
Self {
531+
name: name.to_owned(),
532+
configuration,
533+
object_store_builder,
534+
}
535+
}
536+
}
537+
538+
#[async_trait]
539+
impl CatalogList for RestNoPrefixCatalogList {
540+
fn catalog(&self, name: &str) -> Option<Arc<dyn Catalog>> {
541+
if self.name == name {
542+
Some(Arc::new(RestCatalog::new(
543+
None,
544+
self.configuration.clone(),
545+
self.object_store_builder.clone(),
546+
)))
547+
} else {
548+
None
549+
}
550+
}
551+
async fn list_catalogs(&self) -> Vec<String> {
552+
vec![self.name.clone()]
553+
}
554+
}
555+
517556
#[cfg(test)]
518557
pub mod tests {
519558
use datafusion::{

0 commit comments

Comments
 (0)