MySQL Datasource, JSON_EXTRACT() query not working

Hello,

I have a table with the following schema:

mysql> desc alldata;
+------------------+-------------+------+-----+---------+-------+
| Field            | Type        | Null | Key | Default | Extra |
+------------------+-------------+------+-----+---------+-------+
| vtime            | int(11)     | NO   | PRI | 0       |       |
| hitrate          | float(10,2) | YES  |     | NULL    |       |
| requests         | int(11)     | NO   |     | 0       |       |
| errors           | text        | NO   |     | NULL    |       |
| cache_hits       | int(11)     | NO   |     | 0       |       |
| rps              | float(10,2) | NO   |     | 0.00    |       |
| cps              | float(10,2) | NO   |     | 0.00    |       |
| mbps             | float(10,2) | NO   |     | 0.00    |       |
| bytes            | int(11)     | NO   |     | 0       |       |
| attacks          | text        | YES  |     | NULL    |       |
| blacklist        | text        | YES  |     | NULL    |       |
| malicious        | text        | YES  |     | NULL    |       |
| cache_type       | text        | NO   |     | NULL    |       |
| geo_hits         | text        | NO   |     | NULL    |       |
| requests_matched | int(11)     | NO   |     | 0       |       |
| requests_total   | int(11)     | NO   |     | 0       |       |
+------------------+-------------+------+-----+---------+-------+
16 rows in set (0.08 sec)

mysql> 

I’m currently able to plot “requests” and “cache_hits” using:

SELECT
  vtime AS "time",
  requests,
  cache_hits
FROM alldata
WHERE
  $__unixEpochFilter(vtime)
ORDER BY vtime

However, when I add JSON_EXTRACT as shown below, nothing comes up for “Errors”:

SELECT
  vtime AS "time",
  requests,
  cache_hits,
  JSON_EXTRACT(errors,"$.total") AS "Errors"
FROM alldata
WHERE
  $__unixEpochFilter(vtime)
ORDER BY vtime

If I manually run that query however, I get the expected results (numerical value of “Errors”)

This is what it looks like before the JSON_EXTRACT:

And this is what it ends up looking like after I add it in:

The error values are typically low, between 0-100

It seems to plot the expected values when adding an ‘avg’ or ‘sum’ aggregate as seen in the following, but I’m not entirely sure why:

Can someone explain why aggregate would be needed in this case please?