Repository navigation
fix(scope): fix query stats aggregation bugs found during live SPL demo - #25
Merged
Merged
Conversation
- evalAggs panicked (nil-slice index out of range) aggregating the "Timestamp" pseudo-column, e.g. `stats min(Timestamp)/max(Timestamp)`, because Timestamp only exists in EventTable.Timestamps, never in Columns. Daemon requests died with a raw EOF client-side. Fixes #24. - ToFloat64 rejected numeric strings, so aggregating a lookup-joined CSV column (always string-typed) silently returned 0 instead of the real value or an error. ToFloat64 now coerces numeric strings. Regression tests added for both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two real bugs found while running SPL query demos against real match logs:
stats/timechartaggregatingTimestamppanics (fixes stats min/max(Timestamp) by <group> crashes daemon connection (EOF) #24).evalAggsdid a rawEventTable.Columns["Timestamp"]lookup, but"Timestamp"is a pseudo-column only present via the separateEventTable.Timestampsslice (Pipeline.Runpre-seeds it as already "produced" so it's never fetched intoColumns). Indexing the resulting nil slice panicked, killing the daemon connection with a rawEOFon the client (the daemon process itself survived). Fixed by special-casingTimestampinevalAggsto read fromTimestampsdirectly, same asRowAtalready does.ToFloat64doesn't coerce numeric strings, so aggregating alookup-joined CSV column (CSV values are always strings —encoding/csvhas no type inference) silently returned0instead of the real value or a clear error.avg(Budget)/max(Budget)etc. on a numeric-looking lookup column just silently produced 0. Fixed by havingToFloat64fall back tostrconv.ParseFloatfor strings, matching how Splunk treats extracted string fields ineval/stats.Test plan
TestStatsMinMaxTimestampByGroup(query/query_test.go) — reproduces the exact issue stats min/max(Timestamp) by <group> crashes daemon connection (EOF) #24 repro shape (transaction ... | stats min(Timestamp) as t0, max(Timestamp) as t1 ... by transactionID), verified to panic pre-fix / pass post-fix.TestStatsAggregatesLookupNumericString(query/query_test.go) — lookup-joins a numeric CSV column and assertsavg/maxreturn real values.go build ./...,go vet ./...cleangofmt -l .— unchanged from pre-existing baseline (24 files, all pre-existing CRLF checkout artifacts unrelated to this diff)go test ./... -raceall greenCloses #24.