influxdata / influxdata/influxdb

Flux: Flattening of stream records with array property in the record type

Open
#26,353 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

I am looking to sanitise some data for forecasts made from a point in time, stored in a field as JSON. I have been able to convert this JSON column field into an array type, and have been able to conform to the following signature:

stream[{_time: time, _values: [{_at: time, _value: float}]}]

I intend to "flatten" this stream of arrays into something where I can see forecast convergence, essentially, creating a sort of pivot. But for this, I need to perform some operation to get this signature:

stream[{_time: time, _at: time, _value: float}]

Essentially, for every record in the stream, there will be 0...n records on the output, but they will be within the same time domain before the pivot.

I am looking to use a query/task within Influx to deal with this before taking to an external solution to manage the "flattening" of nested values. The records are also being written by a tool I have limited control over.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Flux query/task capabilities for iterating an array-valued record and check whether a built-in operation can produce one output record per nested value. Done means transforming stream[{_time: time, _values: [{_at: time, _value: float}]}] into stream[{_time: time, _at: time, _value: float}] while preserving the time fields and supporting zero or more output records.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.