From 6fb6a576aa4cacdef9fd7bb6c9ad27318843ad1a Mon Sep 17 00:00:00 2001 From: Vishal Sharma Date: Thu, 5 May 2022 12:22:19 +0530 Subject: [PATCH] fix: lagInFrame and leadInFrame nullable (#1089) https://github.com/ClickHouse/ClickHouse/pull/26521 --- pkg/query-service/app/clickhouseReader/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index ba95aa2a30..7a93791333 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -2484,7 +2484,7 @@ func (r *ClickHouseReader) GetErrorForId(ctx context.Context, queryParams *model var getErrorWithSpanReponse []model.ErrorWithSpan // TODO: Optimize this query further - query := fmt.Sprintf("SELECT spanID, traceID, errorID, timestamp, serviceName, exceptionType, exceptionMessage, excepionStacktrace, exceptionEscaped, olderErrorId, newerErrorId FROM (SELECT *, lagInFrame(errorID) over w as olderErrorId, leadInFrame(errorID) over w as newerErrorId FROM %s.%s window w as (ORDER BY exceptionType, serviceName, timestamp rows between unbounded preceding and unbounded following)) WHERE errorID = @errorID", r.traceDB, r.errorTable) + query := fmt.Sprintf("SELECT spanID, traceID, errorID, timestamp, serviceName, exceptionType, exceptionMessage, excepionStacktrace, exceptionEscaped, olderErrorId, newerErrorId FROM (SELECT *, lagInFrame(toNullable(errorID)) over w as olderErrorId, leadInFrame(toNullable(errorID)) over w as newerErrorId FROM %s.%s window w as (ORDER BY exceptionType, serviceName, timestamp rows between unbounded preceding and unbounded following)) WHERE errorID = @errorID", r.traceDB, r.errorTable) args := []interface{}{clickhouse.Named("errorID", queryParams.ErrorID)} err := r.db.Select(ctx, &getErrorWithSpanReponse, query, args...)