opensearch-project / geospatial

Future home of Geospatial features for OpenSearch
Apache License 2.0
35 stars 38 forks source link

[FlakyTest]org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitorTests.testIndexingMultiPolygon #294

Open heemin32 opened 1 year ago

heemin32 commented 1 year ago
REPRODUCE WITH: ./gradlew ':test' --tests "org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitorTests.testIndexingMultiPolygon" -Dtests.seed=C317A78A633C1A58 -Dtests.security.manager=false -Dtests.locale=ar-TN -Dtests.timezone=Australia/Darwin -Druntime.java=17
> Task :test

org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitorTests > testIndexingMultiPolygon FAILED
    java.lang.IllegalArgumentException: at least three non-collinear points required
        at __randomizedtesting.SeedInfo.seed([C317A78A633C1A58:FF568A98481069AA]:0)

        at org.apache.lucene.geo.Tessellator.tessellate(Tessellator.java:174)

        at org.apache.lucene.geo.Tessellator.tessellate(Tessellator.java:152)
Suite: Test class org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitorTests
  2> REPRODUCE WITH: ./gradlew ':test' --tests "org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitorTests.testIndexingMultiPolygon" -Dtests.seed=C317A78A633C1A58 -Dtests.security.manager=false -Dtests.locale=ar-TN -Dtests.timezone=Australia/Darwin -Druntime.java=17
  2> java.lang.IllegalArgumentException: at least three non-collinear points required
        at __randomizedtesting.SeedInfo.seed([C317A78A633C1A58:FF568A98481069AA]:0)
        at org.apache.lucene.geo.Tessellator.tessellate(Tessellator.java:174)
        at org.apache.lucene.geo.Tessellator.tessellate(Tessellator.java:152)
        at org.apache.lucene.document.XYShape.createIndexableFields(XYShape.java:100)
        at org.apache.lucene.document.XYShape.createIndexableFields(XYShape.java:84)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.createIndexableFields(XYShapeIndexableFieldsVisitor.java:107)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.visit(XYShapeIndexableFieldsVisitor.java:97)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.visit(XYShapeIndexableFieldsVisitor.java:40)
        at org.opensearch.geometry.Polygon.visit(Polygon.java:109)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.lambda$visitCollection$0(XYShapeIndexableFieldsVisitor.java:112)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.visitCollection(XYShapeIndexableFieldsVisitor.java:112)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.visit(XYShapeIndexableFieldsVisitor.java:84)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitor.visit(XYShapeIndexableFieldsVisitor.java:40)
        at org.opensearch.geospatial.index.mapper.xyshape.XYShapeIndexableFieldsVisitorTests.testIndexingMultiPolygon(XYShapeIndexableFieldsVisitorTests.java:121)
heemin32 commented 1 year ago

There is a bug in this method https://github.com/apache/lucene/blob/main/lucene/test-framework/src/java/org/apache/lucene/tests/geo/ShapeTestUtil.java#L156

It fails to generate correct polygon.

heemin32 commented 1 year ago

The issue is temporary fixed as of now. For a proper fix, we need a fix in lucene library. https://github.com/apache/lucene/pull/12287 and https://github.com/apache/lucene/issues/12596