Closed henridf closed 4 years ago
We had a discussion where the conclusion was that this could be addressed as part of a broader re-working of expressions (other more or less closely related issues are #846 and #850 )
I can verify that this was fixed in zq
commit 56ed80d
that's associated with #1375. The alias is now preserved.
$ cat aliasin.tzng
#ipaddr=ip
#0:record[host:ipaddr]
0:[127.0.0.1;]
$ zq -t "put host2=host" aliasin.tzng
#ipaddr=ip
#0:record[host:ipaddr,host2:ipaddr]
0:[127.0.0.1;127.0.0.1;]
Thanks @mccanne!
When evaluating an expression over a field that has an aliased type, that alias is lost (during the roundtrip to the zngnative domain). A simple example here with just a field copy:
Note that rather than consider this as a bug that should be directly fixed (such as somehow plumbing things to allow alias restoration upon re-entry from the zngnative world), we could also view it as an opportunity to step back and re-assess whether aliases are really needed in the zng (as opposed to a thin compatibility layer at the edges of zeekio).
(I ran into this issue while working on #535, where switching groupby keys to use expressions has broken a test on aliased key types).