fix: lagInFrame and leadInFrame nullable (#1089)

https://github.com/ClickHouse/ClickHouse/pull/26521
This commit is contained in:
Vishal Sharma 2022-05-05 12:22:19 +05:30 committed by GitHub
parent 7cf567792a
commit 6fb6a576aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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...)