Class WildcardLike
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.UnaryScalarFunction
org.elasticsearch.xpack.esql.core.expression.predicate.regex.RegexMatch<WildcardPattern>
org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLike
- All Implemented Interfaces:
NamedWriteable,Writeable,TranslationAware,TranslationAware.SingleValueTranslationAware,Resolvable,EvaluatorMapper
-
Nested Class Summary
Nested 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.xpack.esql.evaluator.mapper.EvaluatorMapper
EvaluatorMapper.ToEvaluatorNested classes/interfaces inherited from interface org.elasticsearch.xpack.esql.capabilities.TranslationAware
TranslationAware.FinishedTranslatable, TranslationAware.SingleValueTranslationAware, TranslationAware.TranslatableNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields 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_LINES, TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionWildcardLike(Source source, Expression left, WildcardPattern pattern) WildcardLike(Source source, Expression left, WildcardPattern pattern, boolean caseInsensitive) -
Method Summary
Modifier and TypeMethodDescriptionasQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHandler handler) Translates the implementing expression into a Query.fold(FoldContext ctx) Evaluate this expression statically to a constant.protected NodeInfo<WildcardLike> info()Normally, you want to use one of the staticcreatemethods to implement this.name()voidnodeString(StringBuilder sb, Node.NodeStringFormat format, NodeStringMapper mapper) Append thisNode's string representation tosb.optimizeStringCasingWithInsensitiveRegexMatch(Expression unwrappedField, Predicate<String> matchesCaseFn) Pushes down string casing optimization for a single pattern using the provided predicate.protected WildcardLikereplaceChild(Expression newLeft) protected Expression.TypeResolutionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method.Returns the field that only supports single-value semantics.toEvaluator(EvaluatorMapper.ToEvaluator toEvaluator) Fast path for prefix, suffix, and contains wildcard shapes (e.g.translatable(LucenePushdownPredicates pushdownPredicates) Can this instance be translated or not? Usually checks whether the expression arguments are actual fields that exist in Lucene.voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.core.expression.predicate.regex.RegexMatch
caseInsensitive, dataType, equals, foldable, hashCode, nullable, patternMethods inherited from class org.elasticsearch.xpack.esql.core.expression.function.scalar.UnaryScalarFunction
field, replaceChildrenMethods inherited from class org.elasticsearch.xpack.esql.core.expression.function.Function
arguments, functionNameMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, propertiesToString, references, resolved, semanticEquals, semanticHash, toString, 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, toString, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, 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.xpack.esql.evaluator.mapper.EvaluatorMapper
foldMethods inherited from interface org.elasticsearch.xpack.esql.capabilities.TranslationAware
asLuceneQuery
-
Field Details
-
ENTRY
-
NAME
- See Also:
-
-
Constructor Details
-
WildcardLike
-
WildcardLike
public WildcardLike(Source source, Expression left, WildcardPattern pattern, boolean caseInsensitive)
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classUnaryScalarFunction- Throws:
IOException
-
name
-
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>
-
replaceChild
- Specified by:
replaceChildin classUnaryScalarFunction
-
toEvaluator
Fast path for prefix, suffix, and contains wildcard shapes (e.g.LIKE "foo*",LIKE "*foo",LIKE "*foo*"): dispatch to byte-comparison / byte-substring-search evaluators instead of building anAutomatonand runningRunAutomaton.stepper row. The general path (other patterns, case-insensitive matching) still goes throughAutomataMatch. Prefix and suffix reuse theSTARTS_WITH/ENDS_WITHevaluators; contains delegates to the SIMD-backedprocessContains(org.apache.lucene.util.BytesRef, org.apache.lucene.util.BytesRef)below.- Specified by:
toEvaluatorin interfaceEvaluatorMapper
-
translatable
Description copied from interface:TranslationAwareCan this instance be translated or not? Usually checks whether the expression arguments are actual fields that exist in Lucene. SeeTranslationAware.Translatablefor precisely what can be signaled from this method.- Specified by:
translatablein interfaceTranslationAware
-
asQuery
Description copied from interface:TranslationAwareTranslates the implementing expression into a Query. If during translation a child needs to be translated first, the handler needs to be used even if the child implements this interface as well. This is to ensure that the child is wrapped in a SingleValueQuery if necessary.So use this:
Query childQuery = handler.asQuery(child);and not this:
Query childQuery = child.asQuery(handler); -
optimizeStringCasingWithInsensitiveRegexMatch
public Expression optimizeStringCasingWithInsensitiveRegexMatch(Expression unwrappedField, Predicate<String> matchesCaseFn) Pushes down string casing optimization for a single pattern using the provided predicate. Returns a new WildcardLike with case insensitivity or a Literal.FALSE if not matched.- Specified by:
optimizeStringCasingWithInsensitiveRegexMatchin classRegexMatch<WildcardPattern>- Parameters:
unwrappedField- the field with to_upper/to_lower function removedmatchesCaseFn- a predicate to check if a pattern matches the case- Returns:
- an optimized equivalent Expression or this if no optimization is possible
-
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 classRegexMatch<P extends AbstractStringPattern>
-
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 classRegexMatch<P extends AbstractStringPattern>
-
singleValueField
Description copied from interface:TranslationAware.SingleValueTranslationAwareReturns the field that only supports single-value semantics.- Specified by:
singleValueFieldin interfaceTranslationAware.SingleValueTranslationAware
-
nodeString
Description copied from class:Node- Overrides:
nodeStringin classFunction- Parameters:
sb- target for the stringformat- output-shape configuration (width / lines / property count)mapper- identifier-mapping strategy (raw viaNodeStringMapper.IDENTITY, anonymized via the failure-path anonymizer, etc.)
-