Skip to content

Incremental engine for long horizon agents 🌟 Star if you like it!

feat(rust-sdk): Doris TableTarget serializes, so mount_each! can take it (#2735)

LJ πŸ₯₯🌴56dbd3313b19
diff --git a/examples/rust/sec_edgar_analytics/src/main.rs b/examples/rust/sec_edgar_analytics/src/main.rs
index 69aa9074..6ec5ad1f 100644
--- a/examples/rust/sec_edgar_analytics/src/main.rs
+++ b/examples/rust/sec_edgar_analytics/src/main.rs
@@ -12,7 +12,7 @@
//! cargo run -- search "cybersecurity risk" [--source filing|facts]
//!
//! Parallels the Python example:
-//! - per-file compute : `ctx.mount_each` + `#[cocoindex::function]` (cf. `coco.mount_each`)
+//! - per-file compute : `mount_each!` + `#[cocoindex::function]` (cf. `coco.mount_each`)
//! - chunking : `cocoindex::ops::text::RecursiveSplitter` (cf. `RecursiveSplitter`)
//! - embeddings : `cocoindex::ops::sentence_transformers` all-MiniLM-L6-v2
//! - target : `doris::TableTarget` with `VectorIndexDef` + `InvertedIndexDef`
@@ -357,24 +357,13 @@ async fn app_main(ctx: Ctx, data_dir: PathBuf) -> Result<()> {
// Both source formats fan into the same table, one component per file.
let filing_table = table.clone();
- ctx.mount_each(
- filings,
- |(key, _)| format!("filing/{key}"),
- move |ctx, (_, file)| {
- let table = filing_table.clone();
- async move { process_filing(&ctx, file, table).await }
- },
- )
- .await?;
- ctx.mount_each(
- facts,
- |(key, _)| format!("facts/{key}"),
- move |ctx, (_, file)| {
- let table = table.clone();
- async move { process_facts(&ctx, file, table).await }
- },
- )
+ mount_each!("filing", filings, |file| process_filing(
+ ctx,
+ file,
+ filing_table
+ ))
.await?;
+ mount_each!("facts", facts, |file| process_facts(ctx, file, table)).await?;
Ok(())
}
diff --git a/rust/sdk/cocoindex/src/connectors/doris.rs b/rust/sdk/cocoindex/src/connectors/doris.rs
index 17f73774..b61db70c 100644
--- a/rust/sdk/cocoindex/src/connectors/doris.rs
+++ b/rust/sdk/cocoindex/src/connectors/doris.rs
@@ -650,10 +650,16 @@ pub struct DorisTableOptions {
// ---------------------------------------------------------------------------
/// A declarative Doris table target β€” a handle to declare rows on.
-#[derive(Clone)]
+///
+/// As a `mount_each!` / `use_mount!` argument it fingerprints by its table name
+/// (its stable key); the schema and runtime provider are not part of the
+/// component-memo identity.
+#[derive(Clone, Serialize)]
pub struct TableTarget {
table_name: Arc<str>,
+ #[serde(skip)]
table_schema: TableSchema,
+ #[serde(skip)]
rows: TargetStateProvider<RowState>,
}