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

feat(query): implement ST_GEOMFROMGEOHASH #15156

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

kkk25641463
Copy link
Contributor

@kkk25641463 kkk25641463 commented Apr 2, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

feat: Implement st_geompointfromgeohash()
Currently the precision only implement within 12 digits. And I found that ST_GEOMFROMGEOHASH() returned value is geojson type.
I'm not sure whether we should implement subtypes with geometry type like number type or decimal type? And output can be choose with subtypes like ewkb、ewkt、geojson, otherwise i have to check types by alot of match case in display logic.

            ScalarRef::Geometry(s) => {
                let ewkb = Ewkb(s.to_vec());
                let value = match ewkb.to_ewkt(ewkb.srid()) {
                    Ok(ewkt) => ewkt,
                    Err(_) => GeoJson(std::str::from_utf8(s).unwrap()).to_json().unwrap(),
                };
                write!(f, "'{value:?}'")

see alse try_to_ geometry.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Apr 2, 2024
@kkk25641463
Copy link
Contributor Author

@ariesdevil help me to check plz.

@sundy-li sundy-li requested review from sundy-li and b41sh April 3, 2024 00:36
@sundy-li
Copy link
Member

sundy-li commented Apr 3, 2024

Currently the precision only implement within 12 digits

Can we add another register ST_GEOMFROMGEOHASH( <geohash> [, <precision> ] ) in this pr ?

seems it's limited by geohash crate.

@sundy-li
Copy link
Member

sundy-li commented Apr 3, 2024

I'm not sure whether we should implement subtypes with geometry type like number type or decimal type?

That's a little complicated, we do not decide to address that.

@kkk25641463
Copy link
Contributor Author

kkk25641463 commented Apr 3, 2024

Currently the precision only implement within 12 digits

Can we add another register ST_GEOMFROMGEOHASH( <geohash> [, <precision> ] ) in this pr ?

seems it's limited by geohash crate.

The pr depends on geohash algorithm which only support less than 12 precision and is not maintenance by maintainer. Algorithms that support arbitrary precision require rewriting most of code in geohash decode_bbox() function which are break changes. And 12 bit accuracy can meet most geo application needs.
I can add ST_GEOMFROMGEOHASH( <geohash> [, <precision> ] ) define first

@kkk25641463
Copy link
Contributor Author

I'm not sure whether we should implement subtypes with geometry type like number type or decimal type?

That's a little complicated, we do not decide to address that.

Is this the reason of the work to maintain the geozero library?

@kkk25641463 kkk25641463 changed the title feat(query): implement ST_GEOMPOINTFROMGEOHASH feat(query): implement ST_GEOMFROMGEOHASH Apr 3, 2024
@sundy-li
Copy link
Member

sundy-li commented Apr 3, 2024

geozIs this the reason of the work to maintain the geozero library?ero

Part of, another consideration is that we don't want to introduce too much datatypes in DataType

@sundy-li sundy-li added this pull request to the merge queue Apr 3, 2024
@BohuTANG BohuTANG removed this pull request from the merge queue due to a manual request Apr 3, 2024
@BohuTANG BohuTANG merged commit c16a16b into databendlabs:main Apr 3, 2024
104 of 105 checks passed
@kkk25641463 kkk25641463 deleted the ST_GEOMFROMGEOHASH branch April 3, 2024 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants