influxdata / influxdata/influx-cli

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

Open
#425 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the round trip using zero-length.flux and zero-length.csv with `influx query` and `influx write --format=csv`. Start at the CSV handling behind the `influx write` command and trace why an empty `_value` is treated as missing field data; done means the exported CSV can be written back successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.