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

unsupported value: +Inf #853

Closed
simPod opened this issue Jun 5, 2024 · 5 comments
Closed

unsupported value: +Inf #853

simPod opened this issue Jun 5, 2024 · 5 comments
Labels
datasource/ClickHouse type/bug Something isn't working

Comments

@simPod
Copy link

simPod commented Jun 5, 2024

What happened:

json: unsupported value: +Inf: Could not process SQL results

What you expected to happen:

success

How to reproduce it (as minimally and precisely as possible):

SELECT t, arrayMap(a -> (a.1, a.2/runningDifference( t/1000 )), groupArr)
FROM (
    SELECT t, groupArray((query, c)) AS groupArr FROM (
        SELECT (intDiv(toUInt32(event_time), 4) * 4) * 1000 AS t, substring(query, 1, 45) AS query, count() c FROM system.query_log
        WHERE $__timeFilter(event_time) AND
            cityHash64(query) global in (
                SELECT cityHash64(substring(query,  1,  45)) AS h
                FROM system.query_log
                WHERE $__timeFilter(event_time)
                    AND type in ($type)
                    -- AND initial_user in ('', $user)
                    AND('$query_type' = 'all' or(positionCaseInsensitive(query,  '$query_type') = 1))
                GROUP BY h
                ORDER BY count() desc
                LIMIT 20
            )
            AND type in ($type)
            -- AND initial_user in ()
            AND('$query_type' = 'all' or(positionCaseInsensitive(query,  '$query_type') = 1))
        GROUP BY event_time, query
    )
    GROUP BY t ORDER BY t
) LIMIT 1

Screenshots

Anything else we need to know?:

Environment:

  • Grafana version: Grafana v10.4.3 (6e6fbf6a34)
  • Plugin version: 4.0.7
  • OS Grafana is installed on: ubuntu
  • User OS & Browser: chrome
  • Others:
@adamyeats
Copy link
Contributor

adamyeats commented Jun 11, 2024

Hey @simPod thanks for reporting this! I think this might possibly be something to do with the query itself.

If I'm not mistaken, looking at the first line of your query, arrayMap(a -> (a.1, a.2/runningDifference( t/1000 )), groupArr) computes the difference between the current and the previous value of t / 1000. If two consecutive values of t are the same, runningDifference(t / 1000) will return 0, leading to a division by zero and then (I think!), a +Inf. Is that a possibility?

The json: unsupported value: +Inf error message would be expected in that case as json.Marshal is unable to parse those values.

@adamyeats adamyeats moved this from Incoming to Waiting in Partner Datasources Jun 11, 2024
@simPod
Copy link
Author

simPod commented Jun 11, 2024

Yes, I though it might be something with the query itself. But the plugin should give user maybe more verbose message?

@SpencerTorres
Copy link
Collaborator

This is actually one of the more helpful error messages I've seen from the plugin, not sure if we can get any more specific than that since errors can be caused by so many things in the query.

I do still want to improve the errors seen on the query editor, but this one makes sense.

Perhaps we could avoid the error by setting the value to some reasonable value, either max_int or 0, but I wouldn't want to manipulate the response like that

@adamyeats
Copy link
Contributor

Perhaps we could avoid the error by setting the value to some reasonable value, either max_int or 0, but I wouldn't want to manipulate the response like that

This is something we can definitely put on the backlog for future consideration. 👍

@adamyeats adamyeats moved this from Waiting to Backlog in Partner Datasources Jun 12, 2024
@simPod
Copy link
Author

simPod commented Jun 12, 2024

Don't bother with it much. Thanks. Close at will.

@github-project-automation github-project-automation bot moved this from Backlog to Done in Partner Datasources Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource/ClickHouse type/bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants