Skip to content

Commit 81194d1

Browse files
fix
1 parent 79b3550 commit 81194d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/local/ReplaceFieldWithConstantOrNull.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package org.elasticsearch.xpack.esql.optimizer.rules.logical.local;
99

10+
import org.elasticsearch.common.lucene.BytesRefs;
1011
import org.elasticsearch.index.IndexMode;
1112
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1213
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
@@ -56,9 +57,9 @@ else if (esRelation.indexMode() == IndexMode.STANDARD) {
5657
for (Attribute attribute : esRelation.output()) {
5758
if (attribute instanceof FieldAttribute fa) {
5859
// Do not use the attribute name, this can deviate from the field name for union types; use fieldName() instead.
59-
var val = localLogicalOptimizerContext.searchStats().constantValue(fa.fieldName());
60+
String val = localLogicalOptimizerContext.searchStats().constantValue(fa.fieldName());
6061
if (val != null) {
61-
attrToConstant.put(attribute, Literal.of(attribute, val));
62+
attrToConstant.put(attribute, Literal.of(attribute, BytesRefs.toBytesRef(val)));
6263
}
6364
}
6465
}

0 commit comments

Comments
 (0)