richardstartin commented on code in PR #8498: URL: https://github.com/apache/pinot/pull/8498#discussion_r846762085
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/H3Utils.java: ########## @@ -35,4 +51,50 @@ private H3Utils() { throw new RuntimeException("Failed to instantiate H3 instance", e); } } + + private static Set<Long> coverLineInH3(LineString lineString, int resolution) { + Set<Long> coveringH3Cells = new HashSet<>(); + List<Long> endpointH3Cells = new ArrayList<>(); + for (Coordinate endpoint : lineString.getCoordinates()) { + endpointH3Cells.add(H3_CORE.geoToH3(endpoint.y, endpoint.x, resolution)); + } + for (int i = 0; i < endpointH3Cells.size() - 1; i++) { + try { + coveringH3Cells.addAll(H3_CORE.h3Line(endpointH3Cells.get(i), endpointH3Cells.get(i + 1))); + } catch (LineUndefinedException e) { + throw new RuntimeException(e); + } + } + return coveringH3Cells; + } Review Comment: Thanks -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org