Login  Register

[GitHub] [carbondata] shenjiayu17 commented on a change in pull request #4012: [CARBONDATA-4051] Geo spatial index algorithm improvement and UDFs enhancement

Posted by GitBox on Nov 26, 2020; 6:58am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-shenjiayu17-opened-a-new-pull-request-4012-CARBONDATA-4051-Geo-spatial-index-algort-tp103286p103614.html


shenjiayu17 commented on a change in pull request #4012:
URL: https://github.com/apache/carbondata/pull/4012#discussion_r530807954



##########
File path: geo/src/main/java/org/apache/carbondata/geo/GeoHashIndex.java
##########
@@ -245,48 +195,24 @@ public String generate(List<?> sources) throws Exception {
    */
   @Override
   public List<Long[]> query(String polygon) throws Exception {
-    if (!validate(polygon)) {
-      return null;
-    } else {
-      String[] pointList = polygon.trim().split(",");
-      List<double[]> queryList = new ArrayList<>();
-      for (String str: pointList) {
-        String[] points = splitString(str);
-        if (2 != points.length) {
-          throw new RuntimeException("longitude and latitude is a pair need 2 data");
-        } else {
-          try {
-            queryList.add(new double[] {Double.valueOf(points[0]), Double.valueOf(points[1])});
-          } catch (NumberFormatException e) {
-            throw new RuntimeException("can not covert the string data to double", e);
-          }
-        }
-      }
-      if (!checkPointsSame(pointList[0], pointList[pointList.length - 1])) {
-        throw new RuntimeException("the first point and last point in polygon should be same");
-      } else {
-        List<Long[]> rangeList = getPolygonRangeList(queryList);
-        return rangeList;
-      }
+    try {
+      List<double[]> queryList = GeoHashUtils.getPointListFromPolygon(polygon);
+      return getPolygonRangeList(queryList);
+    } catch (Exception e) {

Review comment:
       there is only RuntimeException,so I removed try catch




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

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