Skip to content

fix: populate dolt_statistics created_at - #11438

Open
CBOSSX wants to merge 1 commit into
dolthub:mainfrom
CBOSSX:bugfix/populate-stat-created-at-20260807T075934Z
Open

fix: populate dolt_statistics created_at#11438
CBOSSX wants to merge 1 commit into
dolthub:mainfrom
CBOSSX:bugfix/populate-stat-created-at-20260807T075934Z

Conversation

@CBOSSX

@CBOSSX CBOSSX commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • Fixes: After ANALYZE TABLE creates fresh statistics, every dolt_statistics.created_at value is 0001-01-01 00:00:00 instead of the collection time.
  • Root cause: StatsController creates both table-scan and index Statistic values without setting their Created field, so the presentation layer receives Go's zero time even though the controller already has a mockable collection clock.

Closes #10168.

Regression evidence

  • Before: CGO_CPPFLAGS=-I/opt/homebrew/opt/icu4c/include CGO_LDFLAGS=-L/opt/homebrew/opt/icu4c/lib go test ./libraries/doltcore/sqle/statspro -run '^TestStatisticCreatedAt$' -count=1 -v exited 1

  • After: CGO_CPPFLAGS=-I/opt/homebrew/opt/icu4c/include CGO_LDFLAGS=-L/opt/homebrew/opt/icu4c/lib go test ./libraries/doltcore/sqle/statspro -run '^TestStatisticCreatedAt$' -count=1 -v exited 0

Verification

  • CGO_CPPFLAGS=-I/opt/homebrew/opt/icu4c/include CGO_LDFLAGS=-L/opt/homebrew/opt/icu4c/lib go test -vet=off -timeout 45m ./libraries/doltcore/sqle/statspro -count=1
  • CGO_CPPFLAGS=-I/opt/homebrew/opt/icu4c/include CGO_LDFLAGS=-L/opt/homebrew/opt/icu4c/lib GOFLAGS=-mod=readonly go build ./...
  • CGO_CPPFLAGS=-I/opt/homebrew/opt/icu4c/include CGO_LDFLAGS=-L/opt/homebrew/opt/icu4c/lib go vet -mod=readonly ./...
  • go run -mod=readonly ./utils/copyrightshdrs/; ./Godeps/verify.sh; ./utils/repofmt/check_bats_fmt.sh; ./utils/repofmt/check_fmt.sh

Scope

  • 2 files changed, +28 / -0 lines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dolt_statistics.created_at is always 0001-01-01 00:00:00

2 participants