(reader *bytes.Reader, dataType TSDataType, positionCount int32)
| 230 | } |
| 231 | |
| 232 | func (decoder *BinaryArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataType TSDataType, positionCount int32) (Column, error) { |
| 233 | // Serialized data layout: |
| 234 | // +---------------+-----------------+-------------+ |
| 235 | // | may have null | null indicators | values | |
| 236 | // +---------------+-----------------+-------------+ |
| 237 | // | byte | list[byte] | list[entry] | |
| 238 | // +---------------+-----------------+-------------+ |
| 239 | // |
| 240 | // Each entry is represented as: |
| 241 | // +---------------+-------+ |
| 242 | // | value length | value | |
| 243 | // +---------------+-------+ |
| 244 | // | int32 | bytes | |
| 245 | // +---------------+-------+ |
| 246 | |
| 247 | if TEXT != dataType { |
| 248 | return nil, fmt.Errorf("invalid data type: %v", dataType) |
| 249 | } |
| 250 | |
| 251 | if positionCount == 0 { |
| 252 | return NewBinaryColumn(0, 0, nil, []*Binary{}) |
| 253 | } |
| 254 | |
| 255 | nullIndicators, err := deserializeNullIndicators(reader, positionCount) |
| 256 | if err != nil { |
| 257 | return nil, err |
| 258 | } |
| 259 | values := make([]*Binary, positionCount) |
| 260 | for i := int32(0); i < positionCount; i++ { |
| 261 | if nullIndicators != nil && nullIndicators[i] { |
| 262 | continue |
| 263 | } |
| 264 | var length int32 |
| 265 | err := binary.Read(reader, binary.BigEndian, &length) |
| 266 | if err != nil { |
| 267 | return nil, err |
| 268 | } |
| 269 | |
| 270 | if length == 0 { |
| 271 | values[i] = NewBinary([]byte{}) |
| 272 | } else { |
| 273 | value := make([]byte, length) |
| 274 | _, err = reader.Read(value) |
| 275 | if err != nil { |
| 276 | return nil, err |
| 277 | } |
| 278 | values[i] = NewBinary(value) |
| 279 | } |
| 280 | } |
| 281 | return NewBinaryColumn(0, positionCount, nullIndicators, values) |
| 282 | } |
| 283 | |
| 284 | type RunLengthColumnDecoder struct { |
| 285 | baseColumnDecoder |
nothing calls this directly
no test coverage detected