Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add h3_cell_to_latlng #3

Merged
merged 2 commits into from
Oct 25, 2022
Merged

Add h3_cell_to_latlng #3

merged 2 commits into from
Oct 25, 2022

Conversation

isaacbrodsky
Copy link
Contributor

No description provided.

DOUBLE.writeDouble(blockBuilder, latLng.lng);
return blockBuilder.build();
} catch (Exception e) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my info: Is it faster to catch the exception, or faster to validate the input?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching exceptions is generally very slow. uber/h3-java#107 tracks adding a no-throw API for performance.

try (QueryRunner queryRunner = createQueryRunner()) {
assertQueryResults(
queryRunner,
"SELECT h3_cell_to_latlng(578536630256664575)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Does Presto support any hexidecimal syntax? In general I think we should prefer human-readable cell indexes in tests if possible (easier to debug, etc).

Copy link
Contributor Author

@isaacbrodsky isaacbrodsky Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of a way to embed a hex literal integer in Presto SQL. (You could use a string literal and from_base)

@isaacbrodsky isaacbrodsky merged commit 18054da into main Oct 25, 2022
@isaacbrodsky isaacbrodsky deleted the celltolatlng branch October 25, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants