Skip to content

ST_DISTANCE predicate returns true on null distance with Lucene pushdown #128234

@craigtaverner

Description

@craigtaverner

With a query like:

FROM airports
| EVAL distance = ST_DISTANCE(location, TO_GEOPOINT("POINT(-28.6359 153.5906)"))
| KEEP distance, location, name, scalerank
| WHERE distance > 500 AND scalerank < 6
| SORT name ASC

The literal geo-point is invalid (y value out of range), and this correctly leads to a null distance value. When run without Lucene pushdown, this query will return no results because the WHERE distance > 500 will evaluate to WHERE null which is effectively WHERE false. However, the Lucene pushdown of the distance predicate is not correctly filtering this, and results in all documents being returned (as if we had WHERE true).

This issue is specific to the Lucene pushdown of the distance predicate, not an issue with WHERE or predicates in general. However, since distance pushdown actually re-writes to ST_INTERSECTS pushdown, we need to verify that the issue is not also for intersects and disjoint cases.

Metadata

Metadata

Assignees

Labels

:Analytics/ES|QLAKA ESQL:Analytics/GeoIndexing, search aggregations of geo points and shapes>bugTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions