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

Method SetValueAt

client/tablet.go:111–217  ·  view source on GitHub ↗
(value interface{}, columnIndex, rowIndex int)

Source from the content-addressed store, hash-verified

109}
110
111func (t *Tablet) SetValueAt(value interface{}, columnIndex, rowIndex int) error {
112
113 if columnIndex < 0 || columnIndex > len(t.measurementSchemas) {
114 return fmt.Errorf("illegal argument columnIndex %d", columnIndex)
115 }
116
117 if rowIndex < 0 || rowIndex > t.maxRowNumber {
118 return fmt.Errorf("illegal argument rowIndex %d", rowIndex)
119 }
120
121 if value == nil {
122 // Init the bitMap to mark nil value
123 if t.bitMaps == nil {
124 t.bitMaps = make([]*BitMap, len(t.values))
125 }
126 if t.bitMaps[columnIndex] == nil {
127 t.bitMaps[columnIndex] = NewBitMap(t.maxRowNumber)
128 }
129 // Mark the nil value position
130 t.bitMaps[columnIndex].Mark(rowIndex)
131 return nil
132 }
133
134 switch t.measurementSchemas[columnIndex].DataType {
135 case BOOLEAN:
136 values := t.values[columnIndex].([]bool)
137 switch v := value.(type) {
138 case bool:
139 values[rowIndex] = v
140 case *bool:
141 values[rowIndex] = *v
142 default:
143 return fmt.Errorf("illegal argument value %v %v", value, reflect.TypeOf(value))
144 }
145 case INT32:
146 values := t.values[columnIndex].([]int32)
147 switch v := value.(type) {
148 case int32:
149 values[rowIndex] = v
150 case *int32:
151 values[rowIndex] = *v
152 default:
153 return fmt.Errorf("illegal argument value %v %v", value, reflect.TypeOf(value))
154 }
155 case INT64, TIMESTAMP:
156 values := t.values[columnIndex].([]int64)
157 switch v := value.(type) {
158 case int64:
159 values[rowIndex] = v
160 case *int64:
161 values[rowIndex] = *v
162 default:
163 return fmt.Errorf("illegal argument value %v %v", value, reflect.TypeOf(value))
164 }
165 case FLOAT:
166 values := t.values[columnIndex].([]float32)
167 switch v := value.(type) {
168 case float32:

Callers 11

createTabletFunction · 0.95
createTabletFunction · 0.95
createTabletWithNilFunction · 0.95
createTabletFunction · 0.95
Test_QueryAllDataTypeMethod · 0.95
insertRelationalTabletFunction · 0.80
TestTablet_SetValueAtFunction · 0.80
TestTablet_GetValueAtFunction · 0.80
TestTablet_GetNilValueAtFunction · 0.80
TestTablet_SortFunction · 0.80

Calls 3

NewBitMapFunction · 0.85
DateToInt32Function · 0.85
MarkMethod · 0.80

Tested by 8

createTabletWithNilFunction · 0.76
createTabletFunction · 0.76
Test_QueryAllDataTypeMethod · 0.76
TestTablet_SetValueAtFunction · 0.64
TestTablet_GetValueAtFunction · 0.64
TestTablet_GetNilValueAtFunction · 0.64
TestTablet_SortFunction · 0.64