On Tue, Jul 9, 2019, at 15:29, Jose Armando Garcia Sancio wrote: > Thanks Colin for the KIP. For my own edification why are we doing this > "Optional fields can have any type, except for an array of structures."? > Why can't we have an array of structures?
Optional fields are serialized starting with their total length. This is straightforward to calculate for primitive fields like INT32, (or even an array of INT32), but more difficult to calculate for an array of structures. Basically, we'd have to do a two-pass serialization where we first calculate the lengths of everything, and then write it out. The nice thing about this KIP is that there's nothing in the protocol stopping us from adding support for this feature in the future. We wouldn't have to really change the protocol at all to add support. But we'd have to change a lot of serialization code. Given almost all of our use-cases for optional fields are adding an extra field here or there, it seems reasonable not to support it for right now. best, Colin > > -- > -Jose >