Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sdks/go/test/regression/coders/fromyaml/fromyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ var unimplementedCoders = map[string]bool{
var filteredCases = []struct{ filter, reason string }{
{"logical", "BEAM-9615: Support logical types"},
{"30ea5a25-dcd8-4cdb-abeb-5332d15ab4b9", "https://github.com/apache/beam/issues/21206: Support encoding position."},
{"8c97b6c5-69e5-4733-907b-26cd8edae612", "https://github.com/apache/beam/issues/22629: Support single-precision float."},
}

// Coder is a representation a serialized beam coder.
Expand Down Expand Up @@ -339,6 +338,7 @@ var nameToType = map[string]reflect.Type{
"f_bool": reflectx.Bool,
"f_bytes": reflect.PtrTo(reflectx.ByteSlice),
"f_map": reflect.MapOf(reflectx.String, reflect.PtrTo(reflectx.Int64)),
"f_float": reflectx.Float32,
}

func setField(rv reflect.Value, i int, v interface{}) {
Expand All @@ -356,6 +356,12 @@ func setField(rv reflect.Value, i int, v interface{}) {
rf.SetString(v.(string))
case reflect.Int32:
rf.SetInt(int64(v.(int)))
case reflect.Float32:
c, err := strconv.ParseFloat(v.(string), 32)
if err != nil {
panic(err)
}
rf.SetFloat(c)
case reflect.Float64:
c, err := strconv.ParseFloat(v.(string), 64)
if err != nil {
Expand Down