Skip to content

Commit

Permalink
Merge pull request #318 from scylladb/dk/325-fix-genSinglePartitionQuery
Browse files Browse the repository at this point in the history
fix(genSinglePartitionQuery) It should generate stmt with not nil values
  • Loading branch information
dkropachev authored May 17, 2023
2 parents a7ac7f3 + 252c05b commit 9c4a80c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ func (s *Schema) genSinglePartitionQuery(t *Table, g *Generator, r *rand.Rand, p

tableName := t.Name
partitionKeys := t.PartitionKeys
values := valuesWithToken.Value.Copy()
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
Expand All @@ -734,13 +735,13 @@ func (s *Schema) genSinglePartitionQuery(t *Table, g *Generator, r *rand.Rand, p
}
if (ColumnDef{}) != mvCol {
mvValues = appendValue(mvCol.Type, r, p, mvValues)
mvValues = append(mvValues, valuesWithToken.Value...)
values = append(mvValues, values...)
}

return &Stmt{
ValuesWithToken: valuesWithToken,
Query: builder,
Values: mvValues,
Values: values,
Types: typs,
QueryType: SelectStatementType,
}
Expand Down

0 comments on commit 9c4a80c

Please sign in to comment.