gemini icon indicating copy to clipboard operation
gemini copied to clipboard

Does not work with tuple fields in pk properly

Open dkropachev opened this issue 2 years ago • 0 comments

Since gemini dump all the values into single value list:

func (g *Generator) createPartitionKeyValues(r *rand.Rand) []interface{} {
	var values []interface{}
	for _, pk := range g.table.PartitionKeys {
		values = append(values, pk.Type.GenValue(r, g.partitionsConfig)...)
	}
	return values
}

And then extracts them by index assuming that index on resulted array matches PK:

func (rc *RoutingKeyCreator) CreateRoutingKey(table *Table, values []interface{}) ([]byte, error) {
	...
	for i := range partitionKeys {
		encoded, err := gocql.Marshal(
			partitionKeys[i].Type.CQLType(),
			values[i],
		)
		...

Having more then 1 value in GenValue for the any PK member will leat to have values not matching PK members and subsequent failure.

dkropachev avatar Apr 25 '23 03:04 dkropachev