Skip to content

Missing equality operator for type spoint? #101

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

Closed
esabol opened this issue Nov 3, 2023 · 5 comments · Fixed by #102
Closed

Missing equality operator for type spoint? #101

esabol opened this issue Nov 3, 2023 · 5 comments · Fixed by #102

Comments

@esabol
Copy link
Contributor

esabol commented Nov 3, 2023

# select distinct spoint_deg(lon, lat) from sometable;
ERROR:  could not identify an equality operator for type spoint

I think this is a reasonable thing to do?

Should equality operators for the pgsphere types be added?

@df7cb
Copy link
Contributor

df7cb commented Nov 3, 2023

spoint = spoint does exist, but what this message means is that we'd need a spoint btree or hash opclass. I'll cook something up.

df7cb added a commit to cybertec-postgresql/pgsphere that referenced this issue Nov 3, 2023
Besides hash indexes on spoint, this enables "select distinct spoint
from tbl" queries.

Close postgrespro#101.
@esabol
Copy link
Contributor Author

esabol commented Nov 3, 2023

Would it similarly make sense to add hash opclasses for the other pgsphere types (strans, scircle, spoly)? Probably not as useful as spoint, but for the sake of completeness?

@df7cb
Copy link
Contributor

df7cb commented Nov 3, 2023

It's (sort of) easy for the types that have canonical representations. scircle is doable, but spoly would need sorting the nodes, and I hear there's open issues with left- and right-handed spolys.

That said, there's a possible minor problem even with spoints: the dreaded "signed zeros" might cause "equal" spoints to have representations differing in the sign. But that only applies to spoints where one coordinate is exactly zero, no idea how likely that is in practise. We might also force all zeros to be +0 either in spoint_hash32 or in spoint_in.

Which types would you be interested in?

@msdemlei
Copy link
Contributor

msdemlei commented Nov 3, 2023 via email

@esabol
Copy link
Contributor Author

esabol commented Nov 4, 2023

@df7cb asked:

Which types would you be interested in?

Hard to say. I could see using an scircle hash opclass.

I wonder if the error in issue #93 would be helped if there was a hash opclass for strans?

Also, I'm ok with forcing all zeroes to be +0 in the spoint hash function if that "solves" any problems you foresee.

df7cb added a commit to cybertec-postgresql/pgsphere that referenced this issue Nov 7, 2023
Besides hash indexes on spoint, this enables "select distinct spoint
from tbl" queries.

Close postgrespro#101.
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 a pull request may close this issue.

3 participants