influxdata / ui

UI for InfluxDB
95 stars 42 forks source link

Tech Debt: "View Raw Data" mode shows incorrect column data types #3397

Open philjb opened 2 years ago

philjb commented 2 years ago

About the bug

In cell edit/configure mode, you can switch from the plot to a raw data table view. This view shows all the data in a tab separated view but only one column header per page of data.

But the raw data typically has many tables and the data types of the columns do not have to be the same among all the tables (table column is typically just an integer 0, 1, etc to designate the different series keys of the results).

In the ui, this raw data view is the only way to see the data types of the query response.

And if the data has mixed data types, the raw data view is wrong in the header column. Compare to downloading the annotated csv, which shows one column header row per table.

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. Load data with with similar series keys but two different datatypes. e.g.
    weather,location=nyc temp=43.12
    weather,location=miami temp=72i
  2. query for the data in a cell (e.g. data explorer)
  3. switch to edit the chart, and click "View Raw Data"
  4. Note that the column header will show either "long" or "double" depending on which table/series key gets loaded first.

Expected behavior:

Raw data view correctly updates column headers when series keys change. The preview Raw Data modal did this correctly by repeating the column headers.

Actual behavior:

Raw Data shows incorrect data types.

Visual Proof:

Note that there are 6 different tables shown in this screenshot.

Screen Shot 2021-12-03 at 5 14 19 PM

Screen Shot 2021-12-07 at 4 17 23 PM This one shows the same data just with a different sort and now the column is double Screen Shot 2021-12-03 at 5 19 27 PM

About your environment

cloud2 Environment info:

Config:

NA

Logs:

NA Performance: NA

ChitlangeSahas commented 2 years ago

I tried this with two very different data types, boolean and number and we can see they split the table. Since an int is also a long, the tables in the above picture seem like a bug but it is not.

Screen Shot 2022-01-18 at 12 31 40 PM

Hope this clarifies it, please let me know if there are any questions / clarification needed 👍

philjb commented 2 years ago

@ChitlangeSahas - I don't understand fully. My report used as an example data types double (aka float) and long (aka long int) which are not the same data types. Your reply focused on int and long being the same.

In reviewing, I did notice that i had an important mistake in the example line protocol - I forgot the i for the integer field. I have corrected that in the description.

The line protocol I used for the below screenshots was

weather,location=nyc temp=43.12
weather,location=miami temp=72
weather,location=houston temp=80i

then adding

weather,location=earth temp=true

I can still reproduce the issue internally where the raw view does not show separate tables for data types double and long. I was also able to reproduce your example where boolean and double are shown as separate tables.

See this screenshot with mixed data types and a screenshot of the csv output for the same that shows that one value has a data type of long and the other two double. I believe these data types should render as different tables with separate headers since the types are different.

Screen Shot 2022-01-18 at 3 44 41 PM Screen Shot 2022-01-18 at 3 43 59 PM
philjb commented 2 years ago

When I add a boolean field, it gets weirder still. Now I get 3 tables (3 headers) but 72 which is a double in the csv is displayed as a long and then values 80 which is a long in the csv and 43.12 which is a double in the csv are both shown as longs. So several issues now.

Screen Shot 2022-01-18 at 3 57 06 PM Screen Shot 2022-01-18 at 4 01 05 PM
kristinarobinson commented 2 years ago

After some triaging, will require deep dive into ui code that parses flux into table to giraffe. Delaying until sprint 3.