Skip to content

Commit dadb6c5

Browse files
committed
Do it this way instead
1 parent 99392c6 commit dadb6c5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/Length.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ public ExpressionEvaluator.Factory toEvaluator(ToEvaluator toEvaluator) {
100100
@Override
101101
public PushedBlockLoaderExpression tryPushToFieldLoading(SearchStats stats) {
102102
if (field instanceof FieldAttribute f) {
103-
if (stats.hasDocValues(f.fieldName()) == false) {
104-
return null;
105-
}
106103
BlockLoaderWarnings warnings = new BlockLoaderWarnings(DriverContext.WarningsMode.COLLECT, source());
107104
return new PushedBlockLoaderExpression(f, new BlockLoaderFunctionConfig.Named("LENGTH", warnings));
108105
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/stats/SearchContextStats.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ public boolean supportsLoaderConfig(
168168
for (SearchExecutionContext context : contexts) {
169169
MappedFieldType ft = context.getFieldType(name.string());
170170
if (ft == null) {
171-
// Missing fields are always null, no matter what we try to push.
172-
continue;
171+
/*
172+
* Missing fields are always null no matter what we try to push so they
173+
* should work, but we need this check here to prevent actually pushing
174+
* to a LOOKUP JOIN. If the field comes from a LOOKUP JOIN then it'll
175+
* show up as missing here. And we can't push to those fields. Yet.
176+
*/
177+
return false;
173178
}
174179
if (ft.supportsBlockLoaderConfig(config, preference) == false) {
175180
// If any one field doesn't support the loader config we'll disable pushing the expression to the field

0 commit comments

Comments
 (0)