Skip to content

Commit 88ab7bc

Browse files
authored
Relax condition for H3 bins crossing the dateline (#115290) (#115336)
Just check the for h3 bins crossing the dateline, that the center child relationship returns something different to Disjoint.
1 parent 0706f98 commit 88ab7bc

File tree

1 file changed

+4
-3
lines changed
  • x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/search/aggregations/bucket/geogrid

1 file changed

+4
-3
lines changed

x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/search/aggregations/bucket/geogrid/GeoHexVisitorTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ private void doTestGeometry(LongFunction<Geometry> h3ToGeometry, boolean hasArea
8383
visitor.reset(centerChild);
8484
reader.visit(visitor);
8585
if (hasArea) {
86-
if (h3CrossesDateline && visitor.getLeftX() > visitor.getRightX()) {
87-
// if both polygons crosses the dateline it cannot be inside due to the polygon splitting technique
88-
assertEquals("failing h3: " + h3, GeoRelation.QUERY_CROSSES, visitor.relation());
86+
if (h3CrossesDateline) {
87+
// if the h3 crosses the dateline, we might get CROSSES due to the polygon splitting technique. We can't
88+
// be sure which one is the correct one, so we just check that it is not DISJOINT
89+
assertNotSame("failing h3: " + h3, GeoRelation.QUERY_DISJOINT, visitor.relation());
8990
} else {
9091
assertEquals("failing h3: " + h3, GeoRelation.QUERY_INSIDE, visitor.relation());
9192
}

0 commit comments

Comments
 (0)