Skip to content

Commit 35ed8ea

Browse files
committed
Improve some comments
1 parent 44dca94 commit 35ed8ea

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
*
3535
* To adequately represent e.g. union types, the name of the attribute can be altered because we may have multiple synthetic field
3636
* attributes that really belong to the same underlying field. For instance, if a multi-typed field is used both as {@code field::string}
37-
* and {@code field::ip}, we'll generate 2 field attributes called {@code $$field$converted_to$string} and {@code $$field$converted_to$ip}
38-
* but still referring to the same underlying field.
37+
* and {@code field::ip}, we'll generate 2 field attributes called {@code $$field$converted_to$keyword} and {@code $$field$converted_to$ip}
38+
* which still refer to the same underlying index field.
3939
*/
4040
public class FieldAttribute extends TypedAttribute {
4141

@@ -162,6 +162,15 @@ public FieldName fieldName() {
162162
return lazyFieldName;
163163
}
164164

165+
/**
166+
* The name of the attribute. Can deviate from the field name e.g. in case of union types. For the physical field name, use
167+
* {@link FieldAttribute#fieldName()}.
168+
*/
169+
@Override
170+
public String name() {
171+
return super.name();
172+
}
173+
165174
public EsField.Exact getExactInfo() {
166175
return field.getExactInfo();
167176
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ protected Map<String, Object> resolvedOptions() throws InvalidArgumentException
396396
return Map.of();
397397
}
398398

399+
// TODO: this should likely be replaced by calls to FieldAttribute#fieldName; the MultiTypeEsField case looks
400+
// wrong if `fieldAttribute` is a subfield, e.g. `parent.child` - multiTypeEsField#getName will just return `child`.
399401
public static String getNameFromFieldAttribute(FieldAttribute fieldAttribute) {
400402
String fieldName = fieldAttribute.name();
401403
if (fieldAttribute.field() instanceof MultiTypeEsField multiTypeEsField) {

0 commit comments

Comments
 (0)