-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 value ranges for GeoTile aggregation metrics metrics in the meta layer #71611
Add value ranges for GeoTile aggregation metrics metrics in the meta layer #71611
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
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.
Let's get the bug-fix in, but let's wait with handling aggregations here. I think I have a more generic solution to this one.
@@ -226,9 +234,31 @@ public void setSize(int size) { | |||
} | |||
|
|||
public void setAggBuilder(AggregatorFactories.Builder aggBuilder) { | |||
// TODO: validation | |||
for (AggregationBuilder aggregation : aggBuilder.getAggregatorFactories()) { |
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.
Let's wait with this. I think I have some idea on how to make this more generic.
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 still wonder if 1) this should responsibility of the callers and 2) if we want to add these pipeline aggs, we need to throw an exception if we don't recognize the agg
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.
My hope is that a user of this API does not need to be an expert on Elasticsearch so we can provide this information from them. I am hoping to only support a subset of the aggregations, the ones that make sense.
@@ -57,10 +57,10 @@ public void box(VectorTile.Tile.Feature.Builder featureBuilder, double minLon, d | |||
} | |||
|
|||
private int lat(double lat) { | |||
return (int) (pointYScale * (VectorTileUtils.latToSphericalMercator(lat) - rectangle.getMinY())) + extent; | |||
return (int) Math.round(pointYScale * (VectorTileUtils.latToSphericalMercator(lat) - rectangle.getMinY())) + extent; |
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.
We should still probably get this in.
Thanks @imotov , I merged your changes into this PR, and the output of the pipeline aggregations are now added to the meta layer using your approach (very cool) |
Nice! |
// top term and percentile should be supported | ||
throw new IllegalArgumentException("Unknown feature type [" + type + "]"); | ||
} | ||
addToXContentToFeature(featureBuilder, layerProps, aggregation); |
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.
Let's add the result of aggregations from the Content as well
I moved the methods that add properties to the layer to a hyper class and rename some of the methods. @imotov should be push this PR? |
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.
Let's get this in, but I would love to iterate on it a bit more next. Something bothers me about this case statement with hardcoded list of 5 aggregations. I feel like it really can be any NumericMetricsAggregator.SingleValue derived agg there.
} | ||
} | ||
for (PipelineAggregationBuilder aggregation : aggBuilder.getPipelineAggregatorFactories()) { | ||
// should not have pipeline aggregations |
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.
Why?
Yes but I think there is nothing in the aggregation builder that tells you the type of aggregation? |
Indeed, we need to figure this part out. |
In order to support automatic styling, the consumers of vector tiles need to know the range of values added to the aggs layer. Therefore this PR adds this values ranges on the meta later. Values are computed using min / max pipeline aggregations.
So for example, there is the document counts range in the form:
In addition, for any metric aggregation there will be two entries: