influxdata / influxdata/giraffe

Improve UX of how fromFlux handles multiple types in _value column

Open
#455 0 comments 0 reactions 0 assignees View on GitHub
team/ui
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)

![image](https://user-images.githubusercontent.com/6411855/105431029-b40acd80-5c09-11eb-9e1e-5e9c8f524791.png)


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

![image](https://user-images.githubusercontent.com/6411855/105431095-cd137e80-5c09-11eb-80ec-b0fee12fb7bb.png)


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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.