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

Function insertRelationalTablet

example/table/table_session_example.go:68–117  ·  view source on GitHub ↗
(session client.ITableSession)

Source from the content-addressed store, hash-verified

66}
67
68func insertRelationalTablet(session client.ITableSession) {
69 tablet, err := client.NewRelationalTablet("t1", []*client.MeasurementSchema{
70 {
71 Measurement: "tag1",
72 DataType: client.STRING,
73 },
74 {
75 Measurement: "tag2",
76 DataType: client.STRING,
77 },
78 {
79 Measurement: "s1",
80 DataType: client.TEXT,
81 },
82 {
83 Measurement: "s2",
84 DataType: client.TEXT,
85 },
86 }, []client.ColumnCategory{client.TAG, client.TAG, client.FIELD, client.FIELD}, 1024)
87 if err != nil {
88 log.Fatal("Failed to create relational tablet {}", err)
89 }
90 ts := time.Now().UTC().UnixNano() / 1000000
91 for row := 0; row < 16; row++ {
92 ts++
93 tablet.SetTimestamp(ts, row)
94 tablet.SetValueAt("tag1_value_"+strconv.Itoa(row), 0, row)
95 tablet.SetValueAt("tag2_value_"+strconv.Itoa(row), 1, row)
96 tablet.SetValueAt("s1_value_"+strconv.Itoa(row), 2, row)
97 tablet.SetValueAt("s2_value_"+strconv.Itoa(row), 3, row)
98 tablet.RowSize++
99 }
100 checkError(session.Insert(tablet))
101
102 tablet.Reset()
103
104 for row := 0; row < 16; row++ {
105 ts++
106 tablet.SetTimestamp(ts, row)
107 tablet.SetValueAt("tag1_value_1", 0, row)
108 tablet.SetValueAt("tag2_value_1", 1, row)
109 tablet.SetValueAt("s1_value_"+strconv.Itoa(row), 2, row)
110 tablet.SetValueAt("s2_value_"+strconv.Itoa(row), 3, row)
111
112 nullValueColumn := rand.Intn(4)
113 tablet.SetValueAt(nil, nullValueColumn, row)
114 tablet.RowSize++
115 }
116 checkError(session.Insert(tablet))
117}
118
119func showTables(session client.ITableSession) {
120 timeout := int64(2000)

Callers 1

mainFunction · 0.85

Calls 6

NewRelationalTabletFunction · 0.92
SetTimestampMethod · 0.80
SetValueAtMethod · 0.80
ResetMethod · 0.80
checkErrorFunction · 0.70
InsertMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…