如何使用 InfluxDb 查询语言划分两个字段
How to divide two fields using InfluxDb query language
我正在使用InfluxDB,我想划分两个字段。
我正在选择结果的查询工作正常。
SELECT "payload-length" ,"in-data" FROM "test50"."autogen"."SYS-LOG"
但是当我尝试划分这两个字段时出现错误,
SELECT "payload-length" / "in-data" FROM "test50"."autogen"."SYS-LOG"
我得到的错误是:
unable to construct transform iterator from *influxql.stringChanIterator and *influxql.stringChanIterator
不确定我错过了什么。
您的字段中存储的数据类型是什么?结果应该代表什么?
如果我尝试对两个字符串字段进行除法,我会得到相同的结果。
> insert mymeasurement,tag1=tag1,tag2=tag2 fieldA="aaa",fieldB="bbb"
> insert mymeasurement,tag1=tag1,tag2=tag2 field1=500,field2=20
> select * from mymeasurement;
name: mymeasurement
time field1 field2 fieldA fieldB tag1 tag2
---- ------ ------ ------ ------ ---- ----
1505944438559106045 aaa bbb tag1 tag2
1505944483558339332 500 20 tag1 tag2
> show field keys from "mymeasurement"
name: mymeasurement
fieldKey fieldType
-------- ---------
field1 float
field2 float
fieldA string
fieldB string
> select field1 / field2 from mymeasurement
name: mymeasurement
time field1_field2
---- -------------
1505944483558339332 25
> select fieldA , fieldB from mymeasurement
name: mymeasurement
time fieldA fieldB
---- ------ ------
1505944438559106045 aaa bbb
> select fieldA / fieldB from mymeasurement
ERR: unable to construct transform iterator from *influxql.stringChanIterator and *influxql.stringChanIterator
我正在使用InfluxDB,我想划分两个字段。
我正在选择结果的查询工作正常。
SELECT "payload-length" ,"in-data" FROM "test50"."autogen"."SYS-LOG"
但是当我尝试划分这两个字段时出现错误,
SELECT "payload-length" / "in-data" FROM "test50"."autogen"."SYS-LOG"
我得到的错误是:
unable to construct transform iterator from *influxql.stringChanIterator and *influxql.stringChanIterator
不确定我错过了什么。
您的字段中存储的数据类型是什么?结果应该代表什么?
如果我尝试对两个字符串字段进行除法,我会得到相同的结果。
> insert mymeasurement,tag1=tag1,tag2=tag2 fieldA="aaa",fieldB="bbb"
> insert mymeasurement,tag1=tag1,tag2=tag2 field1=500,field2=20
> select * from mymeasurement;
name: mymeasurement
time field1 field2 fieldA fieldB tag1 tag2
---- ------ ------ ------ ------ ---- ----
1505944438559106045 aaa bbb tag1 tag2
1505944483558339332 500 20 tag1 tag2
> show field keys from "mymeasurement"
name: mymeasurement
fieldKey fieldType
-------- ---------
field1 float
field2 float
fieldA string
fieldB string
> select field1 / field2 from mymeasurement
name: mymeasurement
time field1_field2
---- -------------
1505944483558339332 25
> select fieldA , fieldB from mymeasurement
name: mymeasurement
time fieldA fieldB
---- ------ ------
1505944438559106045 aaa bbb
> select fieldA / fieldB from mymeasurement
ERR: unable to construct transform iterator from *influxql.stringChanIterator and *influxql.stringChanIterator