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

Function containsSystemSchema

backend/plugin/parser/trino/query_type.go:114–129  ·  view source on GitHub ↗

containsSystemSchema reports whether a query references a Trino system/metadata schema, via a case-insensitive substring scan. This mirrors the legacy plugin's heuristic (and omni analysis.Classify's refineSelect) so the SELECT → SelectInfoSchema promotion is identical across the legacy and omni sta

(sql string)

Source from the content-addressed store, hash-verified

112// plugin's heuristic (and omni analysis.Classify's refineSelect) so the SELECT →
113// SelectInfoSchema promotion is identical across the legacy and omni stacks.
114func containsSystemSchema(sql string) bool {
115 lowerSQL := strings.ToLower(sql)
116 systemPrefixes := []string{
117 "system.",
118 "information_schema.",
119 "$system.",
120 "catalog.",
121 "metadata.",
122 }
123 for _, prefix := range systemPrefixes {
124 if strings.Contains(lowerSQL, prefix) {
125 return true
126 }
127 }
128 return false
129}

Callers 3

queryTypeFromTextFunction · 0.85
getQuerySpanMethod · 0.85
TestContainsSystemSchemaFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestContainsSystemSchemaFunction · 0.68