@mastra/clickhouse 1.25.1-alpha.1 → 1.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ name: mastra-clickhouse
3
3
  description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/clickhouse"
6
- version: "1.25.1-alpha.1"
6
+ version: "1.25.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.25.1-alpha.1",
2
+ "version": "1.25.1",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -12,18 +12,21 @@ Retention covers **growth tables** only: tables that accumulate rows unbounded a
12
12
 
13
13
  Storage adapters use the shared core retention contract for `prune()`, or a database-native mechanism when that better matches the backend.
14
14
 
15
- | Adapter | Mechanism | Retention support |
16
- | -------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
- | libSQL | `prune()` | All supported growth domains |
18
- | PostgreSQL | `prune()` | All supported growth domains. vNext observability drops expired partitions or chunks |
19
- | MongoDB | `prune()` or native TTL | All supported growth domains. Native TTL indexes are also available |
20
- | DuckDB | `prune()` | Observability spans, metrics, logs, scores, and feedback |
21
- | MySQL | `prune()` | Observability spans |
22
- | Microsoft SQL Server | `prune()` | Observability spans |
23
- | Oracle Database | `prune()` | Observability spans and logs |
24
- | Amazon Aurora DSQL | `prune()` | Observability spans |
25
- | Google Cloud Spanner | `prune()` | Observability spans, plus metrics when metrics storage is enabled |
26
- | ClickHouse | Native TTL | Observability spans, metrics, logs, scores, and feedback. When all five signals have finite retention, deletion-request records expire after the longest signal retention plus 30 days |
15
+ | Adapter | Mechanism | Retention support |
16
+ | --------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | libSQL | `prune()` | All supported growth domains |
18
+ | PostgreSQL | `prune()` | All supported growth domains. vNext observability drops expired partitions or chunks |
19
+ | MongoDB | `prune()` or native TTL | All supported growth domains. Native TTL indexes are also available |
20
+ | DuckDB | `prune()` | Observability spans, metrics, logs, scores, and feedback |
21
+ | MySQL | `prune()` | Observability spans, durable agent run fencing (`runOwnership`, `runFences`) |
22
+ | Microsoft SQL Server | `prune()` | Observability spans, durable agent run fencing (`runOwnership`, `runFences`) |
23
+ | Oracle Database | `prune()` | Observability spans and logs, durable agent run fencing (`runOwnership`, `runFences`) |
24
+ | Amazon Aurora DSQL | `prune()` | Observability spans, durable agent run fencing (`runOwnership`, `runFences`) |
25
+ | Google Cloud Spanner | `prune()` | Observability spans, plus metrics when metrics storage is enabled. Durable agent run fencing (`runOwnership`, `runFences`) |
26
+ | DynamoDB | `prune()` | Durable agent run fencing (`runOwnership`, `runFences`) |
27
+ | Convex | `prune()` | Durable agent run fencing (`runOwnership`, `runFences`). Redeploy your Convex functions after upgrading |
28
+ | Cloudflare D1 and Durable Objects | `prune()` | Durable agent run fencing (`runOwnership`, `runFences`) |
29
+ | ClickHouse | Native TTL | Observability spans, metrics, logs, scores, and feedback. When all five signals have finite retention, deletion-request records expire after the longest signal retention plus 30 days |
27
30
 
28
31
  ## Storage-specific maintenance
29
32
 
package/dist/index.cjs CHANGED
@@ -8109,7 +8109,13 @@ const COMPARISON_SQL = {
8109
8109
  */
8110
8110
  function compileClickHouseTraceAggregate(plan) {
8111
8111
  const parameters = new ParameterBuilder();
8112
- const ctes = compileClickHouseTraceCandidates(plan, "*", parameters);
8112
+ const ctes = compileClickHouseTraceCandidates(plan, "*", parameters, { oneRootPerTrace: true });
8113
+ ctes.push(`trace_roots AS (
8114
+ SELECT *
8115
+ FROM candidates
8116
+ ORDER BY traceId, dedupeKey
8117
+ LIMIT 1 BY traceId
8118
+ )`);
8113
8119
  const dimensionSql = (field) => {
8114
8120
  if (field.startsWith("metadata.")) return traceMetadataValueSql(parameters.add(field.slice(9), "String"));
8115
8121
  const sql = Object.hasOwn(DIMENSION_SQL, field) ? DIMENSION_SQL[field] : void 0;
@@ -8143,7 +8149,7 @@ function compileClickHouseTraceAggregate(plan) {
8143
8149
  }
8144
8150
  ctes.push(`facts AS (
8145
8151
  SELECT ${factColumns.join(",\n ")}
8146
- FROM candidates r${usageJoin}
8152
+ FROM trace_roots r${usageJoin}
8147
8153
  )`);
8148
8154
  const mixedUnitsSql = "minOrNull(unitMin) != maxOrNull(unitMax)";
8149
8155
  const measureSql = (name) => {