forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt,invertedexpr: fix memory corruption issue in inverted join
Prior to this commit, it was possible for an inverted join to return incorrect results if it had an additional scalar filter as part of the join condition. For example, a join condition such as ST_Contains(g1.geom, g2.geom) AND ST_Contains(g1.geom, ST_MakePolygon('LINESTRING(0 0, 0 5, 5 5, 0 0)')) could be susceptible to this issue, because we pre-compute the SpanExpression for the scalar filter and store it for re-use. The problem was that the pre-computed SpanExpression was being modified and then reused, leading to memory corruption. This commit fixes the problem by making a copy of the pre-computed SpanExpression before using it and modifying it. Fixes cockroachdb#55648 Release note (bug fix): Fixed a bug that could occur for spatial queries involving a join between two spatial columns, when there was an additional filter on one of the spatial columns, and that column also had an inverted index defined. This bug could cause incorrect results to be returned, in which some rows were omitted from the output that should have been included.
- Loading branch information
Showing
5 changed files
with
221 additions
and
3 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
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