Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with tuple fields in pk properly #286

Open
dkropachev opened this issue Apr 25, 2023 · 0 comments
Open

Does not work with tuple fields in pk properly #286

dkropachev opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@dkropachev
Copy link
Collaborator

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 dkropachev added the bug Something isn't working label Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant