On Fri, Jan 16, 2015 at 1:16 PM, Gabriel Reid <[email protected]> wrote: > Just taking a look at this as well -- I guess another way of putting > it is that empty arrays don't (yet) exist in Phoenix (right?)
yes indeed. > My guess would be that it's more the fact that empty arrays don't > exist (if my assumption about that is correct), and then I guess it's > just less serialization overhead to store nothing than to store an > "empty" marker. > > I guess if the concept of empty arrays were to be introduced (by > storing them explicitly), the potential for backwards-compatibility > issues would be pretty minimal. Given that the current serialization format for arrays does not include a length value (if the base type is fixed width), I don't see how we can write an "empty" marker without changing the serialization format, thereby introducing a backwards incompatible change. I think this is exactly for the same reason as why you say it is not possible for varchar. Note that I first thought there already is a length value in the array serialization format, but if I am not mistaken that is only true if the array base type is variable length. That might have added some unnecessary confusion to the discussion.. What could probably be done is to introduce a new "array that supports empty arrays" type, but that doesn't sound like a decent workaround either. Jan
