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

Can't extend/project when field name has period #11

Open
hairyhenderson opened this issue Sep 29, 2023 · 2 comments
Open

Can't extend/project when field name has period #11

hairyhenderson opened this issue Sep 29, 2023 · 2 comments

Comments

@hairyhenderson
Copy link

Given some JSON like this:

[
    {
        "labels": {
            "foo.bar.baz/qux": 42
        }
    }
]

I expect to be able to grab the innermost field like this (or with some other syntax):

parse-json
| extend "quux"="labels.foo.bar.baz/qux"

But it's silently missed.

Here it is in the Infinity datasource:
image

Looking at get_single_value (

export const get_single_value = (input: any, query: string): string | number | any[] => {
) it seems that it's using Lodash's get, which can work around the issue by taking an array-type argument:

> _.get({"l": {"a.b": 42}}, "l.a.b")
undefined
> _.get({"l": {"a.b": 42}}, ["l", "a.b"])
42

I wonder if the fix is as simple as changing get_single_value's query type from string to any?

@yesoreyeram
Copy link
Owner

yesoreyeram commented Oct 2, 2023

What about extend "quax"="labels['foo.bar.baz/qux']" as a workaround? Haven't tested btw.

@hairyhenderson
Copy link
Author

@yesoreyeram ah! that works! I guess some documentation is missing somewhere 😅

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

No branches or pull requests

2 participants