Skip to content

Commit

Permalink
feedback: use hash of map for comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
dhable committed Feb 20, 2025
1 parent d9bbaf8 commit dac30e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('renderChartConfig', () => {
' any(Attributes) OVER (ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS PrevAttributes,\n' +
' IF(AggregationTemporality = 1,\n' +
' Value,IF(Value - PrevValue < 0 AND Attributes = PrevAttributes,Value,\n' +
' IF(Attributes != PrevAttributes, 0, Value - PrevValue))) as Rate\n' +
' IF(cityHash64(Attributes) != cityHash64(PrevAttributes), 0, Value - PrevValue))) as Rate\n' +
' FROM (\n' +
' SELECT mapConcat(ScopeAttributes, ResourceAttributes, Attributes) AS Attributes, Value, MetricName, TimeUnix, AggregationTemporality\n' +
' FROM default.otel_metrics_sum\n' +
Expand Down
2 changes: 1 addition & 1 deletion packages/common-utils/src/renderChartConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ function translateMetricChartConfig(
any(Attributes) OVER (ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS PrevAttributes,
IF(AggregationTemporality = 1,
Value,IF(Value - PrevValue < 0 AND Attributes = PrevAttributes,Value,
IF(Attributes != PrevAttributes, 0, Value - PrevValue))) as Rate
IF(cityHash64(Attributes) != cityHash64(PrevAttributes), 0, Value - PrevValue))) as Rate
FROM (
SELECT mapConcat(ScopeAttributes, ResourceAttributes, Attributes) AS Attributes, Value, MetricName, TimeUnix, AggregationTemporality
FROM ${renderFrom({ from: { ...from, tableName: metricTables[MetricsDataType.Sum] } })}
Expand Down

0 comments on commit dac30e4

Please sign in to comment.