Implement IntersectsBbox to translate PostGIS && operator#3484
Implement IntersectsBbox to translate PostGIS && operator#3484roji merged 25 commits intonpgsql:mainfrom
Conversation
(cherry picked from commit 773a330)
(cherry picked from commit c6fb5e2)
To better handling reordering scenarios. Fixes npgsql#3424 (cherry picked from commit c2b3de4)
Fixes npgsql#3433 (cherry picked from commit 068a7c6)
Fixes npgsql#3440 (cherry picked from commit 83f2cc3)
Fixes npgsql#3460 (cherry picked from commit 16841f9)
(cherry picked from commit 3cbdba4)
) Closes npgsql#3464 (cherry picked from commit 786b635)
Fixes npgsql#3474 (cherry picked from commit 0212cae)
Fixes npgsql#3476 (cherry picked from commit e327d6b)
…ptions (npgsql#3482) Fixes npgsql#3478 (cherry picked from commit 0db010c)
|
I'm getting test failure: Npgsql.EntityFrameworkCore.PostgreSQL.Query.SpatialQueryNpgsqlGeometryTest.IntersectsBbox(async: False) (24ms): Error Message: System.InvalidOperationException : The 'IntersectsBbox' method is not supported because the query has switched to client-evaluation. This usually happens when the arguments to the method cannot be But at the same time I see: The generated SQL looks fine... so I'm quite confused about why the test is failing with what looks like something that should block SQL generation!? |
|
I understand now, in the case of DbFunction extensions I need to emulate a client side query in the test case. Should be foxed now. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for PostGIS's bounding box intersection operator (&&) by implementing an IntersectsBbox DbFunction. The implementation includes the function definition, query translation logic, and comprehensive test coverage.
Changes:
- Added
IntersectsBboxextension method toDbFunctionsfor checking bounding box intersections - Implemented translation to PostGIS
&&operator in the method call translator - Added test case validating the function behavior and SQL generation
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/EFCore.PG.NTS/Extensions/NpgsqlNetTopologySuiteDbFunctionsExtensions.cs | Adds the IntersectsBbox DbFunction extension method |
| src/EFCore.PG.NTS/Query/ExpressionTranslators/Internal/NpgsqlNetTopologySuiteMethodCallTranslatorPlugin.cs | Implements translation of IntersectsBbox to PostGIS && operator |
| test/EFCore.PG.FunctionalTests/Query/SpatialQueryNpgsqlGeometryTest.cs | Adds test coverage for the new IntersectsBbox function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/EFCore.PG.NTS/Extensions/NpgsqlNetTopologySuiteDbFunctionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.PG.NTS/Extensions/NpgsqlNetTopologySuiteDbFunctionsExtensions.cs
Show resolved
Hide resolved
|
@bjornharrtell note test failures, looks like you need to adjust the SQL assertion which changed since your wrote this. |
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@roji sorry, should be fixed now. |
|
Thanks for your contribution! |
Implement a DbFunction to translate into PostGIS && operator.
Closes #3485