Issue Details (XML | Word | Printable)

Key: TEST-19
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Baris ERGUN
Reporter: Baris ERGUN
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Test Framework

JtsGeometry3dMappingTest.testGeometryCollection3DMapping is failing on postgresql test profile

Created: 18/Dec/13 08:35 AM   Updated: 21/Dec/13 10:50 AM  Due: 19/Dec/13   Resolved: 21/Dec/13 10:50 AM
Component/s: None
Affects Version/s: 3.0
Fix Version/s: 3.3

Datastore: PostgreSQL
Severity: Development

 Description  « Hide
JtsGeometry3dMappingTest.testGeometryCollection3DMapping is failing on postgresql test profile with below error against a Postgis/Postgresql

testGeometryCollection3DMapping[default](org.datanucleus.tests.JtsGeometry3dMappingTest) Time elapsed: 0.75 sec <<< ERROR!
javax.jdo.JDODataStoreException: Insert of object "org.datanucleus.samples.jtsgeometry.SampleGeometryCollection3D@d43f31" using statement "INSERT INTO samplejtsgeometrycollection3d (id,"name",geom,geom_0) VALUES (?,?,?,?)" failed : ERROR: Column has Z dimension but geometry does not
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
at org.postgresql.core.v3.QueryExecutorImpl.processResults(
at org.postgresql.core.v3.QueryExecutorImpl.execute(
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(
at org.datanucleus.state.JDOStateManager.internalMakePersistent(
at org.datanucleus.state.JDOStateManager.makePersistent(
at org.datanucleus.ExecutionContextImpl.persistObjectInternal(
at org.datanucleus.ExecutionContextImpl.persistObjectWork(
at org.datanucleus.ExecutionContextImpl.persistObject(
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(
at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(
at org.datanucleus.tests.JtsGeometry3dMappingTest.testGeometryCollection3DMapping(


In our subject test JTS geometric objects are created as below

 Point point = geomFactory.createPoint(new Coordinate(10.0, 10.0, 100.0));
            LineString linestring = geomFactory.createLineString(new Coordinate[]{new Coordinate(0.0, 50.0, 100.0),
                    new Coordinate(100.0, 50.0, 100.0)});
            LinearRing extRing = geomFactory.createLinearRing(new Coordinate[]{new Coordinate(25.0, 25.0, 100),
                    new Coordinate(75.0, 25.0, 100.0), new Coordinate(75.0, 75.0, 100.0), new Coordinate(25.0, 75.0, 100.0),
                    new Coordinate(25.0, 25.0, 100)});

With 3 dimensional x,y,z definitions, but this is being matched to the below Native Query


 INSERT INTO samplejtsgeometrycollection3d (id,"name",geom,geom_0) VALUES (<7101>,<'Collection of 3-dimensional geometries'>,<GEOMETRYCOLLECTION (POINT (10 10), LINESTRING (0 50, 100 50), POLYGON ((25 25, 75 25, 75 75, 25 75, 25 25)))>,<null>)


It is obvious that the Z is ignored when decorating the Native Query.

When reading JTS documentation from below links I have understood that "The JTS Topology Suite is an API of 2D spatial predicates and functions." from

Also did some search on JTS and 3D on Google and I found this from "JTS is an implementation of the OGC Simple Features for SQL Specification (ie SFSQL). It covers 2D constructs like Point, Line and Polygon. JTS is willing to carry a 3rd point around but does not use it for calculations - making it a 2.5D solution for cartesian space."

I suggest we comment out run 3d JTS Tests as JTS geometry objects Z field is being ignored on DB queries and spatial calculations.

Baris ERGUN made changes - 18/Dec/13 08:35 AM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Andy Jefferson added a comment - 18/Dec/13 08:46 AM
FWIW I get

javax.jdo.JDODataStoreException: Insert of object "org.datanucleus.samples.jtsgeometry.SampleGeometryCollection3D@382ec051" using statement "INSERT INTO samplejtsgeometrycollection3d (id,"name",geom,geom_0) VALUES (?,?,?,?)" failed : ERROR: new row for relation "samplejtsgeometrycollection3d" violates check constraint "enforce_dims_geom"
  Detail: Failing row contains (2, 0107000000030000000101000000000000000000244000000000000024400102..., null, 7101, Collection of 3-dimensional geometries).

but I agree about commenting it out.
What you could do is create a package "org.datanucleus.tests.newfeatures" and put the test in there (so it isn't run by default). This is what I did on "jdo/general" tests for example where there is something that one day we'd like to pass but not with current codebase/libs.

Baris ERGUN made changes - 21/Dec/13 10:49 AM
Status In Progress [ 3 ] Open [ 1 ]
Baris ERGUN added a comment - 21/Dec/13 10:50 AM
moved questionable JTS 3d case to newfeatures package. It will be excluded in tests.

Baris ERGUN made changes - 21/Dec/13 10:50 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]