Add geohex_grid aggregation#160
Conversation
af06606 to
b0b350a
Compare
b0b350a to
3ab65e2
Compare
navneet1v
left a comment
There was a problem hiding this comment.
I am not seeing IT tests for the new aggregation?
navneet1v
left a comment
There was a problem hiding this comment.
[Nit-pick] Overall comment on the code:
- Can we consistent in use of var and classes while creating the local variables.
- Please move all the public functions at the start of the class followed by protected and then private function. This improves reading and reviewing of the code.
- Please be consistent in use of final key word. I would recommend to use final keyword in local variables and functions parameters. This aids that the variable reference will not be changed.
a94c396 to
c4daf9e
Compare
00547d7 to
7228275
Compare
| import org.opensearch.search.aggregations.ParsedMultiBucketAggregation; | ||
| import org.opensearch.test.InternalMultiBucketAggregationTestCase; | ||
|
|
||
| // This class is modified from https://github.com/opensearch-project/OpenSearch/blob/main/modules/geo/src/test/java/org/opensearch/geo/search/aggregations/bucket/geogrid/GeoGridTestCase.java |
There was a problem hiding this comment.
nit: I think we normally use block style comments for class:
/**
* Class description
*/
| JsonXContent.jsonXContent, | ||
| String.format( | ||
| Locale.getDefault(), | ||
| "{\"field\":\"my_loc\", \"precision\":\"%d\", \"size\": \"500\", \"shard_size\": \"550\"}", |
There was a problem hiding this comment.
looks like it's the same string we're using in multiple places, WDYT of making it a constant?
There was a problem hiding this comment.
I refactored to a method in some places.
| import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; | ||
|
|
||
| // This class is modified from https://github.com/opensearch-project/OpenSearch/blob/main/modules/geo/src/test/java/org/opensearch/geo/search/aggregations/bucket/geogrid/GeoGridAggregatorTestCase.java | ||
| // to keep relevant test case required for GeoHex Grid Aggregation. |
There was a problem hiding this comment.
same as for other class, I think we use block comments for classes
| /** | ||
| * Helper class for H3 library | ||
| */ | ||
| public class GeoHexHelper { |
There was a problem hiding this comment.
just want to make sure that in this repo we're using Helper class suffix. I think in k-NN it's usually Util, but I finer with either one as long as we're consistent
There was a problem hiding this comment.
Right. We are calling it a helper than a utility everywhere.
This aggregation will use uber's h3 to group coordinates into H3 cell. Created new aggregation type geohex_grid. The precision will be between 0 and 15. This aggreation has default precision as 5, similar to geohash and geotile. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
7228275 to
ce75d61
Compare
* Import h3 library (#154) Made following changes to make it compatible: 1. Rename package from elasticsearch to opensearch.geospatial 2. Update License headers 3. Update build file 4. Update settings to include sub projects * Use Transport Request (#164) Remove usage of deprecated BaseNodeRequest * Update http client package to resolve build failure (#168) (#171) * Introduce H3 min resolution constant (#165) H3 version 1 has 16 resolutions, numbered 0 through 15. Introduced a constant to represent min value, similar to max value. * Add geohex aggregation (#160) This aggregation will use uber's h3 to group coordinates into H3 cell. Created new aggregation type geohex_grid. The precision will be between 0 and 15. This aggreation has default precision as 5, similar to geohash and geotile. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com> * Add integration test (#176) Included integration test for geohex_grid. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
…ch-project#179) * Import h3 library (opensearch-project#154) Made following changes to make it compatible: 1. Rename package from elasticsearch to opensearch.geospatial 2. Update License headers 3. Update build file 4. Update settings to include sub projects * Use Transport Request (opensearch-project#164) Remove usage of deprecated BaseNodeRequest * Update http client package to resolve build failure (opensearch-project#168) (opensearch-project#171) * Introduce H3 min resolution constant (opensearch-project#165) H3 version 1 has 16 resolutions, numbered 0 through 15. Introduced a constant to represent min value, similar to max value. * Add geohex aggregation (opensearch-project#160) This aggregation will use uber's h3 to group coordinates into H3 cell. Created new aggregation type geohex_grid. The precision will be between 0 and 15. This aggreation has default precision as 5, similar to geohash and geotile. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com> * Add integration test (opensearch-project#176) Included integration test for geohex_grid. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
) * Import h3 library (#154) Made following changes to make it compatible: 1. Rename package from elasticsearch to opensearch.geospatial 2. Update License headers 3. Update build file 4. Update settings to include sub projects * Use Transport Request (#164) Remove usage of deprecated BaseNodeRequest * Update http client package to resolve build failure (#168) (#171) * Introduce H3 min resolution constant (#165) H3 version 1 has 16 resolutions, numbered 0 through 15. Introduced a constant to represent min value, similar to max value. * Add geohex aggregation (#160) This aggregation will use uber's h3 to group coordinates into H3 cell. Created new aggregation type geohex_grid. The precision will be between 0 and 15. This aggreation has default precision as 5, similar to geohash and geotile. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com> * Add integration test (#176) Included integration test for geohex_grid. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Description
This aggregation will use uber's h3 to group coordinates into H3 cell.
Created new aggregation type geohex_grid. The precision will be between 0 and 15. This aggreation has default precision as 5, similar to geohash and geotile.
Signed-off-by: Vijayan Balasubramanian balasvij@amazon.com
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.