grafana/grafana

InfluxDB: Fix handling of field types when using the query builder

Open

#94,472 建立於 2024年10月9日

在 GitHub 查看
 (5 留言) (1 反應) (0 負責人)TypeScript (73,744 star) (13,868 fork)batch import
datasource/InfluxDBgood first issueinternalstale

描述

When using the visual editor to build a query with a WHERE clause on a field, we do not use the field's type when deciding whether to quote the value.

We cannot discern if quoting is necessary by looking at the value alone, as the same integer-like value, eg 10, should be quoted for a string field, but not quoted for a numeric field.

~ $ influx v1 shell
InfluxQL Shell dev
Connected to InfluxDB OSS v2.7.11
> USE grafana-plugin-dev
> FORMAT column
> SHOW FIELD KEYS ON "grafana-plugin-dev" FROM m
name: m
fieldKey    fieldType
--------    ---------
fieldstring string
> SELECT "fieldstring" FROM "m" WHERE fieldstring::field != '10'
name: m
time               fieldstring
----               -----------
1.747688070443e+12 kdkdkdk
1.747688208187e+12 kdkdkdk
> SELECT "fieldstring" FROM "m" WHERE fieldstring::field != 10
> QUIT
Goodbye!

This is not restricted to the operator type.

貢獻者指南