brimdata / super

A novel data lake based on super-structured data
https://zed.brimdata.io/
BSD 3-Clause "New" or "Revised" License
1.39k stars 64 forks source link

unify zcode unset primitive/container #1420

Closed mccanne closed 4 years ago

mccanne commented 4 years ago

There shouldn't be two encodings for unset. Many places have to know whether a type is a container to append the right unset value even though it had to know nothing else about the type.

The modified tag encoding could be

0 = nil
1 = zero-length primitive (e.g., "" or int 0)
N/2 even = primitive of length (N/4)
N/2 odd = container of length (N/4)-1

This will change the zng format and should be part of zng-beta.

philrz commented 4 years ago

@mccanne mentioned that this has already been done, and @nwt confirmed the references to tagNull in zcode/bytes.go as added as part of #1394 is evidence of this.