Skip to content

Commit 28e9fa4

Browse files
committed
Rename
1 parent fa3487e commit 28e9fa4

File tree

10 files changed

+36
-27
lines changed

10 files changed

+36
-27
lines changed

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static TransportVersion def(int id) {
209209
public static final TransportVersion INDEX_STATS_AND_METADATA_INCLUDE_PEAK_WRITE_LOAD = def(9_041_0_00);
210210
public static final TransportVersion REPOSITORIES_METADATA_AS_PROJECT_CUSTOM = def(9_042_0_00);
211211
public static final TransportVersion BATCHED_QUERY_PHASE_VERSION = def(9_043_0_00);
212-
public static final TransportVersion ESQL_VALUES_LOADED = def(9_044_0_00);
212+
public static final TransportVersion ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED = def(9_044_0_00);
213213

214214
/*
215215
* STOP! READ THIS FIRST! No, really,

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperator.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import java.util.function.IntFunction;
4848
import java.util.function.Supplier;
4949

50-
import static org.elasticsearch.TransportVersions.ESQL_VALUES_LOADED;
50+
import static org.elasticsearch.TransportVersions.ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED;
5151

5252
/**
5353
* Operator that extracts doc_values from a Lucene index out of pages that have been produced by {@link LuceneSourceOperator}
@@ -582,18 +582,14 @@ public static class Status extends AbstractPageMappingOperator.Status {
582582
Status(StreamInput in) throws IOException {
583583
super(in);
584584
readersBuilt = in.readOrderedMap(StreamInput::readString, StreamInput::readVInt);
585-
if (in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
586-
valuesLoaded = in.readVLong();
587-
} else {
588-
valuesLoaded = 0;
589-
}
585+
valuesLoaded = in.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED) ? in.readVLong() : 0;
590586
}
591587

592588
@Override
593589
public void writeTo(StreamOutput out) throws IOException {
594590
super.writeTo(out);
595591
out.writeMap(readersBuilt, StreamOutput::writeVInt);
596-
if (out.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
592+
if (out.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED)) {
597593
out.writeVLong(valuesLoaded);
598594
}
599595
}

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/DriverCompletionInfo.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
/**
2121
* Information returned when one of more {@link Driver}s is completed.
2222
* @param documentsFound The number of documents found by all lucene queries performed by these drivers.
23-
* @param valuesLoaded The number of values loaded from lucene for all drivers.
23+
* @param valuesLoaded The number of values loaded from lucene for all drivers. This is
24+
* <strong>roughly</strong> the number of documents times the number of
25+
* fields per document. Except {@code null} values don't count.
26+
* And multivalued fields count as many times as there are values.
2427
* @param collectedProfiles {@link DriverProfile}s from each driver. These are fairly cheap to build but
2528
* not free so this will be empty if the {@code profile} option was not set in
2629
* the request.

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/DriverStatus.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,27 @@ public String toString() {
151151
* The number of documents found by this driver.
152152
*/
153153
public long documentsFound() {
154-
long documentsFound = completedOperators.stream().mapToLong(OperatorStatus::documentsFound).sum();
155-
documentsFound += activeOperators.stream().mapToLong(OperatorStatus::documentsFound).sum();
154+
long documentsFound = 0;
155+
for (OperatorStatus s : completedOperators) {
156+
documentsFound += s.documentsFound();
157+
}
158+
for (OperatorStatus s : activeOperators) {
159+
documentsFound += s.documentsFound();
160+
}
156161
return documentsFound;
157162
}
158163

159164
/**
160165
* The number of values loaded by this operator.
161166
*/
162167
public long valuesLoaded() {
163-
long valuesLoaded = completedOperators.stream().mapToLong(OperatorStatus::valuesLoaded).sum();
164-
valuesLoaded += activeOperators.stream().mapToLong(OperatorStatus::valuesLoaded).sum();
168+
long valuesLoaded = 0;
169+
for (OperatorStatus s : completedOperators) {
170+
valuesLoaded += s.valuesLoaded();
171+
}
172+
for (OperatorStatus s : activeOperators) {
173+
valuesLoaded += s.valuesLoaded();
174+
}
165175
return valuesLoaded;
166176
}
167177

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ public enum Cap {
933933
* Are the {@code documents_found} and {@code values_loaded} fields available
934934
* in the response and profile?
935935
*/
936-
DOCUMENTS_FOUND,
936+
DOCUMENTS_FOUND_AND_VALUES_LOADED,
937937

938938
/**
939939
* Index component selector syntax (my-data-stream-name::failures)

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import java.util.Objects;
3636
import java.util.Optional;
3737

38-
import static org.elasticsearch.TransportVersions.ESQL_VALUES_LOADED;
38+
import static org.elasticsearch.TransportVersions.ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED;
3939

4040
public class EsqlQueryResponse extends org.elasticsearch.xpack.core.esql.action.EsqlQueryResponse
4141
implements
@@ -119,8 +119,8 @@ static EsqlQueryResponse deserialize(BlockStreamInput in) throws IOException {
119119
}
120120
List<ColumnInfoImpl> columns = in.readCollectionAsList(ColumnInfoImpl::new);
121121
List<Page> pages = in.readCollectionAsList(Page::new);
122-
long documentsFound = in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED) ? in.readVLong() : 0;
123-
long valuesLoaded = in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED) ? in.readVLong() : 0;
122+
long documentsFound = in.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED) ? in.readVLong() : 0;
123+
long valuesLoaded = in.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED) ? in.readVLong() : 0;
124124
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
125125
profile = in.readOptionalWriteable(Profile::new);
126126
}
@@ -152,7 +152,7 @@ public void writeTo(StreamOutput out) throws IOException {
152152
}
153153
out.writeCollection(columns);
154154
out.writeCollection(pages);
155-
if (out.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
155+
if (out.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED)) {
156156
out.writeVLong(documentsFound);
157157
out.writeVLong(valuesLoaded);
158158
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.io.IOException;
2020
import java.util.List;
2121

22-
import static org.elasticsearch.TransportVersions.ESQL_VALUES_LOADED;
22+
import static org.elasticsearch.TransportVersions.ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED;
2323

2424
/**
2525
* The compute result of {@link DataNodeRequest} or {@link ClusterComputeRequest}
@@ -58,7 +58,7 @@ final class ComputeResponse extends TransportResponse {
5858
}
5959

6060
ComputeResponse(StreamInput in) throws IOException {
61-
if (in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
61+
if (in.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED)) {
6262
completionInfo = new DriverCompletionInfo(in);
6363
} else if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
6464
if (in.readBoolean()) {
@@ -92,7 +92,7 @@ final class ComputeResponse extends TransportResponse {
9292

9393
@Override
9494
public void writeTo(StreamOutput out) throws IOException {
95-
if (out.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
95+
if (out.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED)) {
9696
completionInfo.writeTo(out);
9797
} else if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
9898
out.writeBoolean(true);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.io.IOException;
1818
import java.util.Map;
1919

20-
import static org.elasticsearch.TransportVersions.ESQL_VALUES_LOADED;
20+
import static org.elasticsearch.TransportVersions.ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED;
2121

2222
/**
2323
* The compute result of {@link DataNodeRequest}
@@ -32,7 +32,7 @@ final class DataNodeComputeResponse extends TransportResponse {
3232
}
3333

3434
DataNodeComputeResponse(StreamInput in) throws IOException {
35-
if (in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
35+
if (in.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED)) {
3636
this.completionInfo = new DriverCompletionInfo(in);
3737
this.shardLevelFailures = in.readMap(ShardId::new, StreamInput::readException);
3838
return;
@@ -48,7 +48,7 @@ final class DataNodeComputeResponse extends TransportResponse {
4848

4949
@Override
5050
public void writeTo(StreamOutput out) throws IOException {
51-
if (out.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED)) {
51+
if (out.getTransportVersion().onOrAfter(ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED)) {
5252
completionInfo.writeTo(out);
5353
out.writeMap(shardLevelFailures, (o, v) -> v.writeTo(o), StreamOutput::writeException);
5454
return;

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/10_basic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ basic with documents_found:
188188
- method: POST
189189
path: /_query
190190
parameters: []
191-
capabilities: [documents_found]
191+
capabilities: [documents_found_and_values_loaded]
192192
reason: "checks for documents_found and values_loaded"
193193

194194
- do:
@@ -228,7 +228,7 @@ FROM EVAL SORT LIMIT with documents_found:
228228
- method: POST
229229
path: /_query
230230
parameters: []
231-
capabilities: [documents_found]
231+
capabilities: [documents_found_and_values_loaded]
232232
reason: "checks for documents_found and values_loaded"
233233

234234
- do:

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/120_profile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ documents found:
145145
- method: POST
146146
path: /_query
147147
parameters: []
148-
capabilities: [documents_found]
148+
capabilities: [documents_found_and_values_loaded]
149149
reason: "checks for documents_found and values_loaded"
150150

151151
- do:

0 commit comments

Comments
 (0)