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
Operations

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

{code}
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(QueryExecutorImpl.java:2103)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
at org.datanucleus.store.rdbms.datasource.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.datanucleus.store.rdbms.datasource.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeUpdate(ParamLoggingPreparedStatement.java:399)
at org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:439)
at org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:410)
at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertTable(RDBMSPersistenceHandler.java:167)
at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:143)
at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:3784)
at org.datanucleus.state.JDOStateManager.makePersistent(JDOStateManager.java:3760)
at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2219)
at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:2065)
at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1913)
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:727)
at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
at org.datanucleus.tests.JtsGeometry3dMappingTest.testGeometryCollection3DMapping(JtsGeometry3dMappingTest.java:95)

{code}

In our subject test JTS geometric objects are created as below

{code}
 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)});
{code}

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

{code}

 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>)

{code}

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 http://www.vividsolutions.com/jts/JTSHome.htm

Also did some search on JTS and 3D on Google and I found this from http://docs.geotools.org/stable/userguide/library/jts/faq.html "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 ]