Skip to content

ES|QL multiple ST_CENTROID_AGG or ST_EXTENT_AGG do not work with STATS..WHERE #142329

@craigtaverner

Description

@craigtaverner

When using a WHERE clause within the STATS of a spatial aggregation, and there are more than one aggregation function, the results are incorrect, and reflect the values of the first function.

For example:

FROM airports
| STATS c9=ST_CENTROID_AGG(location) WHERE scalerank == 9,
        c8=ST_CENTROID_AGG(location) WHERE scalerank == 8,
        c7=ST_CENTROID_AGG(location) WHERE scalerank == 7,
        c6=ST_CENTROID_AGG(location) WHERE scalerank == 6

Should return four columns with four different results, but all columns have the same value as the first column:

Actual:

    c9:geo_point                | c8:geo_point                | c7:geo_point                | c6:geo_point
    POINT (83.277262 28.992898) | POINT (83.277262 28.992898) | POINT (83.277262 28.992898) | POINT (83.277262 28.992898)

Expected:

    c9:geo_point                | c8:geo_point                 | c7:geo_point                | c6:geo_point
    POINT (83.277262 28.992898) | POINT (-12.330428 29.554613) | POINT (19.934784 13.864835) | POINT (-10.861431 28.170889)

The same issue occurs with ST_EXTENT_AGG.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions