Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,4 @@ public String nodeString() {
}

protected abstract String label();

/**
* If this field is unsupported this contains the underlying ES types. If there
* is a type conflict this will have many elements, some or all of which may
* be actually supported types.
*/
@Nullable
public List<String> originalTypes() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.elasticsearch.xpack.esql.core.util.PlanStreamOutput;

import java.io.IOException;
import java.util.List;
import java.util.Objects;

import static org.elasticsearch.xpack.esql.core.util.PlanStreamInput.readCachedStringWithVersionCheck;
Expand Down Expand Up @@ -242,4 +243,14 @@ protected String label() {
public EsField field() {
return field;
}

/**
* If this field is unsupported this contains the underlying ES types. If there
* is a type conflict this will have many elements, some or all of which may
* be actually supported types.
*/
@Nullable
public List<String> originalTypes() {
return null;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to move it, maybe just put it in UnsupportedAttribute. I don't like that either, but it feels better than this in the middle spot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we wanted to keep it on FieldAttribute level as we might want to create one (or subtype) from a MultiTypeEsField at some point. But anyways I pushed it further down now and we can revise this if/when needed.

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.elasticsearch.xpack.esql.action.EsqlQueryResponse;
import org.elasticsearch.xpack.esql.action.EsqlQueryTask;
import org.elasticsearch.xpack.esql.core.async.AsyncTaskManagementService;
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
import org.elasticsearch.xpack.esql.core.expression.FoldContext;
import org.elasticsearch.xpack.esql.enrich.AbstractLookupService;
import org.elasticsearch.xpack.esql.enrich.EnrichLookupService;
Expand Down Expand Up @@ -321,12 +322,12 @@ private EsqlExecutionInfo createEsqlExecutionInfo(EsqlQueryRequest request) {
private EsqlQueryResponse toResponse(Task task, EsqlQueryRequest request, Configuration configuration, Result result) {
List<ColumnInfoImpl> columns = result.schema().stream().map(c -> {
List<String> originalTypes;
if (c.originalTypes() == null) {
originalTypes = null;
} else {
if (c instanceof FieldAttribute fa && (originalTypes = fa.originalTypes()) != null) {
// Sort the original types so they are easier to test against and prettier.
originalTypes = new ArrayList<>(c.originalTypes());
originalTypes = new ArrayList<>(originalTypes);
Collections.sort(originalTypes);
} else {
originalTypes = null;
}
return new ColumnInfoImpl(c.name(), c.dataType().outputType(), originalTypes);
}).toList();
Expand Down