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

Function stringToBool

runtime/vam/expr/cast/bool.go:48–70  ·  view source on GitHub ↗
(vec *vector.String, index []uint32)

Source from the content-addressed store, hash-verified

46}
47
48func stringToBool(vec *vector.String, index []uint32) (vector.Any, []uint32) {
49 n := lengthOf(vec, index)
50 bools := vector.NewFalse(n)
51 var errs []uint32
52 var boollen uint32
53 for i := range n {
54 idx := i
55 if index != nil {
56 idx = index[i]
57 }
58 b, err := byteconv.ParseBool(vec.Table().Bytes(idx))
59 if err != nil {
60 errs = append(errs, i)
61 continue
62 }
63 if b {
64 bools.Set(boollen)
65 }
66 boollen++
67 }
68 bools.Bits.Shorten(boollen)
69 return bools, errs
70}

Callers 1

castToBoolFunction · 0.85

Calls 7

NewFalseFunction · 0.92
ParseBoolFunction · 0.92
lengthOfFunction · 0.85
ShortenMethod · 0.80
BytesMethod · 0.45
TableMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected