func TestWhereOnNullNumber(t *testing.T) {
f := &data.Frame{
RefID: "a",
Name: "a",
Fields: []*data.Field{
//data.NewField("d", nil, []*float64{p(2.35), p(math.NaN())}),
data.NewField("d", nil, []float64{2.35, math.NaN()}),
},
}
There are three general situations that SQL expressions does not handle gracefully that users should be aware of that are not bugs, but rather current limitations of the feature. Those are:
- Error Responses
- No Data Responses
- Dynamic Schema responses (Ones where columns are labels change between executions of the query)
{ | |
"__inputs": [ | |
{ | |
"name": "DS_MOCK", | |
"label": "Mock", | |
"description": "", | |
"type": "datasource", | |
"pluginId": "grafana-mock-datasource", | |
"pluginName": "Mock" | |
}, |
Note: much of this is moved to grafana/dataplane#56
Dataplane adds a data typing layer on top of data frames. By analogy Dataplane Types are to dataframes as typescript is to javascript.
Specifically, a property is added to the dataframe to indicate its type with is made up of a kind and a format, for example "Timeseries Wide".
HTTP/1.1 200 OK | |
Audit-Id: 5b82aaf1-4ba7-48bc-bb7b-94a7b89c6c5e | |
Cache-Control: no-store | |
Content-Type: application/json | |
X-Content-Type-Options: nosniff | |
X-Frame-Options: deny | |
X-Xss-Protection: 1; mode=block | |
Date: Fri, 19 Sep 2025 14:51:41 GMT | |
Content-Length: 902 | |
Connection: close |
/* Long | |
WITH movie_genre AS ( | |
SELECT | |
A.title, | |
A.year, | |
B.Genre AS genre | |
FROM A | |
JOIN B ON A.imdb_id = B.imdb_id | |
), | |
genre_totals AS ( |
package sql | |
import ( | |
"context" | |
"time" | |
mysql "github.com/dolthub/go-mysql-server/sql" | |
"github.com/dolthub/go-mysql-server/sql/types" | |
) |
SQL expressions in Grafana let you perform lightweight SQL-like transformations on the results of other queries — directly within the panel. This is great for reshaping, renaming, filtering, and aggregating data without modifying the original datasource query.
SQL expressions operate on the output of another query in the same panel, referenced by its query letter (e.g., A
, B
). These expressions are parsed and executed by Grafana — not sent to an external database.