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

Cube support #2808

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Cube support #2808

wants to merge 2 commits into from

Conversation

Jimmacle
Copy link

@Jimmacle Jimmacle commented Jul 9, 2023

This PR implements #1938. It depends on the changes in npgsql/npgsql#3867.

This is currently pretty rough and incomplete but I'm putting it up as a draft for visibility. It's my first dive into working with EF Core database provider implementations so feel free to point out anything I'm doing wrong.

Current API as of e130ecd:

PostgreSQL Operator/Function NpgsqlCube API
cube && cube bool Overlaps(this NpgsqlCube a, NpgsqlCube b)
cube @> cube bool Contains(this NpgsqlCube a, NpgsqlCube b)
cube <@ cube bool ContainedBy(this NpgsqlCube a, NpgsqlCube b)
cube -> integer double NthCoordinate(this NpgsqlCube cube, int n)
cube ~> integer double NthCoordinate2(this NpgsqlCube cube, int n)
cube <-> cube double Distance(this NpgsqlCube a, NpgsqlCube b)
cube <#> cube double DistanceTaxicab(this NpgsqlCube a, NpgsqlCube b)
cube <=> cube double DistanceChebyshev(this NpgsqlCube a, NpgsqlCube b)
cube_union(cube, cube) NpgsqlCube Union(this NpgsqlCube a, NpgsqlCube b)
cube_inter(cube, cube) NpgsqlCube Intersect(this NpgsqlCube a, NpgsqlCube b)
cube_enlarge(c cube, r double, n integer) NpgsqlCube Enlarge(this NpgsqlCube cube, double r, int n)
cube_dim(cube) int Dimensions
cube_ll_coord(cube, integer) double LlCoord(int n)
cube_ur_coord(cube, integer) double UrCoord(int n)
cube_is_point(cube) bool Point
cube_subset(cube, integer[]) NpgsqlCube Subset(params int[] indexes)

Looking for feedback on these points:

  • Need a better name for NthCoordinate2 that differentiates it from NthCoordinate. Maybe shorten Coordinate to Coord to be consistent with LlCoord and UrCoord?
  • Implementing indexer translation (or more) for NpgsqlCube.LowerLeft and NpgsqlCube.UpperRight or only supporting the LlCoord and UrCoord methods.

@roji
Copy link
Member

roji commented Jul 9, 2023

@Jimmacle just to set expectations, since this depends on npgsql/npgsql#3867, it would be better to wait for that to be merged before spending too much time on this. In addition, in the next 2 months (more or less) I'll mostly likely be very busy with Npgsql/EF/.NET stabilization work, so there's little chance I'll be able to give this much attention...

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