Answers to both of the questions,
-
No, for me these are simple lua lists. there is no natural order maintained for float64 numbers. I just wanted to keep track of number of insertions that have happened on these lists. hence from my lua code you will see, I always keep a maximum of 7 entries in list against “value” bin.
-
That is not possible, because Go would have given me exception right there (I use as.Floatvalue for wrapping it). also the post is generated using the following go code, please generate few million ids if testing is required.
code:
package main
import (
"fmt"
"encoding/json"
"bytes"
"strconv"
"strings"
"sort"
) type signal struct {
Name string `json:"name"`
Value float64 `json:"value"`
Fact1 bool `json:"fact1"`
Fact2 bool `json:"fact2"` } type signalPacket struct {
Id string `json:"id"`
Subgroupid string `json:"subgroupid"`
Groupid string `json:"groupid"`
Label string `json:"label"`
LabelPath string `json:"labelPath"`
Groupquantile float64 `json:"groupquantile"`
LabelQuantile float64 `json:"labelQuantile"`
Date string `json:"date"`
Signals []signal `json:"signals"` }
func main() {
//bulkGetGenerator(80, 1000);
//bulkGetAssertGenerator(80, 1000);
bulkSetGenerator(10,10);
}
func bulkSetGenerator(lines int, packetSize int) {
for i := 0 ; i < lines ; i++ {
signalsList := []signalPacket{}
for j := 0 ; j < packetSize ; j++ {
counter := i * packetSize + j
floatCounter := float64(counter)
var buffer bytes.Buffer
buffer.WriteString("P")
buffer.WriteString(strconv.Itoa(counter))
signals:= []signal{{Name: "signal1", Value: 0.7892345652323 + floatCounter, Fact1: false, Fact2: false}, {Name: "signal2", Value: floatCounter + 0.7232389234565, Fact1: false, Fact2: false}, {Name: "signal3", Value: floatCounter+0.78922343234565, Fact1: false, Fact2: false}, {Name: "signal4", Value: floatCounter + 0.78234329234565, Fact1: false, Fact2: false}}
signalsList = append(signalsList, signalPacket{Id:buffer.String(), Subgroupid: "i"+strconv.Itoa(counter), Groupid:"v"+strconv.Itoa(counter), Label:"b"+strconv.Itoa(counter), LabelPath:"l1/l2/l"+strconv.Itoa(counter), LabelQuantile:50.23423, Groupquantile: 53.23423432, Date: "21-03-2018", Signals:signals});
}
bytes,_ := json.Marshal(&signalsList)
fmt.Println(string(bytes))
}
}
In my go code, I just do a double iteration (first on json list of packets and second on signals - kind of hacky yeah, for the moment) and execute the udf that I sent in the previous post, because there is no direct Batch Set available similar to BatchGet. so my writes will be generic and type safe(same float64 applicable to all writes).
For your previous question, please suggest steps and method to create and share the DB from Aerospike, I can do that as well.
regards. Arun.