Skip to content

Commit 39838b8

Browse files
committed
fix comments
1 parent 6a4b18c commit 39838b8

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/NamedExpression.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public int hashCode() {
6262
}
6363

6464
/**
65-
* Polymorphic equality is a pain.
66-
* This equals shortcuts `this == o` and type checks.
67-
* Here equals is final to ensure we are not duplication those checks.
65+
* Polymorphic equality is a pain and are likely slower than a regular ones.
66+
* This equals shortcuts `this == o` and type checks (important when we expect only a few non-equal objects).
67+
* Here equals is final to ensure we are not duplicating those checks.
6868
* For actual equality check override `innerEquals` instead.
6969
*/
7070
@Override

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/UnresolvedAttribute.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
// unfortunately we can't use UnresolvedNamedExpression
2323
public class UnresolvedAttribute extends Attribute implements Unresolvable {
24-
private final String unresolvedMsg;
2524
private final boolean customMessage;
25+
private final String unresolvedMsg;
2626
private final Object resolutionMetadata;
2727

2828
public UnresolvedAttribute(Source source, String name) {
@@ -128,8 +128,7 @@ public int hashCode() {
128128
protected boolean innerEquals(Object o) {
129129
var other = (UnresolvedAttribute) o;
130130
return super.innerEquals(other)
131-
&& customMessage == other.customMessage
132-
&& Objects.equals(unresolvedMsg, other.unresolvedMsg)
133-
&& Objects.equals(resolutionMetadata, other.resolutionMetadata);
131+
&& Objects.equals(resolutionMetadata, other.resolutionMetadata)
132+
&& Objects.equals(unresolvedMsg, other.unresolvedMsg);
134133
}
135134
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/UnsupportedAttribute.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public final class UnsupportedAttribute extends FieldAttribute implements Unreso
5757
UnsupportedAttribute::readFrom
5858
);
5959

60-
private final String message;
6160
private final boolean hasCustomMessage; // TODO remove me and just use message != null?
61+
private final String message;
6262

6363
private static String errorMessage(String name, UnsupportedEsField field) {
6464
return "Cannot use field [" + name + "] with unsupported type [" + String.join(",", field.getOriginalTypes()) + "]";
@@ -165,7 +165,7 @@ public boolean hasCustomMessage() {
165165
@Override
166166
@SuppressWarnings("checkstyle:EqualsHashCode")// equals is implemented in parent. See innerEquals instead
167167
public int hashCode() {
168-
return Objects.hash(super.hashCode(), message, hasCustomMessage);
168+
return Objects.hash(super.hashCode(), hasCustomMessage, message);
169169
}
170170

171171
@Override

0 commit comments

Comments
 (0)