Client
Bigtable emulator (bigtable/bttest)
Environment
go version go1.23.3 darwin/arm64
Code and Dependencies
Add the following test to bigtable/bttest/inmem_test.go:
func TestUpdateGCPolicyOnAggregateColumnFamily(t *testing.T) {
ctx := context.Background()
s := &server{
tables: make(map[string]*table),
}
tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{
Parent: "cluster",
TableId: "t",
Table: &btapb.Table{
ColumnFamilies: map[string]*btapb.ColumnFamily{
"sum": {
ValueType: &btapb.Type{
Kind: &btapb.Type_AggregateType{
AggregateType: &btapb.Type_Aggregate{
InputType: &btapb.Type{
Kind: &btapb.Type_Int64Type{},
},
Aggregator: &btapb.Type_Aggregate_Sum_{
Sum: &btapb.Type_Aggregate_Sum{},
},
},
},
},
},
},
},
})
if err != nil {
t.Fatal(err)
}
_, err = s.ModifyColumnFamilies(ctx, &btapb.ModifyColumnFamiliesRequest{
Name: tblInfo.Name,
Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{
{
Id: "sum",
Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Update{
Update: &btapb.ColumnFamily{
GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}},
},
},
},
},
})
if err != nil {
t.Fatal(err)
}
}
This test fails with the following error:
=== RUN TestUpdateGCPolicyOnAggregateColumnFamily
inmem_test.go:2759: rpc error: code = InvalidArgument desc = Immutable fields 'value_type.aggregate_type' cannot be updated
--- FAIL: TestUpdateGCPolicyOnAggregateColumnFamily (0.00s)
Expected behavior
In the above example, we are merely trying to override the GC policy of the aggregate column family in the Bigtable emulator. We aren't in any way attempting to mutate the type of the column family. Therefore, I would expect this test to succeed.
Actual behavior
The Bigtable emulator does not seem to allow for a partial modification of an aggregate column family, and it mistakenly believes that the GC policy update also contains a (nil) modification to the aggregate column family type. This causes the above test to fail.
Client
Bigtable emulator (
bigtable/bttest)Environment
Code and Dependencies
Add the following test to
bigtable/bttest/inmem_test.go:This test fails with the following error:
Expected behavior
In the above example, we are merely trying to override the GC policy of the aggregate column family in the Bigtable emulator. We aren't in any way attempting to mutate the type of the column family. Therefore, I would expect this test to succeed.
Actual behavior
The Bigtable emulator does not seem to allow for a partial modification of an aggregate column family, and it mistakenly believes that the GC policy update also contains a (
nil) modification to the aggregate column family type. This causes the above test to fail.