-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Simplify TableIdentifier class + rename to IndexPattern #120797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
2a88a8c
8014b3c
2bfe50c
73219a8
9ea40be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| package org.elasticsearch.xpack.esql.plan; | ||
|
|
||
| import org.elasticsearch.xpack.esql.core.tree.Source; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Contains an index pattern together with its {@link Source}. Can also be a comma-separated list, like {@code idx-*,remote:other-idx*}. | ||
| */ | ||
| public class IndexPattern { | ||
|
|
||
| private final Source source; | ||
| private final String indexPattern; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this should be called indexPattern(s) as it might list coma separated patterns? Not sure if it is needed often, but #120277 would benefit if it is possible to return list/array of separate patterns. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can add a helper method as part of #120277! I'd like to not add logic in this PR, so it remains a straight refactoring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, yeah, |
||
|
|
||
| public IndexPattern(Source source, String indexPattern) { | ||
| this.source = source; | ||
| this.indexPattern = indexPattern; | ||
| } | ||
|
|
||
| public String index() { | ||
| return indexPattern; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(indexPattern); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
|
|
||
| if (obj == null || getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
|
|
||
| IndexPattern other = (IndexPattern) obj; | ||
| return Objects.equals(indexPattern, other.indexPattern); | ||
| } | ||
|
|
||
| public Source source() { | ||
| return source; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return indexPattern; | ||
| } | ||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a future PR, I think this class just has to go. It is a wrapper around
TableIdentifier, except that it throws away the equality/hash methods and uses instance identity for equality.