ayushtkn commented on code in PR #6581:
URL: https://github.com/apache/hive/pull/6581#discussion_r3618758927
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/esri/ST_Aggr_Union.java:
##########
@@ -102,14 +90,21 @@ public boolean merge(BytesWritable other) throws
HiveException {
* Return a geometry that is the union of all geometries added up until
this point
*/
public BytesWritable terminatePartial() throws HiveException {
+ if (geomList.isEmpty()) {
+ return null;
+ }
try {
- Geometry rslt = xgc.next();
- lgc = null; // not reusable
- xgc = null; // not reusable
- OGCGeometry ogeom = OGCGeometry.createFromEsriGeometry(rslt,
spatialRef);
- return GeometryUtils.geometryToEsriShapeBytesWritable(ogeom);
+ Geometry result = UnaryUnionOp.union(geomList);
+ if (result == null) {
+ return null;
+ }
+ int wkid = (firstWKID == -2) ? GeometryUtils.WKID_UNKNOWN : firstWKID;
+ return GeometryUtils.geometryToEsriShapeBytesWritable(result, wkid);
} catch (Exception e) {
LogUtils.Log_InternalError(LOG, "ST_Aggr_Union: " + e);
Review Comment:
It centralizes the message catalogue so the same failure reads identically
across the ~90 ST_ UDFs, and Log_SRIDMismatch/Log_InvalidType format their
WKID/type arguments consistently. It's already the dominant convention in this
package, so I adopted it in the four spots you flagged rather than dropping it
here.
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/esri/serde/GeoJsonSerDe.java:
##########
Review Comment:
Fixed — your option (a): final field + protected BaseJsonSerDe(String)
--
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]