-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Count and Count distinct functions for tsds #128530
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
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some comments, but this looks great. Thanks @pabloem
@FunctionInfo(returnType = { "integer", "long" }, description = "The count over time value of a field.", type = FunctionType.AGGREGATE) | ||
public CountOverTime( | ||
Source source, | ||
@Param(name = "field", type = { "aggregate_metric_double", "double", "integer", "long" }) Expression field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method supports more types rather than these. Can you copy the list from the count function?
|
||
@Override | ||
public CountDistinct perTimeSeriesAggregation() { | ||
// TODO(pabloem): Do we need to take in a precision parameter here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we should have it.
description = "The count of distinct values over time for a field.", | ||
type = FunctionType.AGGREGATE | ||
) | ||
public DistinctOverTime( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call it CountDistinctOverTime? I'm okay with DistinctOverTime, but I prefer to keep it consistent with count_distinct.
) | ||
public DistinctOverTime( | ||
Source source, | ||
@Param(name = "field", type = { "aggregate_metric_double", "double", "integer", "long", "float" }) Expression field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I think this function supports more than these types. Can you copy the list from count_distinct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one question
CountOverTime::new | ||
); | ||
|
||
@FunctionInfo(returnType = { "integer", "long" }, description = "The count over time value of a field.", type = FunctionType.AGGREGATE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what scenario does this return integer? The returnType
and dataType()
for Count
appears to only return longs
); | ||
|
||
@FunctionInfo( | ||
returnType = { "integer", "long" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as before about when does this return integers?
PTAL @dnhatn ? : )
LMK if you have any questions!