MCPcopy Create free account
hub / github.com/brimdata/super / UniqueTypes

Function UniqueTypes

type.go:385–398  ·  view source on GitHub ↗

UniqueTypes returns the set of unique Types in types in sorted order. types will be sorted and deduplicated in place.

(types []Type)

Source from the content-addressed store, hash-verified

383// UniqueTypes returns the set of unique Types in types in sorted
384// order. types will be sorted and deduplicated in place.
385func UniqueTypes(types []Type) []Type {
386 sort.SliceStable(types, func(i, j int) bool {
387 return CompareTypes(types[i], types[j]) < 0
388 })
389 out := types[:0]
390 var prev Type
391 for _, typ := range types {
392 if typ != prev {
393 out = append(out, typ)
394 prev = typ
395 }
396 }
397 return out
398}
399
400func CompareTypes(a, b Type) int {
401 aID, bID := a.ID(), b.ID()

Callers 11

normalizeElemsMethod · 0.92
encodeArrayMethod · 0.92
buildMethod · 0.92
evalMethod · 0.92
buildListFunction · 0.92
innerTypeMethod · 0.92
unionOfFunction · 0.92
innerTypeOfMethod · 0.92
unionOfFunction · 0.92
newArrayFunction · 0.92
newUnionTypeMethod · 0.92

Calls 1

CompareTypesFunction · 0.85

Tested by

no test coverage detected