Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lang] Add escape syntax for field names
Related to rcoh#99 Currently field names containing a space or period, e.g. `date received` or `grpc.method`, cannot be parsed. This could be worked around using `jq` or similar tools to rewrite the field name, but that's a pain. This commit adds an escaped field name syntax of `["<FIELD>"]` which is based on the Object Identifier-Index syntax[0] used by `jq`, so it should be somewhat familiar to many people who parse JSON on the command line. The more obvious option of delimiting with just quotes, e.g. "date received", creates an ambiguity between string literals and escaped field names. For example, does `where foo == "date received"` mean field `foo` matches field `date received`, or field `foo` matches the string "date received"? Example query: ``` * | json | where ["grpc.method"] == "Foo" | count by ["date received"] ``` [0] https://stedolan.github.io/jq/manual/#ObjectIdentifier-Index:.foo,.foo.bar
- Loading branch information