You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2022/09/04 13:30:17 UTC
[pinot] branch release-0.11-rc updated: upgrade h3 lib from 3.7.2 to 4.0.0 to lower glibc requirement (#9335)
This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch release-0.11-rc
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/release-0.11-rc by this push:
new dd5f5d92d6 upgrade h3 lib from 3.7.2 to 4.0.0 to lower glibc requirement (#9335)
dd5f5d92d6 is described below
commit dd5f5d92d69d831339b59e3debaae285b831ccbb
Author: Xiang Fu <xi...@gmail.com>
AuthorDate: Sun Sep 4 06:12:34 2022 -0700
upgrade h3 lib from 3.7.2 to 4.0.0 to lower glibc requirement (#9335)
---
.../org/apache/pinot/segment/local/utils/H3Utils.java | 17 ++++++++---------
pom.xml | 2 +-
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/H3Utils.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/H3Utils.java
index 7fab9bd3aa..706a85e388 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/H3Utils.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/H3Utils.java
@@ -18,9 +18,8 @@
*/
package org.apache.pinot.segment.local.utils;
-import com.uber.h3core.H3Core;
-import com.uber.h3core.exceptions.LineUndefinedException;
-import com.uber.h3core.util.GeoCoord;
+import com.uber.h3core.H3CoreV3;
+import com.uber.h3core.util.LatLng;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import it.unimi.dsi.fastutil.longs.LongList;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
@@ -44,13 +43,13 @@ public class H3Utils {
private H3Utils() {
}
- public static final H3Core H3_CORE;
+ public static final H3CoreV3 H3_CORE;
static {
try {
- H3_CORE = H3Core.newInstance();
+ H3_CORE = H3CoreV3.newInstance();
} catch (IOException e) {
- throw new RuntimeException("Failed to instantiate H3 instance", e);
+ throw new RuntimeException("Failed to instantiate H3 V3 instance", e);
}
}
@@ -63,7 +62,7 @@ public class H3Utils {
for (int i = 0; i < endpointH3Cells.size() - 1; i++) {
try {
coveringH3Cells.addAll(H3_CORE.h3Line(endpointH3Cells.getLong(i), endpointH3Cells.getLong(i + 1)));
- } catch (LineUndefinedException e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -72,7 +71,7 @@ public class H3Utils {
private static Pair<LongSet, LongSet> coverPolygonInH3(Polygon polygon, int resolution) {
List<Long> polyfillCells = H3_CORE.polyfill(Arrays.stream(polygon.getExteriorRing().getCoordinates())
- .map(coordinate -> new GeoCoord(coordinate.y, coordinate.x)).collect(Collectors.toList()),
+ .map(coordinate -> new LatLng(coordinate.y, coordinate.x)).collect(Collectors.toList()),
Collections.emptyList(), resolution);
// TODO: this can be further optimized to use native H3 implementation. They have plan to support natively.
// https://github.com/apache/pinot/issues/8547
@@ -96,7 +95,7 @@ public class H3Utils {
}
private static Polygon createPolygonFromH3Cell(long h3Cell) {
- List<GeoCoord> boundary = H3_CORE.h3ToGeoBoundary(h3Cell);
+ List<LatLng> boundary = H3_CORE.h3ToGeoBoundary(h3Cell);
boundary.add(boundary.get(0));
return GeometryUtils.GEOMETRY_FACTORY.createPolygon(
boundary.stream().map(geoCoord -> new Coordinate(geoCoord.lng, geoCoord.lat)).toArray(Coordinate[]::new));
diff --git a/pom.xml b/pom.xml
index 53318fcd4e..f87f07144b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -153,7 +153,7 @@
<netty.version>4.1.79.Final</netty.version>
<reactivestreams.version>1.0.3</reactivestreams.version>
<jts.version>1.16.1</jts.version>
- <h3.version>3.7.2</h3.version>
+ <h3.version>4.0.0</h3.version>
<jmh.version>1.26</jmh.version>
<audienceannotations.version>0.13.0</audienceannotations.version>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org