Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add enum/map support to zjson #1430

Closed
mccanne opened this issue Oct 6, 2020 · 2 comments · Fixed by #1394
Closed

add enum/map support to zjson #1430

mccanne opened this issue Oct 6, 2020 · 2 comments · Fixed by #1394

Comments

@mccanne
Copy link
Collaborator

mccanne commented Oct 6, 2020

After the zjson branch is merged, we need to add zjson support for enum and map.

@philrz
Copy link
Contributor

philrz commented Oct 17, 2020

@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"
    ]
  ]
}

@nwt
Copy link
Member

nwt commented Oct 23, 2020

Done in #1394.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants