MCPcopy Create free account
hub / github.com/bytebase/bytebase / markMaterializedViews

Function markMaterializedViews

backend/plugin/db/starrocks/dump.go:404–413  ·  view source on GitHub ↗

markMaterializedViews re-tags rows that are actually materialized views so the dump emits SHOW CREATE MATERIALIZED VIEW for them. Doris reports MVs as 'BASE TABLE' and StarRocks as 'VIEW'; either becomes 'MATERIALIZED VIEW' when its name is in the materialized-view set. Regular tables and views are

(tables []*TableSchema, materializedViewNames map[string]bool)

Source from the content-addressed store, hash-verified

402// StarRocks as 'VIEW'; either becomes 'MATERIALIZED VIEW' when its name is in the
403// materialized-view set. Regular tables and views are left untouched.
404func markMaterializedViews(tables []*TableSchema, materializedViewNames map[string]bool) {
405 for _, tbl := range tables {
406 if !materializedViewNames[tbl.Name] {
407 continue
408 }
409 if tbl.TableType == baseTableType || tbl.TableType == viewTableType {
410 tbl.TableType = materializedViewType
411 }
412 }
413}
414
415// getTableStmt gets the create statement of a table.
416func getTableStmt(db *sql.DB, dbName, tblName, tblType string) (string, error) {

Callers 2

getTablesFunction · 0.85

Calls

no outgoing calls

Tested by 1