diff --git a/app/pkg/eval/evaluator.go b/app/pkg/eval/evaluator.go index b6ebb0a..fbc70d6 100644 --- a/app/pkg/eval/evaluator.go +++ b/app/pkg/eval/evaluator.go @@ -640,9 +640,19 @@ func (e *Evaluator) buildExperimentReport(ctx context.Context, name string, mana r.CellsMatchCounts = make(map[string]int32) for _, c := range counts { + if c.MatchResult == nil { + // N.B. I think for unknown it ends up being a nil value. I suspect this is because default values are + // elided when marshalling to JSON. We should fix that by changing the JSON serialization. + key := v1alpha1.CellsMatchResult_UNKNOWN_CellsMatchResult.String() + if _, ok := r.CellsMatchCounts[key]; !ok { + r.CellsMatchCounts[key] = 0 + } + r.CellsMatchCounts[key] = r.CellsMatchCounts[key] + int32(c.Count) + continue + } s, ok := c.MatchResult.(string) if !ok { - return r, errors.Wrapf(err, "Failed to convert cellsMatchResult to string") + return r, errors.New("Failed to convert cellsMatchResult to string") } r.CellsMatchCounts[s] = int32(c.Count) } @@ -679,7 +689,7 @@ func (e *Evaluator) buildExperimentReport(ctx context.Context, name string, mana } } - percentiles, err := computePercentilesOfInts(generateTimes, []float64{.9, .95}) + percentiles, err := computePercentilesOfInts(generateTimes, []float64{.5, .75, .9, .95}) if err != nil { return r, errors.Wrapf(err, "Failed to compute percentiles") } diff --git a/app/pkg/eval/results_manager.go b/app/pkg/eval/results_manager.go index f35541b..a76a0a8 100644 --- a/app/pkg/eval/results_manager.go +++ b/app/pkg/eval/results_manager.go @@ -214,7 +214,11 @@ func (m *ResultsManager) ListResults(ctx context.Context, cursor *time.Time, pag } func protoToRowUpdate(result *v1alpha1.EvalResult) (*fsql.UpdateResultParams, error) { - protoJson, err := protojson.Marshal(result) + // Emit default values. Otherwise SQL queries become more complex. + opts := protojson.MarshalOptions{ + EmitDefaultValues: true, + } + protoJson, err := opts.Marshal(result) if err != nil { return nil, errors.Wrapf(err, "Failed to serialize EvalResult to JSON") }