Skip to content

SQL: improve handling of ES aggregations #35745

@costin

Description

@costin

Currently underlying ES aggregations are returned as are, both as sub-aggregations and bucket selector.
Unfortunately due to the underlying inconsistencies this can have undesirable effects, for example:

  1. MAX/MIN can work on date fields however they return an actual long instead of a time object causing failures
  2. aggregations on null/empty groups return their initial result, not null which again is problematic (see Introduce contract to know whether InternalAggs have computed results or not #34903).

In both example, this can be handled inside SQL by wrapping the aggregation to guarantee the expected value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions