feat(details): Generate Statistics — plugin-native per-column profile - #29
Merged
Merged
Conversation
Add a "Generate Statistics" action to Table Details that computes a per-column profile server-side (one aggregation query) and shows it in an on-demand Statistics tab — replacing beatrix's notebook `%bigquery_stats` magic, which was never supported in Workbench. Per scalar column: null count/%, exact distinct count/% (COUNT(DISTINCT)). Numeric columns add min/max/avg/stddev and zero/negative counts; float columns add an infinite count. Nested/repeated columns are skipped and listed. A "Show top values" toggle adds an approximate per-column value distribution (APPROX_TOP_COUNT) rendered as mini bar charts — still one query, opt-in. Backend services/stats.py + tableStats route; frontend api.tableStats + StatisticsTab. Tests: pytest 42/42 (test_stats.py), jest 67/67. BUG=557344886
Add an "ⓘ" affordance and a title tooltip on the "Show top values" toggle clarifying that it estimates each column's most frequent values via APPROX_TOP_COUNT (approximate, not exact) within the same single query — the behavior wasn't self-evident from the label alone.
…ole-style Details - Generate Statistics ran the profiling query in the TABLE's project, so profiling bigquery-public-data failed with 'User does not have bigquery.jobs.create'. Run it in the caller's billing project instead (plumbed from the app default project; ADC default as fallback). Table metadata is still read cross-project. - Explorer 'Query history' footer is now position:sticky so it stays visible while a long project tree scrolls (was unreachable under bigquery-public-data). - Table Details styled like the BigQuery console: Description + Labels shown side by side, zebra-striped Table info, shaded Schema header. Backend /table now returns labels. Tests: pytest 43/43 (billing-project + labels), jest 67/67.
jeffreylwang
approved these changes
Sep 24, 2026
bcreddy-gcp
added a commit
that referenced
this pull request
Sep 25, 2026
feat(details): re-land Generate Statistics (stranded from #29)
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
Adds a Generate Statistics action to Table Details that computes a per-column profile server-side (one aggregation query) and shows it in an on-demand Statistics tab — a plugin-native replacement for beatrix's notebook
%bigquery_statsmagic, which was never supported in Workbench.What it captures (per top-level scalar column)
COUNT(DISTINCT))RECORD/STRUCT) andREPEATEDcolumns are skipped and listedTop values (opt-in toggle)
"Show top values (approximate)" adds a per-column value distribution via
APPROX_TOP_COUNT, rendered as mini bar charts. It stays within the same single query (no per-column fan-out), so the default profile remains cheap.Cost
The profile scans the selected columns, so it is billable — it runs only on the explicit action, and the UI surfaces bytes processed.
Implementation
services/stats.py(table_stats) +TableStatsHandlerroutetableStats(withtopValuesarg).api.tableStats/IColumnStats+StatisticsTabinTableDetails.tsx; CSS for the table, toggle and mini charts.Tests
test_stats.py: exact distinct, numeric counts, float-only infinite, top-values toggle, skip nested)Notes
ui-polish); base will retarget tomainafter that merges.BUG=557344886