MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / intersectTypeSlices

Function intersectTypeSlices

pkg/sql/sem/tree/constant.go:419–431  ·  view source on GitHub ↗

intersectTypeSlices returns a slice of all the types that are in both of the input slices that have the same OID.

(xs, ys []*types.T)

Source from the content-addressed store, hash-verified

417// intersectTypeSlices returns a slice of all the types that are in both of the
418// input slices that have the same OID.
419func intersectTypeSlices(xs, ys []*types.T) (out []*types.T) {
420 seen := make(map[oid.Oid]struct{})
421 for _, x := range xs {
422 for _, y := range ys {
423 _, ok := seen[x.Oid()]
424 if x.Oid() == y.Oid() && !ok {
425 out = append(out, x)
426 }
427 }
428 seen[x.Oid()] = struct{}{}
429 }
430 return out
431}
432
433// commonConstantType returns the most constrained type which is mutually
434// resolvable between a set of provided constants.

Callers 1

commonConstantTypeFunction · 0.85

Calls 1

OidMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…