Class FieldAttribute
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable
- Direct Known Subclasses:
TemporalityAttribute,TimeSeriesMetadataAttribute,UnsupportedAttribute
EsField subclass if needed.
Attribute for an ES field. May actually stand for a field with the same name across different indices (a union), e.g. when
index pattern were used in the query: FROM logs-* | KEEP field.
This class offers:
- name - the name of the attribute, but not necessarily of the field.
- The raw EsField representing the field; for parent.child.grandchild this is just grandchild.
- parentName - the full path to the immediate parent of the field, e.g. parent.child (without .grandchild)
To adequately represent e.g. union types, the name of the attribute can be altered because we may have multiple synthetic field
attributes that really belong to the same underlying field. For instance, if a multi-typed field is used both as field::string
and field::ip, we'll generate 2 field attributes called $$field$converted_to$keyword and $$field$converted_to$ip
which still refer to the same underlying index field.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA field name, as found in the mapping.Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Attribute
Attribute.IdIgnoringWrapperNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.tree.Node
Node.NodeStringFormatNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransportVersionstatic final TransportVersionprotected FieldAttribute.FieldNameFields inherited from class org.elasticsearch.xpack.esql.core.expression.Attribute
SYNTHETIC_ATTRIBUTE_NAME_PREFIX, SYNTHETIC_ATTRIBUTE_NAME_SEPARATORFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_LINES, TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionFieldAttribute(Source source, String parentName, String qualifier, String name, EsField field, boolean synthetic) FieldAttribute(Source source, String parentName, String qualifier, String name, EsField field, Nullability nullability, NameId id, boolean synthetic) FieldAttribute(Source source, String name, EsField field) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionIf the underlying field is anInvalidMappedField(ambiguous type across indices), converts this attribute into anUnsupportedAttributewith a descriptive error message so the analyzer can surface a clear user-facing error.protected Attributeclone(Source source, String qualifier, String name, DataType type, Nullability nullability, NameId id, boolean synthetic) field()The full name of the field in the index, including all parent fields.protected NodeInfo<? extends Expression> info()Normally, you want to use one of the staticcreatemethods to implement this.protected booleaninnerEquals(Object o, boolean ignoreIds) The actual equality check, after shortcuttingthis == oand class checks.protected intinnerHashCode(boolean ignoreIds) booleanbooleanisMetric()protected Stringlabel()name()The name of the attribute.voidnodeString(StringBuilder sb, Node.NodeStringFormat format) Append thisNode's string representation tosb.static FieldAttributereadFrom(StreamInput in) static TimeSeriesMetadataAttributetimeSeriesAttribute(Source source) Creates aTimeSeriesMetadataAttributerepresenting theMetadataAttribute.TIMESERIESfield with no excluded dimensions.withDataType(DataType type) voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.core.expression.TypedAttribute
dataTypeMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Attribute
canonicalize, checkAndSerializeQualifier, dataTypeEquals, ignoreId, nullable, qualifiedName, qualifier, rawTemporaryName, readQualifier, references, replaceChildren, semanticEquals, semanticHash, toAttribute, toString, withId, withLocation, withName, withNullability, withQualifierMethods inherited from class org.elasticsearch.xpack.esql.core.expression.NamedExpression
equals, equals, hashCode, hashCode, id, syntheticMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, childrenResolved, fold, foldable, propertiesToString, resolved, resolveType, toString, typeResolvedMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
allMatch, anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, nodeString, replaceChildrenSameSize, source, sourceLocation, sourceText, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUp
-
Field Details
-
ESQL_FIELD_ATTRIBUTE_DROP_TYPE
-
ESQL_TIMESERIES_METADATA_ATTRIBUTE
-
lazyFieldName
-
-
Constructor Details
-
FieldAttribute
Deprecated. -
FieldAttribute
-
FieldAttribute
-
FieldAttribute
-
-
Method Details
-
timeSeriesAttribute
Creates aTimeSeriesMetadataAttributerepresenting theMetadataAttribute.TIMESERIESfield with no excluded dimensions. -
writeTo
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
getWriteableName
-
info
Description copied from class:NodeNormally, you want to use one of the staticcreatemethods to implement this.For
QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations likeQueryPlan#transformExpressionsOnly(Function)will not have an effect.- Specified by:
infoin classNode<Expression>
-
parentName
-
fieldName
The full name of the field in the index, including all parent fields. E.g.parent.subfield.this_field. -
checkUnresolved
If the underlying field is anInvalidMappedField(ambiguous type across indices), converts this attribute into anUnsupportedAttributewith a descriptive error message so the analyzer can surface a clear user-facing error. -
name
The name of the attribute. Can deviate from the field name e.g. in case of union types. For the physical field name, usefieldName().- Overrides:
namein classNamedExpression
-
getExactInfo
-
exactAttribute
-
clone
-
withDataType
- Overrides:
withDataTypein classAttribute
-
innerHashCode
protected int innerHashCode(boolean ignoreIds) - Overrides:
innerHashCodein classTypedAttribute
-
innerEquals
Description copied from class:NamedExpressionThe actual equality check, after shortcuttingthis == oand class checks.- Overrides:
innerEqualsin classTypedAttribute
-
label
-
isDimension
public boolean isDimension()- Specified by:
isDimensionin classAttribute- Returns:
- true if the attribute represents a TSDB dimension type
-
isMetric
public boolean isMetric() -
field
-
nodeString
Description copied from class:Node- Overrides:
nodeStringin classAttribute- Parameters:
sb- target for the stringformat- configuration for rendering the string representation
-