Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow custom join implementations #1734

Closed
andig opened this issue Aug 20, 2019 · 1 comment
Closed

Feature request: allow custom join implementations #1734

andig opened this issue Aug 20, 2019 · 1 comment

Comments

@andig
Copy link

andig commented Aug 20, 2019

My use case is comparing daily PV data with averages data across the previous week.

One way to do this writing one query per day, adjusting timestamps and joining the tables. However the result- new table with duplicate field names with suffix per series is hard to work with, especially if not all series are always populated (null values/ empty windows).

Instead, it would seem plausible and straight forward to allow a custom join function based on an array of input rows, somewhat like this:

join(
    tables: {d1:d1, d2:d2, d3:d3, ...}, 
    on: ["_time"],
    fn: (tables, r) => (
        sum = 0
        count = 0
        for (i=0; i<tables.length, i++) {
            sum += tables[i]._value
            count++
        }
        if (count > 0) {
            r.value = sum/count
        }
    )
)

Implementation detail would be if time and window columns should already be pre-populated inside the function or left to the custom implementation. This would be orthogonal to #84.

Would this be helpful? Is the use case better suited for using other functions or would it rather make sense to combine timeshift and window(aggregate) into a new higher-order function?

Copy link

github-actions bot commented Jun 2, 2024

This issue has had no recent activity and will be closed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant