Skip to content

Commit 6ee9c45

Browse files
committed
Replace fold for retrieving the Literal value directly
1 parent 2c172e1 commit 6ee9c45

File tree

1 file changed

+5
-4
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.xpack.esql.core.expression.Expression;
2424
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
2525
import org.elasticsearch.xpack.esql.core.expression.FoldContext;
26+
import org.elasticsearch.xpack.esql.core.expression.Literal;
2627
import org.elasticsearch.xpack.esql.core.expression.MapExpression;
2728
import org.elasticsearch.xpack.esql.core.expression.TypeResolutions;
2829
import org.elasticsearch.xpack.esql.core.querydsl.query.Query;
@@ -280,10 +281,10 @@ private Map<String, Object> parseOptions() throws InvalidArgumentException {
280281
if (resolution.unresolved()) {
281282
throw new InvalidArgumentException(resolution.message());
282283
}
283-
Object optionExprFold = optionExpr.fold(FoldContext.small());
284-
Object valueExprFold = valueExpr.fold(FoldContext.small());
285-
String optionName = optionExprFold instanceof BytesRef br ? br.utf8ToString() : optionExprFold.toString();
286-
String optionValue = valueExprFold instanceof BytesRef br ? br.utf8ToString() : valueExprFold.toString();
284+
Object optionExprLiteral = ((Literal) optionExpr).value();
285+
Object valueExprLiteral = ((Literal) valueExpr).value();
286+
String optionName = optionExprLiteral instanceof BytesRef br ? br.utf8ToString() : optionExprLiteral.toString();
287+
String optionValue = valueExprLiteral instanceof BytesRef br ? br.utf8ToString() : valueExprLiteral.toString();
287288
// validate the optionExpr is supported
288289
DataType dataType = ALLOWED_OPTIONS.get(optionName);
289290
if (dataType == null) {

0 commit comments

Comments
 (0)