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
()
| 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** |
| 105 | func (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. |
no test coverage detected