Details
Description
JTS Geometry objects can't be used as return types of compute jobs. Instead, null is returned. Here's a minimal example showing the bug (and one example that shows that the bug is sometimes not triggered under slightly different conditions):
// this prints "null" (wrong – the expected result would be "POINT EMPTY"): igniteCompute.broadcast(() -> (new GeometryFactory()).createPoint()).forEach(System.out::println); // this prints "[POINT EMPTY]" (correct): igniteCompute.broadcast(() -> Collections.singletonList((new GeometryFactory()).createPoint())).forEach(System.out::println);
This is caused by an invalid BinaryWriteMode of OPTIMIZED in https://github.com/apache/ignite/blob/ignite-2.7/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java#L852 which then leads to a null value to be returned a few lines further down: https://github.com/apache/ignite/blob/ignite-2.7/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java#L882
From what I can see, the OPTIMIZED mode is set in https://github.com/apache/ignite/blob/ignite-2.7/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java#L161 where the objects are explicitly tested against the org.locationtech.jts.geom.Geometry class. This could be a regression introduced in https://issues.apache.org/jira/browse/IGNITE-4259 ?