Skip to content

Commit

Permalink
Merge pull request #212 from scylladb/using_mv_after_async_reapplicat…
Browse files Browse the repository at this point in the history
…ion_implemented

schema: re-added materialized views queries
  • Loading branch information
Henrik Johansson authored Nov 26, 2019
2 parents 84f74b3 + 77aaf1f commit 6993fd8
Showing 1 changed file with 22 additions and 31 deletions.
53 changes: 22 additions & 31 deletions schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,13 +844,11 @@ func (s *Schema) genSinglePartitionQuery(t *Table, g *Generator, r *rand.Rand, p

tableName := t.Name
partitionKeys := t.PartitionKeys
// TODO: Support materialized views
/*
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
}*/
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
}
builder := qb.Select(s.Keyspace.Name + "." + tableName)
typs := make([]Type, 0, 10)
for _, pk := range partitionKeys {
Expand Down Expand Up @@ -881,14 +879,11 @@ func (s *Schema) genMultiplePartitionQuery(t *Table, g *Generator, r *rand.Rand,
)
tableName := t.Name
partitionKeys := t.PartitionKeys
// TODO: Support materialized views
/*
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
}
*/
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
}
pkNum := r.Intn(len(partitionKeys))
if pkNum == 0 {
pkNum = 1
Expand Down Expand Up @@ -925,14 +920,12 @@ func (s *Schema) genClusteringRangeQuery(t *Table, g *Generator, r *rand.Rand, p
tableName := t.Name
partitionKeys := t.PartitionKeys
clusteringKeys := t.ClusteringKeys
// TODO: Support materialized views
/*
if len(t.MaterializedViews) > 0 && p.Rand.Int()%2 == 0 {
view := p.Rand.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
clusteringKeys = t.MaterializedViews[view].ClusteringKeys
}*/
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
clusteringKeys = t.MaterializedViews[view].ClusteringKeys
}
builder := qb.Select(s.Keyspace.Name + "." + tableName)
vs, ok := g.GetOld()
if !ok {
Expand Down Expand Up @@ -977,14 +970,12 @@ func (s *Schema) genMultiplePartitionClusteringRangeQuery(t *Table, g *Generator
tableName := t.Name
partitionKeys := t.PartitionKeys
clusteringKeys := t.ClusteringKeys
// TODO: Support materialized views
/*
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
clusteringKeys = t.MaterializedViews[view].ClusteringKeys
}*/
if len(t.MaterializedViews) > 0 && r.Int()%2 == 0 {
view := r.Intn(len(t.MaterializedViews))
tableName = t.MaterializedViews[view].Name
partitionKeys = t.MaterializedViews[view].PartitionKeys
clusteringKeys = t.MaterializedViews[view].ClusteringKeys
}
pkNum := r.Intn(len(partitionKeys))
if pkNum == 0 {
pkNum = 1
Expand Down

0 comments on commit 6993fd8

Please sign in to comment.