elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

EQL sequences: support join on multi-values

Open luigidellaquila opened this issue 2 years ago • 5 comments

Fixes: #64553

This PR adds support for multi-value join keys in sequences (ie. sequence by <multi-value attribute>).

In case a multi-value attributes, each value is considered as a different join key, so the same record will be considered multiple times.

eg.

sequence by name, tags
  [...]
  [...]

if we have two records: {id:1, name:a, tags: [foo, bar]} and {id:2, name:a, tags: [foo, bar]}, we will have two results, the first one with key = [a, foo] and the second one with key = [a, bar]. The records in each sequence will be the same in this case.

In case of multiple multi-value keys, the resulting keys will be the cartesian product of all the single keys per multi value. Eg. with the same query as above and two records as {id:1, name:[a, b], tags: [foo, bar]} and {id:2, name:[a, b], tags: [foo, bar]}, the result will be four sequences, with keys respectively [a, foo], [a, bar], [b, foo], [b, bar]. All the four sequences will have the same records.

luigidellaquila avatar Sep 09 '22 13:09 luigidellaquila

@elasticmachine update branch

luigidellaquila avatar Sep 09 '22 14:09 luigidellaquila

Pinging @elastic/es-ql (Team:QL)

elasticsearchmachine avatar Sep 09 '22 15:09 elasticsearchmachine

Hi @luigidellaquila, I've created a changelog YAML for you.

elasticsearchmachine avatar Sep 09 '22 15:09 elasticsearchmachine

Thank you for the quick feedback @costin, I'm checking your comments now

luigidellaquila avatar Sep 12 '22 06:09 luigidellaquila

sequences have a feature that affects join keys - optional fields. I think it's better to add tests with ?tags keys [...]

Adding them now

luigidellaquila avatar Sep 19 '22 12:09 luigidellaquila

@elasticmachine run elasticsearch-ci/part-1

luigidellaquila avatar Sep 22 '22 07:09 luigidellaquila

@elasticmachine run elasticsearch-ci/part-1

luigidellaquila avatar Sep 22 '22 08:09 luigidellaquila

@elasticmachine update branch

luigidellaquila avatar Sep 23 '22 15:09 luigidellaquila

@elasticmachine run elasticsearch-ci/bwc

luigidellaquila avatar Sep 23 '22 16:09 luigidellaquila

@elasticmachine run elasticsearch-ci/part-2

luigidellaquila avatar Sep 26 '22 06:09 luigidellaquila