fix(starrocks): expose materialized views in sidebar

This commit is contained in:
如梦技术 authored and GitHub committed 2026-07-27 16:57:24 +08:00
1 parent bd693d7b98
commit 38c2bced92
4 files changed
+262 -24

No files matched your search

@@ -6,6 +6,20 @@ describe("databaseObjectCapabilities", () => {
expect(sidebarObjectKindsForDatabase("dameng")).toContain("MATERIALIZED_VIEW");
});
it("exposes materialized views for StarRocks only", () => {
// StarRocks has a dedicated MV listing/classification path in
// crates/dbx-core/src/db/mysql.rs (`list_starrocks_tables` +
// `classify_starrocks_materialized_views`).
expect(sidebarObjectKindsForDatabase("starrocks")).toContain("MATERIALIZED_VIEW");
// Doris uses the generic SHOW TABLES listing path with no MV classifier,
// so advertising MV in the sidebar would have nothing to route to.
// Keep Doris on TABLE_VIEW_OBJECTS until a Doris-specific listing path
// lands.
expect(sidebarObjectKindsForDatabase("doris")).not.toContain("MATERIALIZED_VIEW");
expect(sidebarObjectKindsForDatabase("doris")).toEqual(expect.arrayContaining(["TABLE", "VIEW"]));
});
it("normalizes space separated materialized view types", () => {
expect(normalizeSidebarObjectKind("MATERIALIZED VIEW")).toBe("MATERIALIZED_VIEW");
});
@@ -9,6 +9,7 @@ export interface DatabaseObjectCapabilities {
}
const TABLE_VIEW_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW"];
const TABLE_VIEW_MV_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "MATERIALIZED_VIEW"];
const ROUTINE_OBJECTS: SidebarObjectKind[] = ["TABLE", "VIEW", "PROCEDURE", "FUNCTION"];
@@ -41,8 +42,13 @@ const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([
["cloudflare-d1", TABLE_VIEW_OBJECTS],
["duckdb", TABLE_VIEW_OBJECTS],
["clickhouse", TABLE_VIEW_OBJECTS],
// Doris: backend listing path still uses the generic SHOW TABLES path (see
// `list_tables_once` for `PoolKind::Mysql` in crates/dbx-core/src/schema.rs)
// and lacks a MV classifier. Keep Doris on TABLE_VIEW_OBJECTS until a
// Doris-specific MV listing/classification lands, otherwise the UI advertises
// MV support that the backend cannot route.
["doris", TABLE_VIEW_OBJECTS],
["starrocks", TABLE_VIEW_OBJECTS],
["starrocks", TABLE_VIEW_MV_OBJECTS],
["hive", TABLE_VIEW_OBJECTS],
["spark", TABLE_VIEW_OBJECTS],
["trino", TABLE_VIEW_OBJECTS],