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

Function createTabletWithNil

test/e2e/e2e_test.go:294–342  ·  view source on GitHub ↗
(rowCount int)

Source from the content-addressed store, hash-verified

292}
293
294func createTabletWithNil(rowCount int) (*client.Tablet, error) {
295 tablet, err := client.NewTablet("root.ln.device1", []*client.MeasurementSchema{
296 {
297 Measurement: "restart_count",
298 DataType: client.INT32,
299 }, {
300 Measurement: "price",
301 DataType: client.DOUBLE,
302 }, {
303 Measurement: "tick_count",
304 DataType: client.INT64,
305 }, {
306 Measurement: "temperature",
307 DataType: client.FLOAT,
308 }, {
309 Measurement: "description",
310 DataType: client.TEXT,
311 },
312 {
313 Measurement: "status",
314 DataType: client.BOOLEAN,
315 },
316 }, rowCount)
317
318 if err != nil {
319 return nil, err
320 }
321 ts := time.Now().UTC().UnixNano() / 1000000
322 for row := 0; row < int(rowCount); row++ {
323 ts++
324 tablet.SetTimestamp(ts, row)
325 tablet.SetValueAt(rand.Int31(), 0, row)
326 if row%2 == 1 {
327 tablet.SetValueAt(rand.Float64(), 1, row)
328 } else {
329 tablet.SetValueAt(nil, 1, row)
330 }
331 tablet.SetValueAt(rand.Int63(), 2, row)
332 if row%3 == 1 {
333 tablet.SetValueAt(rand.Float32(), 3, row)
334 } else {
335 tablet.SetValueAt(nil, 3, row)
336 }
337 tablet.SetValueAt(fmt.Sprintf("Test Device %d", row+1), 4, row)
338 tablet.SetValueAt(bool(ts%2 == 0), 5, row)
339 tablet.RowSize++
340 }
341 return tablet, nil
342}
343
344func createTablet(rowCount int) (*client.Tablet, error) {
345 tablet, err := client.NewTablet("root.ln.device1", []*client.MeasurementSchema{

Calls 3

SetTimestampMethod · 0.95
SetValueAtMethod · 0.95
NewTabletFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…