apache / apache/beam

Protobuf schema provider row functions break on camel-case field names

Open
#21,066 0 comments 0 reactions 0 assignees View on GitHub
bug extensions java P3 protobuf
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

ProtoByteBuddyUtils.protoGetterName() _depends_ on field names being snake-case. But the Protobuf style guide only _recommends_ that field names are so defined.  

Snake-case is not enforced by protoc and my team have always created proto field names in camel-case (perhaps we didn't understand that protoc would automatically rewrite field names for us). It is likely that we are not alone.

If one calls a row function against a proto instance whose field were defined in camel-case, an IllegalArgumentException results from the ProtoByteBuddyUtils snake-case assumption.
```

SerializableFunction myRowFunction = new ProtoMessageSchema().toRowFunction(new TypeDescriptor()
{});
MyDataModel.ProtoPayload payload = …
Row row = (Row) myRowFunction.apply(payload);

```

Imported from Jira [BEAM-12736](https://issues.apache.org/jira/browse/BEAM-12736). Original Jira may contain additional context.
Reported by: chrishinds.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.