Skip to content

How to extract json-object and count the value #10220

@c2h4ds

Description

@c2h4ds

I have a json-type column in pinot like below:
{"value1":1, "value2":2, "value3":3}
{"value1":2, "value4":4, "value5":1}
{"value2":3, "value3":1}

now I just wanna extract the key and count the value of each key, the result is shown like below:
"value1":3
"value2":5
"value3":4
"value4":4
"value5":1

I mean there are more than 5 kinds of "values"(maybe value6, value7 ...) so how to write the corresponding sql ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions