MCPcopy
hub / github.com/uber/aresdb / fillWithDefaultValue

Method fillWithDefaultValue

memstore/vector_party.go:105–121  ·  view source on GitHub ↗

fillWithDefaultValue fills the values vector and nulls vector with default value if it's valid. **It should be only called when both values vector and nulls vector presents, otherwise it will panic. Also it requires both value vector and null vector is initialized with zeros and have never been touc

()

Source from the content-addressed store, hash-verified

103// presents, otherwise it will panic. Also it requires both value vector and null vector
104// is initialized with zeros and have never been touched yet**
105func (vp *cVectorParty) fillWithDefaultValue() {
106 if vp.values == nil || vp.nulls == nil {
107 utils.GetLogger().Panic("Calling FillWithDefaultValue with nil value vector" +
108 "or nil null vector")
109 }
110
111 if vp.defaultValue.Valid {
112 vp.nulls.SetAllValid()
113 if vp.dataType == common.Bool && vp.defaultValue.BoolVal {
114 vp.values.SetAllValid()
115 } else {
116 for i := 0; i < vp.values.Size; i++ {
117 vp.values.SetValue(i, vp.defaultValue.OtherVal)
118 }
119 }
120 }
121}
122
123// SafeDestruct destructs all vectors of this vector party. Corresponding pointer should be set
124// as nil after destruction.

Callers 3

AllocateMethod · 0.80
CopyOnWriteMethod · 0.80

Calls 4

GetLoggerFunction · 0.92
SetAllValidMethod · 0.80
PanicMethod · 0.65
SetValueMethod · 0.65

Tested by

no test coverage detected