Skip to content

Commit

Permalink
fix: bug when updating table to add cluster not reflected (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
irainia authored and deryrahman committed Nov 17, 2023
1 parent c229f8f commit 427f9ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/store/bigquery/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (t TableHandle) Update(ctx context.Context, res *resource.Resource) error {
}
}

if table.Cluster != nil {
metadataToUpdate.Clustering = toBQClustering(table.Cluster)
}

_, err = t.bqTable.Update(ctx, metadataToUpdate, "")
if err != nil {
var metaErr *googleapi.Error
Expand Down
3 changes: 3 additions & 0 deletions ext/store/bigquery/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ func TestTableHandle(t *testing.T) {
"type": "INTEGER",
},
},
"cluster": map[string]any{
"using": []string{"session"},
},
"partition": map[string]any{
"field": "product_day",
"type": "DAY",
Expand Down

0 comments on commit 427f9ac

Please sign in to comment.