-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add support for different join types #84
Comments
Tasks could really use some of the other joins for retrieving task run logs. I think we can work around it in Go, but it would be a lot simpler if we could do it in straight Flux. |
There is a discrepancy between the documentation and the actual product. The documentation says:
But when using anything other than
I think the documentation should be updated to reflect the fact that only |
Any chance this issue will get some attention in the near future? A left join would be very handy for my use case. |
@legomind I'll try and get this prioritized for you. We currently have some other things in progress at the moment, but I'll let you know when we start work on this. |
@legomind Could you share your use case? Seeing an example Flux script of what you are trying to do along with the data schema you are using would be very helpful. Even if the Flux script doesn't work, just seeing how you would expect it to would is great. |
@jlapacik Thanks that would be awesome. My second energy monitor is attached directly to the dehumidifier and the measurements are recorded to another db. My goal is to take subtract the dehumidifiers energy use from the 'other' measurement. I am very new influxdb and any suggestions or improvements will be welcome. other_total = () => {
other = from(bucket: "iotawatt/autogen")
|> range($range)
|> filter(fn: (r) => r._measurement == "other_total" and r._field == "value")
|> aggregateWindow(every: $__interval, fn: mean)
|> keep(columns: ["_value", "_time"])
d = from(bucket: "home_assistant")
|> range($range)
|> filter(fn: (r) => r._measurement == "switch.living_room_dehumidifier" and r._field == "power_consumption")
|> aggregateWindow(every: $__interval, fn: mean)
|> keep(columns: ["_value", "_time"])
return join(tables: {o:other, d:d}, on: ["_time"])
|> map(fn: (r) => ({
_time: r._time,
_value: r._value_o - r._value_d,
_measurement: "Other", }))
}
other_total() |> yield(name: "Other") |
@legomind so if the dehumidifier is turned off for a period of time, currently |
Correct. |
I also got tripped up by this one trying to use left join with a very similar use case to @legomind - in my case I am trying to drop one series to 0 when another 'cutter' series is > 100, and am getting infrequent data from the 'cutter' series and would like to try with a left join.
NOTE: I am also fighting with combinations of and using |
@metareason Here is to hoping this is addressed soon with the addition of left outer joins. |
Just wondering if there was any movement on this. I am more than willing to test if needed. |
We will be addressing join's deficiencies at some point in the future. In the meantime we have added a new Note, |
Any chance for |
I am also not able to use |
I recently had a use case where there are two similar streams, each containing at least a URL as a key. Some of the URLs are in both streams and other are in only one. |
Hi there, I've recently elaborated further on this topic concerning Joining in the Flux query language. In the article below you can find a tutorial on how to perform a (full) outer join in flux applied on a realistic use case accompanied with some side notes about the previous lack of a decent join implementation: https://dzone.com/articles/how-to-pivot-and-join-time-series-data-in-flux |
This is for Flux (InfluxDB V2) In the UI, documentation on join() function includes: method:String However when I set method to left, I receive an error that left is not a valid join type "error calling function "join" @20:1-23:2: left is not a valid join type" Seems this has been an issue for a couple years now. Will this ever be resolved? I really need to be able to perform a left join - part of my POC of using InfluxDB. |
Hi @DLCrosby, |
@lavensj I will look at that again, however the issue remains - Documentation shows other joins besides "inner", however only "inner" works. When will the product be fixed to support additional join types? Given this was first brought up years ago, it is supremely disappointing that the only answer is a complex workaround. |
Hi, any plans to implement outer joins short termed? |
This would solve so many problems im having |
4 years after and still not implemented? |
Are there any plans to implement other types of joins? When will it be done? I'm looking very much forward to this feature. |
Thanks @sanderson for the update, you can follow our progress on this issue here where we have broken out the various steps #3459 |
Until the full join functionality is implemented, a good workaround is to use the combination of the union() and pivot() functions. Add the following code to final output stream for any table to be used in the downstream table_1 = from(bucket: "some_bucket_1") table_2 = from(bucket: "some_bucket_2") union(tables: [table_1, table_2]) |
This issue has had no recent activity and will be closed soon. |
Keep open |
@legomind Flux supports Inner, right, left, and full outer joins with the |
Just my ignorance. Lol. Had no idea about that package. Close away... |
Currently join implements the inner join operation. Join needs to support the following types of joins as well:
The text was updated successfully, but these errors were encountered: