{"record":{"id":"29faf2e06b9f2dd8","repo":"SigNoz/signoz","slug":"rate-is-not-supported-for-table-view","errorCode":null,"errorMessage":"rate is not supported for table view","messagePattern":"rate is not supported for table view","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/metrics/v3/cumulative_table.go","lineNumber":102,"sourceCode":"\n\tgroupByWithoutLe := groupBy(tagsWithoutLe...)\n\tgroupTagsWithoutLe := groupSelect(tagsWithoutLe...)\n\torderWithoutLe := orderBy(mq.OrderBy, tagsWithoutLe)\n\n\tgroupBy := groupByAttributeKeyTags(metricQueryGroupBy...)\n\tgroupTags := groupSelectAttributeKeyTags(metricQueryGroupBy...)\n\torderBy := orderByAttributeKeyTags(mq.OrderBy, metricQueryGroupBy)\n\n\tif len(orderBy) != 0 {\n\t\torderBy += \",\"\n\t}\n\tif len(orderWithoutLe) != 0 {\n\t\torderWithoutLe += \",\"\n\t}\n\n\tswitch mq.AggregateOperator {\n\tcase v3.AggregateOperatorRate:\n\t\treturn \"\", fmt.Errorf(\"rate is not supported for table view\")\n\tcase v3.AggregateOperatorSumRate, v3.AggregateOperatorAvgRate, v3.AggregateOperatorMaxRate, v3.AggregateOperatorMinRate:\n\t\trateGroupBy := \"fingerprint, \" + groupBy\n\t\trateGroupTags := \"fingerprint, \" + groupTags\n\t\trateOrderBy := \"fingerprint, \" + orderBy\n\t\tpartitionBy := \"fingerprint\"\n\t\tif len(groupTags) != 0 {\n\t\t\tpartitionBy += \", \" + groupTags\n\t\t\tpartitionBy = strings.Trim(partitionBy, \", \")\n\t\t}\n\t\top := \"max(value)\"\n\t\tsubQuery := fmt.Sprintf(\n\t\t\tqueryTmplCounterInner, rateGroupTags, step, op, filterSubQuery, rateGroupBy, rateOrderBy,\n\t\t) // labels will be same so any should be fine\n\t\tquery := `SELECT %s ts, ` + rateWithoutNegative + `as rate_value FROM(%s) WINDOW rate_window as (PARTITION BY %s ORDER BY %s ts)`\n\t\tquery = fmt.Sprintf(query, groupTags, subQuery, partitionBy, rateOrderBy)\n\t\tquery = fmt.Sprintf(`SELECT %s toStartOfHour(now()) as ts, %s(rate_value)/%d as value FROM (%s) WHERE isNaN(rate_value) = 0 GROUP BY %s ORDER BY %s ts`, groupTags, aggregateOperatorToSQLFunc[mq.AggregateOperator], points, query, groupBy, orderBy)\n\t\treturn query, nil\n\tcase","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/metrics/v3/cumulative_table.go#L84-L120","documentation":"When building a ClickHouse query for the cumulative table view (buildMetricQueryForTable, reached via PrepareMetricQuery), the aggregate operator 'rate' is explicitly rejected because a plain rate cannot be represented correctly in table form (table queries need per-series grouping that rate alone doesn't provide; use the *Rate variants which group by fingerprint). The API returns this error instead of producing an invalid query.","triggerScenarios":"A BuildQueryRequest/v3 metrics query with dataSource=metrics, queryType=table (or a panel switched to table view) and aggregateOperator: 'rate'. PrepareMetricQuery dispatches to the cumulative table builder and hits the AggregateOperatorRate case.","commonSituations":"Copying a graph panel's query (rate) into a table widget; switching visualization from chart to table without changing the aggregator; API clients hardcoding 'rate' for all panels; dashboards imported from other tools mapping per-second rates to 'rate'.","solutions":["Change the aggregate operator to sum_rate/min_rate/max_rate/avg_rate, which are supported in table view","If you need plain rate, use a graph/time-series query instead of table","Update dashboard JSON / saved API payloads so table panels never use 'rate'"],"exampleFix":"// before\n{\"aggregateOperator\":\"rate\",\"queryType\":\"table\"}\n// after\n{\"aggregateOperator\":\"sum_rate\",\"queryType\":\"table\"}","handlingStrategy":"type-guard","validationCode":"var tableSupported = map[string]bool{\"sum\":true,\"avg\":true,\"min\":true,\"max\":true,\"count\":true,\"count_distinct\":true,\"sum_rate\":true,\"avg_rate\":true,\"min_rate\":true,\"max_rate\":true}\nif queryType == \"table\" && !tableSupported[aggregateOperator] {\n  return fmt.Errorf(\"operator %q not supported in table view\", aggregateOperator)\n}","typeGuard":"func isTableSafeOperator(op string) bool { return !isTableView || tableSupported[op] }","tryCatchPattern":"On error from the metrics API, catch and suggest replacing 'rate' with 'sum_rate' for table panels; do not retry unchanged.","preventionTips":["Encode panel-type/operator compatibility rules in dashboard tooling","Default table panels to sum_rate instead of rate","Validate queries against the v3 API schema before save"],"tags":["signoz","metrics","clickhouse","aggregate-operator","table-view"],"backgroundTag":"unsupported-aggregate-operator","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}