somandal commented on code in PR #16002:
URL: https://github.com/apache/pinot/pull/16002#discussion_r2180403748
##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/H3IndexTest.java:
##########
@@ -126,6 +126,35 @@ public void testH3Index()
}
}
+ @Test
+ public void testSkipNullOrInvalidGeometry()
+ throws Exception {
+ String columnName = "skipInvalid";
+ int res = 5;
+ H3IndexResolution resolution = new
H3IndexResolution(Collections.singletonList(res));
+
+ try (GeoSpatialIndexCreator creator = new OnHeapH3IndexCreator(TEMP_DIR,
columnName, "myTable_OFFLINE",
+ resolution)) {
+ Point point = GeometryUtils.GEOMETRY_FACTORY.createPoint(new
Coordinate(10, 20));
+ creator.add(point);
+
+ // Invalid serialized bytes should be skipped without throwing exception
+ creator.add(new byte[]{1, 2, 3}, -1);
+
+ // Explicit null geometry should also be skipped
+ creator.add(null);
+
+ creator.seal();
+ }
+
+ File indexFile = new File(TEMP_DIR, columnName +
V1Constants.Indexes.H3_INDEX_FILE_EXTENSION);
+ try (PinotDataBuffer buffer =
PinotDataBuffer.mapReadOnlyBigEndianFile(indexFile);
+ H3IndexReader reader = new ImmutableH3IndexReader(buffer)) {
+ long h3Id = H3Utils.H3_CORE.latLngToCell(20, 10, res);
+ Assert.assertEquals(reader.getDocIds(h3Id).getCardinality(), 1);
+ }
+ }
Review Comment:
makes sense, updated
--
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]