Skip to content

Commit

Permalink
pkg/query: Handle possible nil value for start and end values
Browse files Browse the repository at this point in the history
  • Loading branch information
yomete committed May 28, 2024
1 parent 7ff555c commit ac65b0f
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions pkg/query/columnquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,11 +922,21 @@ func (q *ColumnQueryAPI) getMappingFiles(
ctx context.Context,
m *pb.MergeProfile,
) ([]string, error) {
start := time.Time{}
if m.Start != nil {
start = m.Start.AsTime()
}

end := time.Time{}
if m.End != nil {
end = m.End.AsTime()
}

p, err := q.querier.GetProfileMetadataMappings(
ctx,
m.Query,
m.Start.AsTime(),
m.End.AsTime(),
start,
end,
)
if err != nil {
return nil, err
Expand All @@ -939,7 +949,17 @@ func (q *ColumnQueryAPI) getLabels(
ctx context.Context,
req *pb.LabelsRequest,
) ([]string, error) {
l, err := q.querier.GetProfileMetadataLabels(ctx, req.Match, req.Start.AsTime(), req.End.AsTime())
start := time.Time{}
if req.Start != nil {
start = req.Start.AsTime()
}

end := time.Time{}
if req.End != nil {
end = req.End.AsTime()
}

l, err := q.querier.GetProfileMetadataLabels(ctx, req.Match, start, end)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit ac65b0f

Please sign in to comment.