ESQL: Fix unresolved name pattern#143210
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Hi @alex-spies, I've created a changelog YAML for you. |
| case 1 -> pattern = randomValueOtherThan(pattern, () -> randomAlphaOfLength(4)); | ||
| } | ||
| return new UnresolvedNamePattern(source, null, name, pattern); | ||
| return new UnresolvedNamePattern(source, null, pattern, name); |
There was a problem hiding this comment.
This was switched up as discovered by @ebarlas . This made is that in very much most of cases, the mutation changed the pattern, anyway, and thus we never saw that changes to the name had no effect on equality.
astefan
left a comment
There was a problem hiding this comment.
LGTM with a small nit about a comment. Thank you @alex-spies
| private final CharacterRunAutomaton automaton; | ||
| private final String pattern; | ||
| // string representation without backquotes | ||
| // cannot just use NamedExpression.name() because the superclass gives this a constant value of "<unresolved>" |
There was a problem hiding this comment.
I was looking at this comment and I realized the class hierarchy is confusing.
- NamedExpression has a private field
nameand a publicname()method - UnresolvedNamedExpression overrides
name()to throw UnresolvedException - UnresolvedNamePattern has a different
nameprivate field and overridesname()to returnthisname.
So the comment here is about the name() in UnresolvedNamePattern I believe which doesn't return <unresolved> but throws an exception. I think a better comment here would be
Cannot rely on NamedExpression.name: the UnresolvedNamedExpression superclass throws on name()
and stores "<unresolved>" as the internal name field.
But the class hierarchy still remains confusing. Not something for this PR though.
There was a problem hiding this comment.
Your comment is better.
I'll also go and rename the private member name to actualName just so it is a tiny bit less confusing.
Thanks @ebarlas for the find! Supersedes elastic#143191. * Fix `UnresolvedNamePatternTests` by actually ensuring that the equality is sensitive to changes of the `name`. * Fix `UnresolvedNamePattern#equals` and `#hashCode` to account for differences in the `name` We probably never saw problems from this in production because the name is derived from the pattern. Basic equality methods should still work correctly, however.
💚 Backport successful
|
Thanks @ebarlas for the find! Supersedes #143191. * Fix `UnresolvedNamePatternTests` by actually ensuring that the equality is sensitive to changes of the `name`. * Fix `UnresolvedNamePattern#equals` and `#hashCode` to account for differences in the `name` We probably never saw problems from this in production because the name is derived from the pattern. Basic equality methods should still work correctly, however.
…cations * upstream/main: (60 commits) Use batches for other bulk vector benchmarks (elastic#143167) Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {csv-spec:lookup-join.MvJoinKeyOnTheLookupIndexAfterStats} elastic#143388 Mute org.elasticsearch.snapshots.ConcurrentSnapshotsIT testBackToBackQueuedDeletes elastic#143387 [Inference API] Parse endpoint metadata from persisted endpoints (elastic#143081) Add cluster formation doc to DistributedArchitectureGuide (elastic#143318) Fix flattened root block loader null expectation (elastic#143238) Unmute ValueSourceReaderTypeConversionTests testLoadAll (elastic#143189) ESQL: Add split coalescing for many small files (elastic#143335) Unmute mixed-cluster spatial parse warning test (elastic#143186) Fix zero-size estimate in BytesRefBlock null test (elastic#143258) Make DataType and DataFormat top-level enums (elastic#143312) Add support for steps to change the target index name for later steps (elastic#142955) Set mayContainDuplicates flag to test deduplication (elastic#143375) ESQL: Fix Driver search load millis as nanos bug (elastic#143267) Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {csv-spec:lookup-join.LookupJoinWithMixPushableAndUnpushableFilters} elastic#143378 ESQL: Forbid MV_EXPAND before full text functions (elastic#143249) ESQL: Fix unresolved name pattern (elastic#143210) Implement boxplot queryDSL aggregation for exponential_histograms (elastic#143026) Add prefetching to x64 bulk vector implementations (elastic#142387) Make large segment vector tests resilient to memory constraints (elastic#143366) ...
Thanks @ebarlas for the find! Supersedes elastic#143191. * Fix `UnresolvedNamePatternTests` by actually ensuring that the equality is sensitive to changes of the `name`. * Fix `UnresolvedNamePattern#equals` and `#hashCode` to account for differences in the `name` We probably never saw problems from this in production because the name is derived from the pattern. Basic equality methods should still work correctly, however.
Thanks @ebarlas for the find!
Supersedes #143191.
UnresolvedNamePatternTestsby actually ensuring that the equality is sensitive to changes of thename.UnresolvedNamePattern#equalsand#hashCodeto account for differences in thenameWe probably never saw problems from this in production because the name is derived from the pattern. Basic equality methods should still work correctly, however.