Skip to content

Commit

Permalink
Revert "Properly calculate field length for SET columns in unit tests"
Browse files Browse the repository at this point in the history
This reverts commit 6435392.

Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Apr 24, 2024
1 parent b8e8132 commit 53b4ab4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const (
lengthInt = 11
lengthBlob = 65535
lengthText = 262140

// We have to hardcode the set lengths as we don't yet have an encoded way
// to calculate the length for the TableMap event,
// This is the expected length of the only SET column in the test schema.
lengthSet = 204
// This is the expected length of the only SET column using a binary collation
// in the test schema.
lengthSetBinary = 428
)

var (
Expand Down Expand Up @@ -502,9 +510,11 @@ func (ts *TestSpec) getFieldEvent(table *schemadiff.CreateTableEntity) *TestFiel
tc.len = lengthText
tc.colType = "text"
case "set":
tc.len = int64((len(col.Type.EnumValues) + 1) * (strings.Count(col.Type.EnumValues[0], ",") + 1))
if collation.IsBinary() {
tc.len = lengthSetBinary
tc.dataType = "BINARY"
} else {
tc.len = lengthSet
}
tc.colType = fmt.Sprintf("%s(%s)", tc.dataTypeLowered, strings.Join(col.Type.EnumValues, ","))
ts.metadata[getMetadataKey(table.Name(), tc.name)] = col.Type.EnumValues
Expand Down

0 comments on commit 53b4ab4

Please sign in to comment.