ayushtkn commented on code in PR #6581:
URL: https://github.com/apache/hive/pull/6581#discussion_r3618803629


##########
ql/src/test/org/apache/hadoop/hive/ql/udf/esri/serde/JsonSerDeTestingBase.java:
##########
@@ -100,19 +98,16 @@ protected void addWritable(ArrayList<Object> stuff, 
java.sql.Timestamp item) {
   }
 
   protected void addWritable(ArrayList<Object> stuff, Geometry geom) {
-    addWritable(stuff, geom, null);
-  }
-
-  protected void addWritable(ArrayList<Object> stuff, MapGeometry geom) {
-    addWritable(stuff, geom.getGeometry(), geom.getSpatialReference());
-  }
-
-  protected void addWritable(ArrayList<Object> stuff, Geometry geom, 
SpatialReference sref) {
-    
stuff.add(GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(geom,
 sref)));
+    stuff.add(GeometryUtils.geometryToEsriShapeBytesWritable(geom));
   }
 
   protected void ckPoint(Point refPt, BytesWritable fieldData) {
-    Assert.assertEquals(refPt, 
GeometryUtils.geometryFromEsriShape(fieldData).getEsriGeometry());
+    Geometry geom = GeometryUtils.geometryFromEsriShape(fieldData);
+    Assert.assertNotNull("Geometry must not be null!", geom);
+    Assert.assertTrue("Expected a Point geometry!", geom instanceof Point);
+    Point actualPt = (Point) geom;
+    Assert.assertEquals("X coordinate differs!", refPt.getX(), 
actualPt.getX(), 0.0001);
+    Assert.assertEquals("Y coordinate differs!", refPt.getY(), 
actualPt.getY(), 0.0001);

Review Comment:
   A JTS Point is a plain planar (x, y) — it carries no CRS of its own, only an 
SRID tag, so whether x/y mean degrees depends entirely on the data. In these 
SerDe tests the points are arbitrary planar values ((15,5), (7,4), (7,2)), not 
real coordinates. Your accuracy point stands regardless, though: these are pure 
round-trip assertions where doubles come back bit-identical, so 1e-4 was hiding 
any precision loss that might creep in. Tightened to 1e-9 here and in 
TestStCentroid / TestStGeomFromShape / TestStAsShape — the latter two do use 
real lon/lat, where 1e-4° is ~11 m.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to