MCPcopy Create free account
hub / github.com/dgraph-io/dgraph-benchmarks / testQuery

Function testQuery

pbbenchmark/main.go:137–157  ·  view source on GitHub ↗
(entity []string, name string, q1 string, q2 string)

Source from the content-addressed store, hash-verified

135}
136
137func testQuery(entity []string, name string, q1 string, q2 string) {
138 rm := Query(entity, q1, q2)
139 file, err := os.Create(name + ".csv")
140 checkErr(err, "Error while opening file")
141 defer file.Close()
142
143 w := csv.NewWriter(file)
144
145 for k, v := range rm {
146 numEntities := strconv.Itoa(k)
147 avgRatio := strconv.FormatFloat(v.ratio/float64(v.count), 'E', -1, 64)
148 jsonL := strconv.FormatInt(v.jsonL/int64(v.count), 10)
149 if err := w.Write([]string{numEntities, avgRatio, jsonL}); err != nil {
150 glog.WithField("err", err).Fatal("error writing record to csv")
151 }
152 }
153 w.Flush()
154 if err := w.Error(); err != nil {
155 log.Fatal(err)
156 }
157}
158
159func main() {
160 flag.Parse()

Callers 1

mainFunction · 0.85

Calls 4

checkErrFunction · 0.85
WriteMethod · 0.80
QueryFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected