-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Latest UDAF. #4395
Comments
To support this, we'll need to extend UDAFs to support more parameters: which is a long overdue feature in itself. |
Might be best called |
One question is: Should
|
@miguno - this was my suggestion. I thought I had found some precedent for that somewhere... I'll let you know if I find that |
@miguno I guess I don't get your point.
According to the function signature Andy implied above it has to be only a specific data field, otherwise
I don't agree with your conclusion. If x is an integer,
the proper solution for the linked problem using SELECT
ARGMIN(value, id) AS id,
name,
MIN(value) AS value
FROM test
GROUP BY name; but I think if you want the whole row back, then something along those lines would be more useful: SELECT
*
FROM test
GROUP BY name
HAVING value = MIN(value) (I'm not a SQL guy, so I'm not sure if the last query actually works, but I think it should work 😉; also again not sure what would/should happen if value is ambiguous) |
Closing as a duplicate of #3985 |
I think it should only return a single field, as you might want to combine it with other aggregate functions in the same query, e.g.
|
Many users are requesting some variant of a
LATEST
udaf.For example, consider a stream of IOT data:
Users would like to be able to build a table from this data, capturing the latest
temp
andquality
for a given sensor.Such an operation should be possible if we add a
LATEST
UDAF. Note, the UDAF will only work on stream sources. It's not possible to supportLATEST
on table sources due to the fact that tables can have values retracted.The UDAF would take two parameters:
The UDAF will only update the value if the timestamp of the new value is greater.
Table of data can be built with something like:
The text was updated successfully, but these errors were encountered: