-
Notifications
You must be signed in to change notification settings - Fork 38
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 geohex_grid aggregation #160
Add geohex_grid aggregation #160
Conversation
af06606
to
b0b350a
Compare
b0b350a
to
3ab65e2
Compare
...g/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexGridAggregationBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/stats/upload/UploadStatsNodeRequest.java
Outdated
Show resolved
Hide resolved
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 am not seeing IT tests for the new aggregation?
src/test/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexGridTests.java
Outdated
Show resolved
Hide resolved
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.
[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.
src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java
Outdated
Show resolved
Hide resolved
...main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGrid.java
Outdated
Show resolved
Hide resolved
a94c396
to
c4daf9e
Compare
libs/h3/src/test/java/org/opensearch/geospatial/h3/ParentChildNavigationTests.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java
Outdated
Show resolved
Hide resolved
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think we normally use block style comments for class:
/**
* Class description
*/
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.
Ack
JsonXContent.jsonXContent, | ||
String.format( | ||
Locale.getDefault(), | ||
"{\"field\":\"my_loc\", \"precision\":\"%d\", \"size\": \"500\", \"shard_size\": \"550\"}", |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as for other class, I think we use block comments for classes
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.
Ack
/** | ||
* Helper class for H3 library | ||
*/ | ||
public class GeoHexHelper { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]> * Add integration test (#176) Included integration test for geohex_grid. Signed-off-by: Vijayan Balasubramanian <[email protected]>
…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 <[email protected]> * Add integration test (opensearch-project#176) Included integration test for geohex_grid. Signed-off-by: Vijayan Balasubramanian <[email protected]>
) * 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 <[email protected]> * Add integration test (#176) Included integration test for geohex_grid. Signed-off-by: Vijayan Balasubramanian <[email protected]>
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 [email protected]
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.