influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
61 stars 23 forks source link

Write command will not accept zero-length fields in CSV input #425

Open adrian-thurston opened 2 years ago

adrian-thurston commented 2 years ago

If I write the following line protocol to influxdb:

m,tag=zl v=""

The data is accepted. I can then query it out again using:

from(bucket: "devel")
|> range( start: 0 )
|> filter( fn: (r) => r._measurement == "m" )
|> filter( fn: (r) => r.tag == "zl" )
|> filter( fn: (r) => r._field == "v" )
|> filter( fn: (r) => r._value == "" )

Using the command line:

influx query -r -f zero-length.flux

Which produces:

#group,false,false,true,true,false,false,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,string,string
#default,_result,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,tag
,,0,1970-01-01T00:00:00Z,2022-07-15T23:09:15.783169877Z,2022-07-15T23:07:46.992057985Z,,v,m,zl

If I try to write this back to the database using

influx write --format=csv -f zero-length.csv -b devel

I get the following error:

2022/07/15 23:13:30 line 5: no field data found