diff --git a/Cargo.lock b/Cargo.lock index 6813b8e..6bcba76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1269,9 +1269,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hotdata" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c29a358b8712bca80370acae8dda069752b58dc7599acfcdbc8c447b6f30e4b" +checksum = "25bf9c721f3c9b743281d5db8e4160f25f457aa31eaa22ef3c866c5837de4939" dependencies = [ "arrow-array", "arrow-buffer", diff --git a/Cargo.toml b/Cargo.toml index 3e13360..d6e4ae8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" # behind a shared multi-thread tokio runtime. The `arrow` feature backs result # decode; `upload_file` runs the presigned direct-to-storage upload flow # (see src/sdk.rs::Api::upload). -hotdata = { version = "0.21.0", features = ["arrow"] } +hotdata = { version = "0.23.0", features = ["arrow"] } # Shared multi-thread runtime for the sync wrapper; block_on is called # concurrently from rayon worker threads (see src/indexes.rs). The presigned # upload (src/sdk.rs::Api::upload) drives the SDK's async `upload_file` on this diff --git a/plugin/skills/hotdata/SKILL.md b/plugin/skills/hotdata/SKILL.md index b6b9ca8..c05e332 100644 --- a/plugin/skills/hotdata/SKILL.md +++ b/plugin/skills/hotdata/SKILL.md @@ -284,7 +284,7 @@ hotdata jobs list [--workspace-id ] [--job-type ] [--status hotdata jobs [--workspace-id ] [--output table|json|yaml] ``` - `list` shows only active jobs (`pending`, `running`) by default. Use `--all` to see all jobs. -- `--job-type`: `create_index`, `managed_load`, `database_fork`, `ivf_rebalance_sweep` (background IVF index rebalancing). (`database_fork` is accepted for forward compatibility; today a fork completes synchronously and records no job.) (`data_refresh_table` / `data_refresh_connection` were retired server-side — the engine is push-only; nothing refreshes.) +- `--job-type`: `create_index`, `managed_load`, `database_fork`, `ivf_rebalance_sweep` (background IVF index rebalancing), `rollup_build` (building a rollup), `rollup_refresh_sweep` (background rollup refresh). (`database_fork` is accepted for forward compatibility; today a fork completes synchronously and records no job.) (`data_refresh_table` / `data_refresh_connection` were retired server-side — the engine is push-only; nothing refreshes.) - `--status`: `pending`, `running`, `succeeded`, `partially_succeeded`, `failed`. - Use `hotdata jobs ` to inspect a specific job's status, error, and result. diff --git a/src/commands/jobs.rs b/src/commands/jobs.rs index 864d839..82dfc6f 100644 --- a/src/commands/jobs.rs +++ b/src/commands/jobs.rs @@ -8,7 +8,7 @@ pub enum JobsCommands { /// List background jobs (shows active jobs by default) List { /// Filter by job type - #[arg(long, value_parser = ["create_index", "managed_load", "database_fork", "ivf_rebalance_sweep"])] + #[arg(long, value_parser = ["create_index", "managed_load", "database_fork", "ivf_rebalance_sweep", "rollup_build", "rollup_refresh_sweep"])] job_type: Option, /// Filter by status @@ -75,6 +75,8 @@ fn parse_job_type(s: &str) -> Option { "managed_load" => Some(JobType::ManagedLoad), "database_fork" => Some(JobType::DatabaseFork), "ivf_rebalance_sweep" => Some(JobType::IvfRebalanceSweep), + "rollup_build" => Some(JobType::RollupBuild), + "rollup_refresh_sweep" => Some(JobType::RollupRefreshSweep), _ => None, } } @@ -257,4 +259,13 @@ mod tests { fn parse_job_type_accepts_managed_load() { assert_eq!(parse_job_type("managed_load"), Some(JobType::ManagedLoad)); } + + #[test] + fn parse_job_type_accepts_rollup_jobs() { + assert_eq!(parse_job_type("rollup_build"), Some(JobType::RollupBuild)); + assert_eq!( + parse_job_type("rollup_refresh_sweep"), + Some(JobType::RollupRefreshSweep) + ); + } } diff --git a/src/commands/queries.rs b/src/commands/queries.rs index 4ba67b0..88f955d 100644 --- a/src/commands/queries.rs +++ b/src/commands/queries.rs @@ -150,6 +150,9 @@ struct QueryRun { /// Rows read from storage before filtering/aggregation, distinct from /// `row_count` (rows returned). `None` when no table data was read. rows_scanned: Option, + /// Whether a rollup answered the query: `used`, `not_ready`, `not_matched` + /// or `unavailable`. `None` when no table the query read has a rollup. + rollup: Option, saved_query_id: Option, saved_query_version: Option, snapshot_id: String, @@ -175,6 +178,7 @@ impl From for QueryRun { row_count: r.row_count.flatten().map(|v| v.max(0) as u64), bytes_scanned: r.bytes_scanned.flatten().map(|v| v.max(0) as u64), rows_scanned: r.rows_scanned.flatten().map(|v| v.max(0) as u64), + rollup: r.rollup.flatten().map(|u| u.to_string()), saved_query_id: r.saved_query_id.flatten(), saved_query_version: r.saved_query_version.flatten().map(|v| v.max(0) as u64), snapshot_id: r.snapshot_id, @@ -320,6 +324,9 @@ fn print_detail(r: &QueryRun, format: &str) { if let Some(n) = r.bytes_scanned { println!("{}{}", label("bytes scanned:"), crate::util::human_bytes(n)); } + if let Some(ref usage) = r.rollup { + println!("{}{}", label("rollup:"), usage); + } if let Some(ref id) = r.result_id { println!("{}{}", label("result id:"), id); } @@ -392,6 +399,29 @@ mod tests { assert_eq!(json["rows_scanned"], 1000); } + /// The run record says whether a rollup answered the query; it must reach + /// the serialized output as the same string the API sends, and be null when + /// the API sends none. + #[test] + fn maps_rollup_outcome_from_wire_body() { + let body = |rollup: &str| { + format!( + r#"{{"id":"qrun_1","status":"succeeded", + "created_at":"2026-07-20T00:00:00Z", + "snapshot_id":"snap_1","sql_hash":"h","sql_text":"SELECT 1"{rollup}}}"# + ) + }; + let with: QueryRunInfo = serde_json::from_str(&body(r#","rollup":"not_matched""#)).unwrap(); + let run: QueryRun = with.into(); + assert_eq!(run.rollup.as_deref(), Some("not_matched")); + assert_eq!(serde_json::to_value(&run).unwrap()["rollup"], "not_matched"); + + let without: QueryRunInfo = serde_json::from_str(&body("")).unwrap(); + let run: QueryRun = without.into(); + assert_eq!(run.rollup, None); + assert!(serde_json::to_value(&run).unwrap()["rollup"].is_null()); + } + /// A constant-expression query (e.g. `SELECT 1`) reads no table, so the API /// omits the scanned fields; they map to `None` and serialize as null. #[test]