Skip to main content

paimon_common/
lib.rs

1use arrow_array::RecordBatch;
2use async_trait::async_trait;
3use catalog_common::{
4    CatalogProvider, CommitOutcome, SecurityContext, TableIdent, TableSpec, WriteReceipt,
5};
6use snafu::Snafu;
7
8#[derive(Debug, Snafu)]
9pub enum PaimonError {
10    #[snafu(display("Paimon error: {message}"))]
11    Generic { message: String },
12}
13
14pub struct PaimonCatalogProvider;
15
16#[async_trait]
17impl CatalogProvider for PaimonCatalogProvider {
18    type Error = PaimonError;
19
20    async fn get_table_spec(&self, _table: &TableIdent) -> Result<TableSpec, Self::Error> {
21        Err(PaimonError::Generic {
22            message: "Paimon Rust client not available. Use Kafka bridge path.".to_string(),
23        })
24    }
25
26    async fn write_batch(
27        &self,
28        _table: &TableIdent,
29        _batch: RecordBatch,
30    ) -> Result<WriteReceipt, Self::Error> {
31        Err(PaimonError::Generic {
32            message: "Paimon Rust client not available. Use Kafka bridge path.".to_string(),
33        })
34    }
35
36    async fn commit(
37        &self,
38        _table: &TableIdent,
39        _receipts: Vec<WriteReceipt>,
40    ) -> Result<CommitOutcome, Self::Error> {
41        Err(PaimonError::Generic {
42            message: "Paimon Rust client not available. Use Kafka bridge path.".to_string(),
43        })
44    }
45
46    async fn get_security_context(
47        &self,
48        _table: &TableIdent,
49    ) -> Result<SecurityContext, Self::Error> {
50        Err(PaimonError::Generic {
51            message: "Paimon Rust client not available. Use Kafka bridge path.".to_string(),
52        })
53    }
54}