我正在使用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
不确定我错过了什么。
答案 0 :(得分:1)
您的字段中存储的数据类型是什么?结果应该代表什么?
如果我尝试对两个字符串字段进行除法,我会得到相同的结果。
> 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