opt: fix normalization of st_distance when use_spheroid parameter used#55739
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Oct 20, 2020
Merged
opt: fix normalization of st_distance when use_spheroid parameter used#55739craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
This commit fixes the normalization rule that converts st_distance to st_dwithin or st_dwithinexclusive, which was broken in the case when the use_spheroid parameter was used. Prior to this commit, the rule was assigning the use_spheroid parameter as the 3rd parameter to st_dwithin or st_dwithinexclusive and the distance parameter as the 4th, but that order does not match the function signatures. This commit fixes the issue by assigning distance as the 3rd parameter and use_spheroid as the 4th if it exists. Fixes cockroachdb#55675 Release note (bug fix): Fixed an internal error that could occur during query planning when the use_spheroid parameter was used in the ST_Distance function as part of a filter predicate. For example, `SELECT ... WHERE ST_Distance(geog1, geog2, false) < 10` previously caused an error. This has now been fixed.
Member
Collaborator
Author
|
TFTR! bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit fixes the normalization rule that converts
st_distancetost_dwithinorst_dwithinexclusive, which was broken in the case whenthe
use_spheroidparameter was used. Prior to this commit, the rule wasassigning the
use_spheroidparameter as the 3rd parameter tost_dwithinor
st_dwithinexclusiveand thedistanceparameter as the 4th, but thatorder does not match the function signatures. This commit fixes the issue
by assigning
distanceas the 3rd parameter anduse_spheroidas the 4thif it exists.
Fixes #55675
Release note (bug fix): Fixed an internal error that could occur during
query planning when the use_spheroid parameter was used in the ST_Distance
function as part of a filter predicate. For example,
SELECT ... WHERE ST_Distance(geog1, geog2, false) < 10previously caused an error. Thishas now been fixed.