On Wed, Mar 30, 2016 at 6:21 PM, Gwen Shapira <g...@confluent.io> wrote:

> Ismael, can you detail how the Optional approach would work in the wire
> protocol? It sounds good, but I'm unclear on what this would look like on
> the wire.
>

In the wire protocol, we would still use a size of -1 like we normally do
for nullable strings and nullable bytes. So, it's still a bit magical, but
efficient and associated with the right field (which avoids some invalid
states that are possible if we use two fields). In other words, each
implementation of the protocol is responsible for figuring out an idiomatic
and hopefully safe way to represent the absence of a value.

In Java (Scala would be similar) we would convert this to an
Optional<List<String>> to make it clear that the value could be absent (and
avoid NPEs). The fact that absence of a value means "all topics" makes
sense if one thinks about that field as a filter (absence of a value means
no filter).

I can see pros and cons for each approach, personally. :)

Ismael

Reply via email to