Closed mccanne closed 4 years ago
@mccanne: It looks like this one is already taken carte of. Starting with zq
commit fa68b5f
(associated with #1394 where enum
and map
types were added for ZNG in general) I can output both enum
and map
in zjson format. Anything else left to do?
$ zq -version
Version: v0.22.0-25-gfa68b5f
$ cat enum.tzng
#0:record[e:enum[int32,foo:[1],bar:[2],baz:[4]]]
0:[0;]
0:[1;]
0:[2;]
$ zq -f zjson enum.tzng | jq .
{
"id": 24,
"schema": {
"of": [
{
"name": "e",
"of": [
{
"type": "int32"
},
{
"name": "foo",
"value": "1"
},
{
"name": "bar",
"value": "2"
},
{
"name": "baz",
"value": "4"
}
],
"type": "enum"
}
],
"type": "record"
},
"values": [
"0"
]
}
{
"id": 24,
"values": [
"1"
]
}
{
"id": 24,
"values": [
"2"
]
}
$ cat map.tzng
#0:record[m:map[string,int32]]
0:[[a;1;b;2;c;3;]]
$ zq -f zjson map.tzng | jq .
{
"id": 24,
"schema": {
"of": [
{
"name": "m",
"of": [
"string",
"int32"
],
"type": "map"
}
],
"type": "record"
},
"values": [
[
"a",
"1",
"b",
"2",
"c",
"3"
]
]
}
Done in #1394.
After the zjson branch is merged, we need to add zjson support for enum and map.