You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/05/12 07:00:19 UTC

[GitHub] [hive] ayushtkn opened a new pull request, #3283: HIVE-26223: Integrate ESRI GeoSpatial UDFs.

ayushtkn opened a new pull request, #3283:
URL: https://github.com/apache/hive/pull/3283

   Adds GeoSpatial UDFs


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] maheshk114 commented on a diff in pull request #3283: HIVE-26223: Integrate ESRI GeoSpatial UDFs.

Posted by GitBox <gi...@apache.org>.
maheshk114 commented on code in PR #3283:
URL: https://github.com/apache/hive/pull/3283#discussion_r875400993


##########
ql/src/java/com/esri/hadoop/hive/BinUtils.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.esri.hadoop.hive;

Review Comment:
   This package can be changed to apache hive 



##########
ql/src/java/com/esri/hadoop/hive/ST_MaxX.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information

Review Comment:
   Can we keep the files in hive/ql/src/java/org/apache/hadoop/hive/ql/udf ?



##########
ql/src/java/com/esri/hadoop/hive/ST_Aggr_Intersection.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.esri.hadoop.hive;
+
+import com.esri.core.geometry.SpatialReference;
+import com.esri.core.geometry.ogc.OGCGeometry;
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDAF;
+import org.apache.hadoop.hive.ql.exec.UDAFEvaluator;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.io.BytesWritable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Description(name = "ST_Aggr_Intersection",
+    value = "_FUNC_(ST_Geometry) - aggregate intersection of all geometries passed",
+    extended = "Example:\n"
+        + "  SELECT _FUNC_(geometry) FROM source; -- return intersection of all geometries in source")
+
+public class ST_Aggr_Intersection extends UDAF {
+  static final Logger LOG = LoggerFactory.getLogger(ST_Aggr_Intersection.class.getName());
+
+  public static class AggrIntersectionBinaryEvaluator implements UDAFEvaluator {
+
+    private OGCGeometry isectGeom = null;
+    SpatialReference spatialRef = null;
+    int firstWKID = -2;
+
+    /*
+     * Initialize evaluator
+     */
+    @Override
+    public void init() {  // no-op
+    }
+
+    /*
+     * Iterate is called once per row in a table
+     */
+    public boolean iterate(BytesWritable geomref) throws HiveException {
+
+      if (geomref == null) {
+        LogUtils.Log_ArgumentsNull(LOG);
+        return false;
+      }
+
+      if (firstWKID == -2) {
+        firstWKID = GeometryUtils.getWKID(geomref);
+        if (firstWKID != GeometryUtils.WKID_UNKNOWN) {
+          spatialRef = SpatialReference.create(firstWKID);
+        }
+      } else if (firstWKID != GeometryUtils.getWKID(geomref)) {
+        LogUtils.Log_SRIDMismatch(LOG, geomref, firstWKID);
+        return false;
+      }
+
+      try {
+        OGCGeometry rowGeom = GeometryUtils.geometryFromEsriShape(geomref);
+        rowGeom.setSpatialReference(spatialRef);
+        if (isectGeom == null)

Review Comment:
   Need formatting



##########
ql/src/test/com/esri/hadoop/hive/serde/TestEsriJsonSerDe.java:
##########
@@ -0,0 +1,470 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file

Review Comment:
   Do we need the com/esri path for these files ?



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] ayushtkn merged pull request #3283: HIVE-26223: Integrate ESRI GeoSpatial UDFs.

Posted by GitBox <gi...@apache.org>.
ayushtkn merged PR #3283:
URL: https://github.com/apache/hive/pull/3283


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] ayushtkn commented on pull request #3283: HIVE-26223: Integrate ESRI GeoSpatial UDFs.

Posted by GitBox <gi...@apache.org>.
ayushtkn commented on PR #3283:
URL: https://github.com/apache/hive/pull/3283#issuecomment-1129811545

   Thanx @maheshk114 for the review, have addressed the review comments


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org