uber / uber/h3-java

About Handling Error in cellsToMultiPolygon

Open
#158 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
333
Forks
68
PR merge metrics
No merged PRs in 30d

Description

I discovered that when using the cellsToMultiPolygon method, a SIGSEGV error can occur if there are duplicate indices in the input array. And this issue was addressed in a recent bug fix.

However, since the cellsToLinkedMultiPolygon method is designed to take a set as input, i think it would be beneficial to add a pre-processing step to ensure the input array has unique elements before calling h3Api.cellsToLinkedMultiPolygon.

Alternatively, there should be at least a comment in the code indicating that the input array must contain unique elements. Additionally, it would be helpful to specify an error code for the H3Exception, as it currently returns only 1.

It was really hard for me to find out the reason for the error 😭

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/main/java/com/uber/h3core/H3Core.java around line 610 and compare the native cellsToLinkedMultiPolygon implementation in src/h3lib/lib/algos.c around line 1168, along with bug fix PR #129. Confirm how duplicate indices produce SIGSEGV and whether the intended outcome is input validation, documentation, or an H3Exception error code; done means the chosen behavior is covered and the failure is no longer opaque.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.