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

Method ReadColumn

client/column_decoder.go:91–141  ·  view source on GitHub ↗
(reader *bytes.Reader, dataType TSDataType, positionCount int32)

Source from the content-addressed store, hash-verified

89}
90
91func (decoder *Int32ArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataType TSDataType, positionCount int32) (Column, error) {
92 // Serialized data layout:
93 // +---------------+-----------------+-------------+
94 // | may have null | null indicators | values |
95 // +---------------+-----------------+-------------+
96 // | byte | list[byte] | list[int32] |
97 // +---------------+-----------------+-------------+
98
99 if positionCount == 0 {
100 switch dataType {
101 case INT32, DATE:
102 return NewIntColumn(0, 0, nil, []int32{})
103 case FLOAT:
104 return NewFloatColumn(0, 0, nil, []float32{})
105 default:
106 return nil, fmt.Errorf("invalid data type: %v", dataType)
107 }
108 }
109
110 nullIndicators, err := deserializeNullIndicators(reader, positionCount)
111 if err != nil {
112 return nil, err
113 }
114 switch dataType {
115 case INT32, DATE:
116 intValues := make([]int32, positionCount)
117 for i := int32(0); i < positionCount; i++ {
118 if nullIndicators != nil && nullIndicators[i] {
119 continue
120 }
121 err := binary.Read(reader, binary.BigEndian, &intValues[i])
122 if err != nil {
123 return nil, err
124 }
125 }
126 return NewIntColumn(0, positionCount, nullIndicators, intValues)
127 case FLOAT:
128 floatValues := make([]float32, positionCount)
129 for i := int32(0); i < positionCount; i++ {
130 if nullIndicators != nil && nullIndicators[i] {
131 continue
132 }
133 err := binary.Read(reader, binary.BigEndian, &floatValues[i])
134 if err != nil {
135 return nil, err
136 }
137 }
138 return NewFloatColumn(0, positionCount, nullIndicators, floatValues)
139 }
140 return nil, fmt.Errorf("invalid data type: %v", dataType)
141}
142
143type Int64ArrayColumnDecoder struct {
144 baseColumnDecoder

Callers

nothing calls this directly

Calls 4

NewIntColumnFunction · 0.85
NewFloatColumnFunction · 0.85
ReadMethod · 0.45

Tested by

no test coverage detected