Class BinarySpatialFunction
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<Expression>
org.elasticsearch.xpack.esql.core.expression.Expression
org.elasticsearch.xpack.esql.core.expression.function.Function
org.elasticsearch.xpack.esql.core.expression.function.scalar.ScalarFunction
org.elasticsearch.xpack.esql.core.expression.function.scalar.BinaryScalarFunction
org.elasticsearch.xpack.esql.expression.function.scalar.spatial.BinarySpatialFunction
- All Implemented Interfaces:
NamedWriteable,Writeable,Resolvable
- Direct Known Subclasses:
SpatialRelatesFunction,StDistance
Spatial functions that take two arguments that must both be spatial types can inherit from this class.
This provides common support for type resolution and validation. Ensuring that both arguments are spatial types
and of compatible CRS. For example geo_point and geo_shape can be compared, but not geo_point and cartesian_point.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic enumFor most spatial functions we only need to know if the CRS is geo or cartesian, not whether the type is point or shape.protected static classNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final booleanprotected final BinarySpatialFunction.SpatialTypeResolverFields inherited from class org.elasticsearch.xpack.esql.core.expression.function.scalar.ScalarFunction
MAX_BYTES_REF_RESULT_SIZEFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBinarySpatialFunction(StreamInput in, boolean leftDocValues, boolean rightDocValues, boolean pointsOnly, boolean supportsGrid) protectedBinarySpatialFunction(Source source, Expression left, Expression right, boolean leftDocValues, boolean rightDocValues, boolean pointsOnly, boolean supportsGrid) -
Method Summary
Modifier and TypeMethodDescriptioncrsType()booleanprotected abstract Objectfold(org.elasticsearch.geometry.Geometry leftGeom, org.elasticsearch.geometry.Geometry rightGeom) fold(FoldContext ctx) Evaluate this expression statically to a constant.inthashCode()left()booleanprotected Expression.TypeResolutionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method.right()booleanvoidsetCrsType(DataType dataType) source()protected static booleanspatialCRSCompatible(DataType spatialDataType, DataType otherDataType) translatable(LucenePushdownPredicates pushdownPredicates) Push-down to Lucene is only possible if one field is an indexed spatial field, and the other is a constant spatial or string column.abstract BinarySpatialFunctionwithDocValues(boolean foundLeft, boolean foundRight) Mark the function as expecting the specified fields to arrive as doc-values.voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.core.expression.function.scalar.BinaryScalarFunction
foldable, left, replaceChildren, replaceChildren, rightMethods inherited from class org.elasticsearch.xpack.esql.core.expression.function.Function
arguments, functionName, nodeString, nullableMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, dataType, propertiesToString, references, resolved, semanticEquals, semanticHash, toString, typeResolvedMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, info, nodeName, nodeProperties, replaceChildrenSameSize, source, sourceLocation, sourceText, transformChildren, transformDown, transformDown, transformDown, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUpMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableName
-
Field Details
-
spatialTypeResolver
-
leftDocValues
protected final boolean leftDocValues -
rightDocValues
protected final boolean rightDocValues
-
-
Constructor Details
-
BinarySpatialFunction
protected BinarySpatialFunction(Source source, Expression left, Expression right, boolean leftDocValues, boolean rightDocValues, boolean pointsOnly, boolean supportsGrid) -
BinarySpatialFunction
protected BinarySpatialFunction(StreamInput in, boolean leftDocValues, boolean rightDocValues, boolean pointsOnly, boolean supportsGrid) throws IOException - Throws:
IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classBinaryScalarFunction- Throws:
IOException
-
fold
protected abstract Object fold(org.elasticsearch.geometry.Geometry leftGeom, org.elasticsearch.geometry.Geometry rightGeom) -
fold
Description copied from class:ExpressionEvaluate this expression statically to a constant. It is an error to call this ifExpression.foldable()returns false.- Overrides:
foldin classExpression
-
withDocValues
Mark the function as expecting the specified fields to arrive as doc-values. -
hashCode
public int hashCode() -
equals
-
resolveType
Description copied from class:ExpressionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method. See it's javadoc for what this method should return.Implementations will rarely interact with the
Expression.TypeResolutionclass directly, instead usually calling the utility methods onTypeResolutions.Implementations should fail if
Expression.childrenResolved()returnsfalse.- Overrides:
resolveTypein classExpression
-
setCrsType
-
spatialCRSCompatible
-
crsType
-
leftDocValues
public boolean leftDocValues() -
rightDocValues
public boolean rightDocValues() -
translatable
Push-down to Lucene is only possible if one field is an indexed spatial field, and the other is a constant spatial or string column. -
source
Source source() -
left
Expression left() -
right
Expression right()
-