apache / apache/lucene

TestXYMultiPolygonShapeQueries test failures [LUCENE-9139]

Open
#10,180 2 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:test
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

We recently have two failures on CI from the test method TestXYMultiPolygonShapeQueries. The reproduction lines are:

 

```java
ant test -Dtestcase=TestXYMultiPolygonShapeQueries -Dtests.method=testRandomMedium -Dtests.seed=F1E142C2FBB612AF -Dtests.multiplier=3 -Dtests.slow=true -Dtests.badapples=true -Dtests.locale=el -Dtests.timezone=EST5EDT -Dtests.asserts=true -Dtests.file.encoding=US-ASCII
```

```java
ant test -Dtestcase=TestXYMultiPolygonShapeQueries -Dtests.method=testRandomMedium -Dtests.seed=363603A0428EC788 -Dtests.multiplier=3 -Dtests.slow=true -Dtests.badapples=true -Dtests.locale=sv-SE -Dtests.timezone=America/Yakutat -Dtests.asserts=true -Dtests.file.encoding=UTF-8
```

 

I dug into the failures and there seem to be due to numerical errors in the GeoUtils.orient method. The method is detecting intersections of two very long lines when it shouldn't. For example:

Line 1: 

```java
double ax = 3.314395000050712E38;
double ay = -1.4151510014141656E37;
double bx = 3.4028234663852886E38;
double by = 9.641030236797581E20;
```

Line 2:

```java
double cx = 3.4028234663852886E38;
double cy = -0.0;
double dx = 3.4028234663852886E38;
double dy = -2.7386422951137726E38;
```

My proposal to prevent those numerical errors is to modify the shape generator to prevent creating shapes that expands more than half the float space.

---
Migrated from [LUCENE-9139](https://issues.apache.org/jira/browse/LUCENE-9139) by Ignacio Vera (@iverase), updated Jan 17 2020

Contributor guide

Open the contributing guide

Research direction

Start with TestXYMultiPolygonShapeQueries and the GeoUtils.orient method, then run the two ant test commands from the issue to reproduce the failures. Done means the random shape generation avoids shapes spanning more than half the float space and both reported test cases pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.