schedule_id_query_rewriter.go ×6

Frontier kind: Code frontier

unlabeled · c_a841945edc11

21 tests · 2292 LOC · 115 files · introduces 0 tests · 15 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges15 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
334 ranges2292 lines · 115 files · Browse complete extent
All tests (intent)
21 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 15 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/scheduler/schedule_id_query_rewriter.go 12 introduced LOC · 6 ranges

Open complete file

38 }
39
40 > stmt, err := sqlparser.Parse("select * from table1 where " + queryStr) schedule_id_query_rewriter.go
41 > if err != nil {
42 // Malformed SQL is passed through; the normal validation path will return a proper error.
43 return queryStr, nil
44 }
45 > sel, ok := stmt.(*sqlparser.Select) schedule_id_query_rewriter.go
46 > if !ok {
47 return queryStr, nil
48 }
49 > if sel.Where == nil { schedule_id_query_rewriter.go
50 return queryStr, nil
51 }
52
53 > changed := rewriteExpr(&sel.Where.Expr, chasmEnabled, saMapper, saNameType, ns.String()) schedule_id_query_rewriter.go
54 > if !changed {
55 return queryStr, nil
56 }
73 // rewriteExpr recursively walks expr and rewrites ScheduleId comparison nodes in-place.
74 // Returns true if any rewriting occurred.
75 > func rewriteExpr(exprRef *sqlparser.Expr, chasmEnabled bool, saMapper searchattribute.Mapper, saNameType searchattribute.NameTypeMap, ns string) bool { schedule_id_query_rewriter.go
76 > switch e := (*exprRef).(type) {
77 case *sqlparser.AndExpr:
78 l := rewriteExpr(&e.Left, chasmEnabled, saMapper, saNameType, ns)
153 // that maps to WorkflowId (the built-in virtual SA), as opposed to a user-defined custom SA
154 // named ScheduleId which should be queried as-is.
155 > func isScheduleIDToWorkflowIDColumn(col *sqlparser.ColName, saMapper searchattribute.Mapper, saNameType searchattribute.NameTypeMap, ns string) bool { schedule_id_query_rewriter.go
156 > alias := col.Name.String()
157 > if searchattribute.IsUserDefinedSearchAttribute(alias, saMapper, saNameType, ns) {
158 return false
159 }
go.temporal.io/server/common/searchattribute/mapper.go 3 introduced LOC · 1 range

Open complete file

233 // under the alias itself. GetFieldName returns an error (no mapping exists), so the type
234 // map is the only way to detect these.
235 > func IsUserDefinedSearchAttribute(alias string, saMapper Mapper, saNameType NameTypeMap, ns string) bool { mapper.go
236 > // Check 1: explicit alias mapping resolves to a different underlying field name.
237 > if mapped, err := saMapper.GetFieldName(alias, ns); err == nil && mapped != alias {
238 return true
239 }