Skip to content

[Feature] SSE Materialized View UI + Data Sources hub#18537

Merged
xiangfu0 merged 3 commits into
apache:masterfrom
hongkunxu:feat/sse_mv_view_ui
May 20, 2026
Merged

[Feature] SSE Materialized View UI + Data Sources hub#18537
xiangfu0 merged 3 commits into
apache:masterfrom
hongkunxu:feat/sse_mv_view_ui

Conversation

@hongkunxu
Copy link
Copy Markdown
Contributor

@hongkunxu hongkunxu commented May 20, 2026

Summary

Adds a read-only Controller UI and REST surface for SSE Materialized Views, building on the MV creation/ingestion wiring landed in #18528 (PR 1/2).

Operators can list all MVs, inspect definition + runtime health, and drop an MV — create/edit from the UI is intentionally deferred.

Context

Overview

image image image

Changes

Backend (PinotMaterializedViewRestletResource)

Method Path Description
GET /materializedViews Cluster-wide listing: name, base tables, watermark, VALID/STALE/total partition counts, last refresh time, staleness SLO. Broken ZK entries surface as { materializedViewTableName, error } without failing the whole list.
GET /materializedViews/{name} Full definition (defined SQL, base tables, split spec, partition expression maps, staleness SLO) + runtime (watermark + per-bucket state sorted by bucketStartMs). Definition and runtime are built from a single ZK snapshot so summary counts match the partition table.
DELETE /materializedViews/{name} Delegates to PinotHelixResourceManager.deleteTable — same segment cleanup and dependent-MV rejection (409) as table delete.
  • New Swagger tag: MATERIALIZED_VIEW_TAG.
  • Auth: listing uses cluster-scoped GET_TABLE; per-MV GET/DELETE use table-scoped permissions on the path param (mirrors /tables/{name}).

Frontend (Controller React app)

  • Left nav: Materialized Views/materialized-views.
  • Listing page: paginated table (MV name, base tables, watermark, VALID/STALE/total, last refresh, staleness SLO, status); problem rows highlighted when the API returns error.
  • Details page (/materialized-views/{name}):
    • Summary (name, base tables, watermark, staleness SLO, partition counts by state).
    • Defined SQL + full definition JSON (CodeMirror, read-only).
    • Per-partition table (bucket start as ISO timestamp, state, segment count, CRC, last refresh).
    • Refresh and Drop MV (confirmation dialog).
  • API helpers: getMaterializedViewList, getMaterializedView, deleteMaterializedView.
  • Utils.formatEpochMillis for optional MV timestamps (null/0/negative → ).

Out of scope (follow-up)

  • MV create / edit from UI.
  • Automated REST/UI tests in this PR.

Test plan

  • Deploy controller with at least one MV (from [Feature] SSE Materialized View Creation and Ingestion #18528 path).
  • Listing: open /materialized-views; verify columns match cluster state; confirm a corrupt/missing runtime znode shows an error row without breaking the page.
  • Details: open an MV; verify defined SQL, definition JSON, watermark, and per-partition table are consistent (VALID/STALE counts match partition states).
  • Refresh: reload details after minion/consistency updates.
  • Drop: delete a leaf MV via UI; confirm table + ZK metadata removed.
  • Drop guard: attempt to drop an MV that other MVs depend on; expect 409 and UI error message.
  • Swagger: confirm endpoints under Materialized View tag; verify auth on list vs per-name routes.
  • REST smoke:
    • GET /materializedViews
    • GET /materializedViews/{name}_OFFLINE
    • DELETE /materializedViews/{name}_OFFLINE (test cluster only)

Adds a controller-side Materialized View management UI and the supporting REST endpoints. Read-only details + drop only — full create/edit-from-UI is deferred to a follow-up.

**Backend**
- `PinotMaterializedViewRestletResource`:
  - `GET /materializedViews` — listing with name, base tables, watermark, VALID / STALE / total partition counts, last refresh time, staleness SLO.
  - `GET /materializedViews/{name}` — full definition (defined SQL, base tables, split spec, partition expression maps, staleness SLO) plus runtime (watermarkMs + per-bucket state map sorted by bucketStartMs).
  - `DELETE /materializedViews/{name}` — delegates to `PinotHelixResourceManager.deleteTable` so the same dependent-MV safety guards apply.
- New `MATERIALIZED_VIEW_TAG` for swagger grouping.

**Frontend**
- New left-nav entry "Materialized Views" linking to `/materialized-views`.
- New listing page at `/materialized-views`: paginated table of all MVs with key health columns.
- New details page at `/materialized-views/{name}`:
  - Summary (name, base tables, watermark, staleness SLO, partition counts by state).
  - Defined SQL (CodeMirror, read-only).
  - Full definition JSON (CodeMirror, read-only).
  - Per-partition table (bucketStartMs as ISO timestamp, state, segmentCount, crc, lastRefreshTime).
  - "Refresh" + "Drop MV" actions; drop goes through a confirmation dialog.
- New `requests/index.ts` helpers: `getMaterializedViewList`, `getMaterializedView`, `deleteMaterializedView`.

Existing controller wiring (PR 1) handles all the underlying ZK reads/writes and the dependent-MV guard on `deleteTable`; this PR is the operator-facing surface on top of it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Co-Authored-By: Hongkun Xu <xuhongkun666@163.com>
@hongkunxu hongkunxu force-pushed the feat/sse_mv_view_ui branch from 68292c2 to 7a68658 Compare May 20, 2026 04:06
@hongkunxu hongkunxu marked this pull request as ready for review May 20, 2026 04:15
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 20, 2026

Codecov Report

❌ Patch coverage is 0% with 138 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.22%. Comparing base (ca0dfc1) to head (bb62f1c).

Files with missing lines Patch % Lines
...esources/PinotMaterializedViewRestletResource.java 0.00% 138 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18537      +/-   ##
============================================
- Coverage     64.31%   64.22%   -0.10%     
  Complexity     1126     1126              
============================================
  Files          3309     3310       +1     
  Lines        203571   203709     +138     
  Branches      31686    31704      +18     
============================================
- Hits         130928   130831      -97     
- Misses        62142    62391     +249     
+ Partials      10501    10487      -14     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.22% <0.00%> (-0.10%) ⬇️
temurin 64.22% <0.00%> (-0.10%) ⬇️
unittests 64.22% <0.00%> (-0.10%) ⬇️
unittests1 56.70% <ø> (-0.01%) ⬇️
unittests2 35.46% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

xiangfu0 and others added 2 commits May 19, 2026 22:43
Apply @sqltools/formatter (already used by Query.tsx) to the persisted
single-line definedSQL before rendering it in the read-only CodeMirror
viewer, so the SELECT/GROUP BY structure is visually scannable. The
formatter call is memoized on the SQL text and falls back to the raw
string on parser errors so the page never blanks on an unrecognized
dialect. Bumped the SQL box height from 220 to 280 to fit the now
multi-line layout.

Co-Authored-By: Hongkun Xu <xuhongkun666@163.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Introduce a new /data-sources page accessible from the left sidebar
that surfaces both queryable surfaces (Tables, Materialized Views) as
cards with live counts, making it the discoverable entry point for the
data-source types Pinot exposes. The standalone "Materialized Views"
sidebar entry is removed — MV is now reached via Data Sources —
while the existing "Tables" card on the Cluster Manager homepage is
left in place for backward compatibility.

Co-Authored-By: Hongkun Xu <xuhongkun666@163.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xiangfu0 xiangfu0 changed the title [Feature] SSE Materialized View UI [Feature] SSE Materialized View UI + Data Sources hub May 20, 2026
@xiangfu0 xiangfu0 added ui UI related issue materialized-view labels May 20, 2026
@xiangfu0 xiangfu0 self-requested a review May 20, 2026 07:39
@xiangfu0 xiangfu0 merged commit 122f75e into apache:master May 20, 2026
11 checks passed
@xiangfu0 xiangfu0 deleted the feat/sse_mv_view_ui branch May 20, 2026 08:14
@xiangfu0
Copy link
Copy Markdown
Contributor

Docs PR opened: pinot-contrib/pinot-docs#811

pinot-contrib/pinot-docs#811

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

Labels

materialized-view ui UI related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants