ESQL: Fix union types lost attributes in StubRelation for inlinestats#135547
ESQL: Fix union types lost attributes in StubRelation for inlinestats#135547elasticsearchmachine merged 11 commits intoelastic:mainfrom
Conversation
|
Hi @astefan, I've created a changelog YAML for you. |
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
…fix_union_types_lost_attributes
…astefan/elasticsearch into fix_union_types_lost_attributes
| summary: Fix union types lost attributes in `StubRelation` for inlinestats | ||
| area: ES|QL | ||
| type: bug | ||
| issues: [] |
There was a problem hiding this comment.
Might have been nice to have an issue describing this more
| DENSE_VECTOR_AGG_METRIC_DOUBLE_IF_FNS | ||
| DENSE_VECTOR_AGG_METRIC_DOUBLE_IF_FNS, | ||
|
|
||
| INLINE_STATS_WITH_UNION_TYPES_IN_STUB_RELATION(INLINE_STATS.enabled) |
There was a problem hiding this comment.
This should move up in the list to the rest of the INLINE_STATS capabilities. We try to avoid adding to the end of the capabilities, because that causes increased conflict probability. It's also nicer when exploring for all related Capabilities to be near each other.
| | INLINE STATS c = count(emp_no::long) where hire_date > "1991-01-01" BY yr | ||
| | SORT yr DESC | ||
| | LIMIT 5 | ||
| | SORT yr DESC, hire_date DESC |
There was a problem hiding this comment.
I notice all these fixed tests involve a grouping key. Do we have tests for non-grouped inline stats?
There was a problem hiding this comment.
OK. I added a test here for this, and it worked. I'll push a commit for it, and if you feel that test is redundant, just revert the commit.
|
Thank you, @craigtaverner, for the review and updates to the PR! |
This accounts for synthetics attributes that are added as part of union types support inside
StubRelation(an essential component ofinline statssupport). StubRelation can be regarded as a source plan node (similar to EsRelation) and, thus, the synthetics attributes handling as part of union types feature should be mirrored in this "source" plan as well.To make this handling "encapsulated" and tightly linked to StubRelation, the constructor of the class has been changed so that theoutputlist of Attributes is computed only in one place and be "reused" whenever a StubRelation is created or changed.