influxdata / influxdata/giraffe
Improve UX of how fromFlux handles multiple types in _value column
- Dominant language
- TypeScript
- Stars
- 189
- Forks
- 33
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
Currently `fromFlux` handles multiple types in `_value` column by creating several new columns called `_value ('string')`, `_value ('boolean')`, etc and this is very confusing to the end user who is relying on the `_value` column to exist.
See explanation here: https://github.com/influxdata/giraffe/blob/master/giraffe/src/utils/fromFlux.ts#L62
Here's an example data set where this occurs:
[multiple measurements.csv.zip](https://github.com/influxdata/giraffe/files/5852930/multiple.measurements.csv.zip)

`fromFlux` creates `_value ('string')` and `_value ('number')`:

Typically I try and retrieve the values with `table.getColumn('_value')[i]` however in this case `_value` does not exist. As the user I am forced to search through all the `columnKeys` for the column that contains my value at index `i`. This can be done via some wacky regex like `/_value( \('\w*'\))?/g` but isn't great UX.
I see 2 potential solutions:
1. When the user asks for `_value` column via the `getColumn` function, combine all the value columns and return all the values, regardless of type. A downside to this solution is adapting `getColumnType` to this behavior. I guess it would return `any`?
1. Introduce a new function (or an overload of `getColumn`) that allows the user to provide the index of the value they are looking for. `getColumn('_value', i)` for example. This function would do the hard work of finding the corresponding `_value('...')` column for the user and return the entry at that index.
Contributor guide
Research direction
Start in giraffe/src/utils/fromFlux.ts around line 62, then trace getColumn and getColumnType to understand how typed _value columns are represented. Compare the two proposed retrieval approaches against the supplied multiple-measurements example; done means callers can retrieve _value without searching columnKeys, with the resulting type behavior defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100