MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / getValuesBytes

Method getValuesBytes

client/tablet.go:289–323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287}
288
289func (t *Tablet) getValuesBytes() ([]byte, error) {
290 buff := &bytes.Buffer{}
291 for i, schema := range t.measurementSchemas {
292 switch schema.DataType {
293 case BOOLEAN:
294 binary.Write(buff, binary.BigEndian, t.values[i].([]bool)[0:t.RowSize])
295 case INT32, DATE:
296 binary.Write(buff, binary.BigEndian, t.values[i].([]int32)[0:t.RowSize])
297 case INT64, TIMESTAMP:
298 binary.Write(buff, binary.BigEndian, t.values[i].([]int64)[0:t.RowSize])
299 case FLOAT:
300 binary.Write(buff, binary.BigEndian, t.values[i].([]float32)[0:t.RowSize])
301 case DOUBLE:
302 binary.Write(buff, binary.BigEndian, t.values[i].([]float64)[0:t.RowSize])
303 case TEXT, STRING, BLOB:
304 for _, s := range t.values[i].([][]byte)[0:t.RowSize] {
305 binary.Write(buff, binary.BigEndian, int32(len(s)))
306 binary.Write(buff, binary.BigEndian, s)
307 }
308 default:
309 return nil, fmt.Errorf("illegal datatype %v", schema.DataType)
310 }
311 }
312 if t.bitMaps != nil {
313 for _, bitMap := range t.bitMaps {
314 columnHasNil := bitMap != nil && !bitMap.IsAllUnmarked()
315 binary.Write(buff, binary.BigEndian, columnHasNil)
316 if columnHasNil {
317 // Need to maintain consistency with the calculation method on the IoTDB side.
318 binary.Write(buff, binary.BigEndian, bitMap.GetBits()[0:t.RowSize/8+1])
319 }
320 }
321 }
322 return buff.Bytes(), nil
323}
324
325func (t *Tablet) Sort() error {
326 sort.Sort(t)

Callers 2

genInsertTabletsReqMethod · 0.80
genTSInsertTabletReqMethod · 0.80

Calls 3

IsAllUnmarkedMethod · 0.80
GetBitsMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected