Skip to content

Commit fd1abd0

Browse files
committed
Trying to fix failures
1 parent 3a92130 commit fd1abd0

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/Analyzer.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,8 +1464,7 @@ private Optional<Expression> convertHelper(
14641464
if (typeResolutions.size() != imf.getTypesToIndices().size()) {
14651465
return Optional.empty();
14661466
}
1467-
// If all mapped types were resolved, create a new FieldAttribute with the resolved MultiTypeEsField
1468-
MultiTypeEsField multiTypeEsField = resolvedMultiTypeEsField(imf, typeResolutions);
1467+
MultiTypeEsField multiTypeEsField = resolvedMultiTypeEsField(fa.fieldName(), imf, typeResolutions);
14691468
return Optional.of(createIfDoesNotAlreadyExist(fa, fieldFinisher.apply(multiTypeEsField), unionFieldAttributes));
14701469
}
14711470

@@ -1489,11 +1488,15 @@ private Expression createIfDoesNotAlreadyExist(
14891488
}
14901489
}
14911490

1492-
private MultiTypeEsField resolvedMultiTypeEsField(InvalidMappedField imf, HashMap<TypeResolutionKey, Expression> typeResolutions) {
1491+
private MultiTypeEsField resolvedMultiTypeEsField(
1492+
String fieldAttributeName,
1493+
InvalidMappedField imf,
1494+
HashMap<TypeResolutionKey, Expression> typeResolutions
1495+
) {
14931496
Map<String, Expression> typesToConversionExpressions = new HashMap<>();
14941497
imf.getTypesToIndices().forEach((typeName, indexNames) -> {
14951498
DataType type = DataType.fromTypeName(typeName);
1496-
TypeResolutionKey key = new TypeResolutionKey(imf.getName(), type);
1499+
TypeResolutionKey key = new TypeResolutionKey(fieldAttributeName, type);
14971500
if (typeResolutions.containsKey(key)) {
14981501
typesToConversionExpressions.put(typeName, typeResolutions.get(key));
14991502
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/Insist.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import java.util.List;
2525
import java.util.OptionalInt;
2626

27-
public final class Insist extends UnaryPlan {
27+
public class Insist extends UnaryPlan {
2828
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(LogicalPlan.class, "INSIST", Insist::new);
2929

3030
private final InsistParameters parameters;

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/tree/EsqlNodeSubclassTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Concat;
4242
import org.elasticsearch.xpack.esql.expression.predicate.fulltext.FullTextPredicate;
4343
import org.elasticsearch.xpack.esql.index.EsIndex;
44+
import org.elasticsearch.xpack.esql.plan.InsistParameters;
4445
import org.elasticsearch.xpack.esql.plan.logical.Dissect;
4546
import org.elasticsearch.xpack.esql.plan.logical.Grok;
4647
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
@@ -441,6 +442,9 @@ public void accept(Page page) {
441442
return randomInt();
442443
} else if (argClass == JoinType.class) {
443444
return JoinTypes.LEFT;
445+
} else if (argClass == InsistParameters.class) {
446+
// record class
447+
return new InsistParameters(randomAlphaOfLength(16));
444448
}
445449

446450
if (Expression.class == argClass) {

0 commit comments

Comments
 (0)