MCPcopy Index your code
hub / github.com/apache/iotdb-client-go / DeserializeTsBlock

Function DeserializeTsBlock

client/tsblock.go:45–110  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

43}
44
45func DeserializeTsBlock(data []byte) (*TsBlock, error) {
46 // Serialized tsblock:
47 // +-------------+---------------+---------+------------+-----------+----------+
48 // | val col cnt | val col types | pos cnt | encodings | time col | val col |
49 // +-------------+---------------+---------+------------+-----------+----------+
50 // | int32 | list[byte] | int32 | list[byte] | bytes | bytes |
51 // +-------------+---------------+---------+------------+-----------+----------+
52
53 reader := bytes.NewReader(data)
54 // value column count
55 var valueColumnCount int32
56 if err := binary.Read(reader, binary.BigEndian, &valueColumnCount); err != nil {
57 return nil, err
58 }
59
60 // value column data types
61 valueColumnDataTypes := make([]TSDataType, valueColumnCount)
62 for i := int32(0); i < valueColumnCount; i++ {
63 dataType, err := deserializeDataType(reader)
64 if err != nil {
65 return nil, err
66 }
67 valueColumnDataTypes[i] = dataType
68 }
69
70 // position count
71 var positionCount int32
72 if err := binary.Read(reader, binary.BigEndian, &positionCount); err != nil {
73 return nil, err
74 }
75
76 // column encodings
77 columnEncodings := make([]ColumnEncoding, valueColumnCount+1)
78 for i := int32(0); i < valueColumnCount+1; i++ {
79 columnEncoding, err := deserializeColumnEncoding(reader)
80 if err != nil {
81 return nil, err
82 }
83 columnEncodings[i] = columnEncoding
84 }
85
86 // time column
87 timeColumnDecoder, err := getColumnDecoder(columnEncodings[0])
88 if err != nil {
89 return nil, err
90 }
91 timeColumn, err := timeColumnDecoder.ReadColumn(reader, INT64, positionCount)
92 if err != nil {
93 return nil, err
94 }
95
96 // value columns
97 valueColumns := make([]Column, valueColumnCount)
98 for i := int32(0); i < valueColumnCount; i++ {
99 valueColumnDecoder, err := getColumnDecoder(columnEncodings[i+1])
100 if err != nil {
101 return nil, err
102 }

Callers 1

constructOneTsBlockMethod · 0.85

Calls 6

deserializeDataTypeFunction · 0.85
getColumnDecoderFunction · 0.85
NewTsBlockFunction · 0.85
ReadColumnMethod · 0.65
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…