abstractdog commented on code in PR #6581:
URL: https://github.com/apache/hive/pull/6581#discussion_r3630061133
##########
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:
ack
--
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]