forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: fix geospatial function NULL argument panics
This commit fixes panics that occurred when planning inverted index scans and when performing inverted joins on `GEOMETRY` and `GEOGRAPHY` inverted indexes for queries containing geospatial functions with an `NULL` constant argument. This panic only occurred when the constant `NULL` argument was cast to an acceptable type for the function overload, for example `ST_DWithin(a, b, NULL::FLOAT8)` or `ST_DWithin(NULL:GEOMETRY, b, 1)`. Without the cast, no panic occured because `tree.FuncExpr.TypeCheck` rewrites a `tree.FuncExpr` as `tree.DNull` when any of the arguments have an unknown type, such as an uncast `NULL`. This rewriting happens even before the `tree.FuncExpr` is built into a `memo.FunctionExpr` by optbuilder. Fixes cockroachdb#60527 Fixes cockroachdb#62686 Release note (bug fix): Queries that reference tables with `GEOMETRY` or `GEOGRAPHY` inverted indexes and that call geospatial functions with constant `NULL` values cast to a type, like `NULL::GEOMETRY` or `NULL::FLOAT8`, no longer error. This bug was present since 20.2.
- Loading branch information
Showing
3 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters