diff --git a/server/src/main/resources/transport/definitions/referable/esql_timestamps_info.csv b/server/src/main/resources/transport/definitions/referable/esql_timestamps_info.csv new file mode 100644 index 0000000000000..ab6d8b9bae895 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/esql_timestamps_info.csv @@ -0,0 +1 @@ +9228000 diff --git a/server/src/main/resources/transport/upper_bounds/9.3.csv b/server/src/main/resources/transport/upper_bounds/9.3.csv index 482517b9a61d6..3f6ae8e0a806d 100644 --- a/server/src/main/resources/transport/upper_bounds/9.3.csv +++ b/server/src/main/resources/transport/upper_bounds/9.3.csv @@ -1 +1 @@ -aggregate_metric_double_typed_block,9227000 +esql_timestamps_info,9228000 diff --git a/test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java b/test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java index 59c803c29e535..00a7f5596072f 100644 --- a/test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java +++ b/test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java @@ -169,6 +169,9 @@ public void testSortByManyLongsGiantTopN() throws IOException { .entry("values", List.of(List.of(9))) .entry("documents_found", greaterThan(0)) .entry("values_loaded", greaterThan(0)) + .entry("completion_time_in_millis", greaterThan(0L)) + .entry("expiration_time_in_millis", greaterThan(0L)) + .entry("start_time_in_millis", greaterThan(0L)) ); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index a9d35a8fa2fdd..c5df1fab9c917 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -2767,13 +2767,20 @@ protected static MapMatcher getProfileMatcher() { .entry("plans", instanceOf(List.class)); } - protected static MapMatcher getResultMatcher(boolean includePartial, boolean includeDocumentsFound) { + protected static MapMatcher getResultMatcher(boolean includePartial, boolean includeDocumentsFound, boolean includeTimestamps) { MapMatcher mapMatcher = matchesMap(); if (includeDocumentsFound) { // Older versions may not return documents_found and values_loaded. mapMatcher = mapMatcher.entry("documents_found", greaterThanOrEqualTo(0)); mapMatcher = mapMatcher.entry("values_loaded", greaterThanOrEqualTo(0)); } + if (includeTimestamps) { + // Older versions may not return start_time_in_millis, completion_time_in_millis and expiration_time_in_millis + mapMatcher = mapMatcher.entry("start_time_in_millis", greaterThanOrEqualTo(0L)); + mapMatcher = mapMatcher.entry("completion_time_in_millis", greaterThanOrEqualTo(0L)); + mapMatcher = mapMatcher.entry("expiration_time_in_millis", greaterThanOrEqualTo(0L)); + } + mapMatcher = mapMatcher.entry("took", greaterThanOrEqualTo(0)); // Older version may not have is_partial if (includePartial) { @@ -2786,7 +2793,11 @@ protected static MapMatcher getResultMatcher(boolean includePartial, boolean inc * Create empty result matcher from result, taking into account all metadata items. */ protected static MapMatcher getResultMatcher(Map result) { - return getResultMatcher(result.containsKey("is_partial"), result.containsKey("documents_found")); + return getResultMatcher( + result.containsKey("is_partial"), + result.containsKey("documents_found"), + result.containsKey("start_time_in_millis") + ); } /** diff --git a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterTimeSeriesIT.java b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterTimeSeriesIT.java index 9c540bb88445a..0181882515f9c 100644 --- a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterTimeSeriesIT.java +++ b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterTimeSeriesIT.java @@ -311,7 +311,11 @@ private boolean capabilitiesSupportedNewAndOld(List requiredCapabilities } private void assertResultMap(boolean includeCCSMetadata, Map result, Map expectedResult) { - MapMatcher mapMatcher = getResultMatcher(result.containsKey("is_partial"), result.containsKey("documents_found")).extraOk(); + MapMatcher mapMatcher = getResultMatcher( + result.containsKey("is_partial"), + result.containsKey("documents_found"), + result.containsKey("start_time_in_millis") + ).extraOk(); if (includeCCSMetadata) { mapMatcher = mapMatcher.entry("_clusters", any(Map.class)); } diff --git a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java index 0ad7e8b2aed39..851bbfc63b47f 100644 --- a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java +++ b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java @@ -262,7 +262,11 @@ private boolean capabilitiesSupportedNewAndOld(List requiredCapabilities } private void assertResultMap(boolean includeCCSMetadata, Map result, C columns, V values, boolean remoteOnly) { - MapMatcher mapMatcher = getResultMatcher(result.containsKey("is_partial"), result.containsKey("documents_found")).extraOk(); + MapMatcher mapMatcher = getResultMatcher( + result.containsKey("is_partial"), + result.containsKey("documents_found"), + result.containsKey("start_time_in_millis") + ).extraOk(); if (includeCCSMetadata) { mapMatcher = mapMatcher.entry("_clusters", any(Map.class)); } @@ -523,7 +527,11 @@ public void testLookupJoinAliasesSkipOld() throws IOException { var columns = List.of(Map.of("name", "c", "type", "long")); var values = List.of(List.of(localDocs.size())); - MapMatcher mapMatcher = getResultMatcher(false, result.containsKey("documents_found")).extraOk(); + MapMatcher mapMatcher = getResultMatcher( + false, + result.containsKey("documents_found"), + result.containsKey("start_time_in_millis") + ).extraOk(); mapMatcher = mapMatcher.entry("_clusters", any(Map.class)); mapMatcher = mapMatcher.entry("is_partial", true); assertMap(result, mapMatcher.entry("columns", columns).entry("values", values)); diff --git a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java index 76cc28e216a46..b74785666dae4 100644 --- a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java +++ b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java @@ -74,6 +74,7 @@ import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.emptyOrNullString; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; @@ -288,7 +289,7 @@ public static RequestObjectBuilder jsonBuilder() throws IOException { public void testGetAnswer() throws IOException { Map answer = runEsql(requestObjectBuilder().query("row a = 1, b = 2")); - assertEquals(6, answer.size()); + assertEquals(9, answer.size()); assertThat(((Integer) answer.get("took")).intValue(), greaterThanOrEqualTo(0)); Map colA = Map.of("name", "a", "type", "integer"); Map colB = Map.of("name", "b", "type", "integer"); @@ -300,6 +301,9 @@ public void testGetAnswer() throws IOException { .entry("values_loaded", 0) .entry("columns", List.of(colA, colB)) .entry("values", List.of(List.of(1, 2))) + .entry("completion_time_in_millis", greaterThan(0L)) + .entry("expiration_time_in_millis", greaterThan(0L)) + .entry("start_time_in_millis", greaterThan(0L)) ); } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponse.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponse.java index 736cb9fdaa5b2..9159d0e1b8ff8 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponse.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponse.java @@ -48,6 +48,7 @@ public class EsqlQueryResponse extends org.elasticsearch.xpack.core.esql.action. "esql_documents_found_and_values_loaded" ); private static final TransportVersion ESQL_PROFILE_INCLUDE_PLAN = TransportVersion.fromName("esql_profile_include_plan"); + private static final TransportVersion ESQL_TIMESTAMPS_INFO = TransportVersion.fromName("esql_timestamps_info"); public static final String DROP_NULL_COLUMNS_OPTION = "drop_null_columns"; @@ -63,6 +64,9 @@ public class EsqlQueryResponse extends org.elasticsearch.xpack.core.esql.action. private final boolean isAsync; private final EsqlExecutionInfo executionInfo; + private final long startTimeMillis; + private final long expirationTimeMillis; + public EsqlQueryResponse( List columns, List pages, @@ -73,6 +77,8 @@ public EsqlQueryResponse( @Nullable String asyncExecutionId, boolean isRunning, boolean isAsync, + long startTimeMillis, + long expirationTimeMillis, EsqlExecutionInfo executionInfo ) { this.columns = columns; @@ -84,6 +90,8 @@ public EsqlQueryResponse( this.asyncExecutionId = asyncExecutionId; this.isRunning = isRunning; this.isAsync = isAsync; + this.startTimeMillis = startTimeMillis; + this.expirationTimeMillis = expirationTimeMillis; this.executionInfo = executionInfo; } @@ -95,9 +103,24 @@ public EsqlQueryResponse( @Nullable Profile profile, boolean columnar, boolean isAsync, + long startTimeMillis, + long expirationTimeMillis, EsqlExecutionInfo executionInfo ) { - this(columns, pages, documentsFound, valuesLoaded, profile, columnar, null, false, isAsync, executionInfo); + this( + columns, + pages, + documentsFound, + valuesLoaded, + profile, + columnar, + null, + false, + isAsync, + startTimeMillis, + expirationTimeMillis, + executionInfo + ); } /** @@ -121,6 +144,14 @@ static EsqlQueryResponse deserialize(BlockStreamInput in) throws IOException { long valuesLoaded = supportsValuesLoaded(in.getTransportVersion()) ? in.readVLong() : 0; Profile profile = in.readOptionalWriteable(Profile::readFrom); boolean columnar = in.readBoolean(); + + long startTimeMillis = 0L; + long expirationTimeMillis = 0L; + if (in.getTransportVersion().supports(ESQL_TIMESTAMPS_INFO)) { + startTimeMillis = in.readLong(); + expirationTimeMillis = in.readLong(); + } + EsqlExecutionInfo executionInfo = in.readOptionalWriteable(EsqlExecutionInfo::new); return new EsqlQueryResponse( columns, @@ -132,6 +163,8 @@ static EsqlQueryResponse deserialize(BlockStreamInput in) throws IOException { asyncExecutionId, isRunning, isAsync, + startTimeMillis, + expirationTimeMillis, executionInfo ); } @@ -149,6 +182,12 @@ public void writeTo(StreamOutput out) throws IOException { } out.writeOptionalWriteable(profile); out.writeBoolean(columnar); + + if (out.getTransportVersion().supports(ESQL_TIMESTAMPS_INFO)) { + out.writeLong(startTimeMillis); + out.writeLong(expirationTimeMillis); + } + out.writeOptionalWriteable(executionInfo); } @@ -237,21 +276,36 @@ public Iterator toXContentChunked(ToXContent.Params params })); } if (executionInfo != null && executionInfo.overallTook() != null) { - content.add( - ChunkedToXContentHelper.chunk( - (builder, p) -> builder // - .field("took", executionInfo.overallTook().millis()) - .field(EsqlExecutionInfo.IS_PARTIAL_FIELD.getPreferredName(), executionInfo.isPartial()) - ) - ); + content.add(ChunkedToXContentHelper.chunk((builder, p) -> { + builder // + .field("took", executionInfo.overallTook().millis()) + .field(EsqlExecutionInfo.IS_PARTIAL_FIELD.getPreferredName(), executionInfo.isPartial()); + + if (startTimeMillis != 0L) { + builder.timestampFieldsFromUnixEpochMillis( + "completion_time_in_millis", + "completion_time", + startTimeMillis + executionInfo.overallTook().millis() + ); + } + + return builder; + })); } - content.add( - ChunkedToXContentHelper.chunk( - (builder, p) -> builder // - .field("documents_found", documentsFound) - .field("values_loaded", valuesLoaded) - ) - ); + content.add(ChunkedToXContentHelper.chunk((builder, p) -> { + builder // + .field("documents_found", documentsFound) + .field("values_loaded", valuesLoaded); + + if (startTimeMillis != 0L) { + builder.timestampFieldsFromUnixEpochMillis("start_time_in_millis", "start_time", startTimeMillis); + } + if (expirationTimeMillis != 0L) { + builder.timestampFieldsFromUnixEpochMillis("expiration_time_in_millis", "expiration_time", expirationTimeMillis); + } + + return builder; + })); if (dropNullColumns) { content.add(ResponseXContentUtils.allColumns(columns, "all_columns")); content.add(ResponseXContentUtils.nonNullColumns(columns, nullColumns, "columns")); diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryTask.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryTask.java index 4d7565a5d7863..e759633c69df5 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryTask.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryTask.java @@ -45,6 +45,19 @@ public EsqlExecutionInfo executionInfo() { @Override public EsqlQueryResponse getCurrentResult() { // TODO it'd be nice to have the number of documents we've read from completed drivers here - return new EsqlQueryResponse(List.of(), List.of(), 0, 0, null, false, getExecutionId().getEncoded(), true, true, executionInfo); + return new EsqlQueryResponse( + List.of(), + List.of(), + 0, + 0, + null, + false, + getExecutionId().getEncoded(), + true, + true, + getStartTime(), + getExpirationTimeMillis(), + executionInfo + ); } } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlQueryAction.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlQueryAction.java index f4579358e46ba..a4bbae51b6340 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlQueryAction.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlQueryAction.java @@ -403,6 +403,8 @@ private EsqlQueryResponse toResponse(Task task, EsqlQueryRequest request, boolea asyncExecutionId, false, request.async(), + task.getStartTime(), + ((EsqlQueryTask) task).getExpirationTimeMillis(), result.executionInfo() ); } @@ -414,6 +416,8 @@ private EsqlQueryResponse toResponse(Task task, EsqlQueryRequest request, boolea profile, request.columnar(), request.async(), + task.getStartTime(), + threadPool.absoluteTimeInMillis() + request.keepAlive().millis(), result.executionInfo() ); } @@ -479,6 +483,8 @@ public EsqlQueryResponse initialResponse(EsqlQueryTask task) { asyncExecutionId, true, // is_running true, // isAsync + task.getStartTime(), + task.getExpirationTimeMillis(), task.executionInfo() ); } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponseTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponseTests.java index edac6b1c5b3eb..205424f780ef2 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponseTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponseTests.java @@ -139,6 +139,8 @@ EsqlQueryResponse randomResponseAsync(boolean columnar, EsqlQueryResponse.Profil List values = randomList(noPages, noPages, () -> randomPage(columns)); String id = null; boolean isRunning = false; + long startTimeMillis = 0L; + long expirationTimeMillis = 0L; if (async) { id = randomAlphaOfLengthBetween(1, 16); isRunning = randomBoolean(); @@ -153,6 +155,8 @@ EsqlQueryResponse randomResponseAsync(boolean columnar, EsqlQueryResponse.Profil id, isRunning, async, + startTimeMillis, + expirationTimeMillis, createExecutionInfo() ); } @@ -355,7 +359,7 @@ protected EsqlQueryResponse mutateInstance(EsqlQueryResponse instance) { } default -> throw new IllegalArgumentException(); } - return new EsqlQueryResponse(columns, pages, documentsFound, valuesLoaded, profile, columnar, isAsync, executionInfo); + return new EsqlQueryResponse(columns, pages, documentsFound, valuesLoaded, profile, columnar, isAsync, 0L, 0L, executionInfo); } private List deepCopyOfPages(EsqlQueryResponse response) { @@ -440,6 +444,8 @@ public ResponseBuilder( asyncExecutionId, isRunning != null, isAsync(asyncExecutionId, isRunning), + 0L, + 0L, executionInfo ); } @@ -792,6 +798,8 @@ public void testBasicXContentIdAndRunning() { "id-123", true, true, + 0L, + 0L, null ) ) { @@ -831,6 +839,8 @@ public void testXContentOriginalTypes() { null, false, false, + 0L, + 0L, null ) ) { @@ -872,6 +882,8 @@ public void testNullColumnsXContentDropNulls() { null, false, false, + 0L, + 0L, null ) ) { @@ -934,6 +946,8 @@ public void testNullColumnsFromBuilderXContentDropNulls() { null, false, false, + 0L, + 0L, null ) ) { @@ -991,6 +1005,8 @@ private EsqlQueryResponse simple(boolean columnar, boolean async) { null, columnar, async, + 0L, + 0L, null ); } @@ -1021,6 +1037,8 @@ public void testProfileXContent() { ), false, false, + 0L, + 0L, null ); ) { @@ -1099,7 +1117,7 @@ public void testColumns() { var longBlk2 = blockFactory.newLongArrayVector(new long[] { 300L, 400L, 500L }, 3).asBlock(); var columnInfo = List.of(new ColumnInfoImpl("foo", "integer", null), new ColumnInfoImpl("bar", "long", null)); var pages = List.of(new Page(intBlk1, longBlk1), new Page(intBlk2, longBlk2)); - try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, null)) { + try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, 0L, 0L, null)) { assertThat(columnValues(response.column(0)), contains(10, 20, 30, 40, 50)); assertThat(columnValues(response.column(1)), contains(100L, 200L, 300L, 400L, 500L)); expectThrows(IllegalArgumentException.class, () -> response.column(-1)); @@ -1111,7 +1129,7 @@ public void testColumnsIllegalArg() { var intBlk1 = blockFactory.newIntArrayVector(new int[] { 10 }, 1).asBlock(); var columnInfo = List.of(new ColumnInfoImpl("foo", "integer", null)); var pages = List.of(new Page(intBlk1)); - try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, null)) { + try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, 0L, 0L, null)) { expectThrows(IllegalArgumentException.class, () -> response.column(-1)); expectThrows(IllegalArgumentException.class, () -> response.column(1)); } @@ -1130,7 +1148,7 @@ public void testColumnsWithNull() { } var columnInfo = List.of(new ColumnInfoImpl("foo", "integer", null)); var pages = List.of(new Page(blk1), new Page(blk2), new Page(blk3)); - try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, null)) { + try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, 0L, 0L, null)) { assertThat(columnValues(response.column(0)), contains(10, null, 30, null, null, 60, null, 80, 90, null)); expectThrows(IllegalArgumentException.class, () -> response.column(-1)); expectThrows(IllegalArgumentException.class, () -> response.column(2)); @@ -1150,7 +1168,7 @@ public void testColumnsWithMultiValue() { } var columnInfo = List.of(new ColumnInfoImpl("foo", "integer", null)); var pages = List.of(new Page(blk1), new Page(blk2), new Page(blk3)); - try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, null)) { + try (var response = new EsqlQueryResponse(columnInfo, pages, 0, 0, null, false, null, false, false, 0L, 0L, null)) { assertThat(columnValues(response.column(0)), contains(List.of(10, 20), null, List.of(40, 50), null, 70, 80, null)); expectThrows(IllegalArgumentException.class, () -> response.column(-1)); expectThrows(IllegalArgumentException.class, () -> response.column(2)); @@ -1163,7 +1181,7 @@ public void testRowValues() { List columns = randomList(numColumns, numColumns, this::randomColumnInfo); int noPages = randomIntBetween(1, 20); List pages = randomList(noPages, noPages, () -> randomPage(columns)); - try (var resp = new EsqlQueryResponse(columns, pages, 0, 0, null, false, "", false, false, null)) { + try (var resp = new EsqlQueryResponse(columns, pages, 0, 0, null, false, "", false, false, 0L, 0L, null)) { var rowValues = getValuesList(resp.rows()); var valValues = getValuesList(resp.values()); for (int i = 0; i < rowValues.size(); i++) { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatTests.java index 2f11d4ae2fc1a..db6946f5fe1e8 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatTests.java @@ -246,7 +246,9 @@ public void testPlainTextEmptyCursorWithColumns() { public void testPlainTextEmptyCursorWithoutColumns() { assertEquals( StringUtils.EMPTY, - getTextBodyContent(PLAIN_TEXT.format(req(), new EsqlQueryResponse(emptyList(), emptyList(), 0, 0, null, false, false, null))) + getTextBodyContent( + PLAIN_TEXT.format(req(), new EsqlQueryResponse(emptyList(), emptyList(), 0, 0, null, false, false, 0L, 0L, null)) + ) ); } @@ -277,6 +279,8 @@ private static EsqlQueryResponse emptyData() { null, false, false, + 0L, + 0L, null ); } @@ -312,7 +316,7 @@ private static EsqlQueryResponse regularData() { ) ); - return new EsqlQueryResponse(headers, values, 0, 0, null, false, false, null); + return new EsqlQueryResponse(headers, values, 0, 0, null, false, false, 0L, 0L, null); } private static EsqlQueryResponse escapedData() { @@ -336,7 +340,7 @@ private static EsqlQueryResponse escapedData() { ) ); - return new EsqlQueryResponse(headers, values, 0, 0, null, false, false, null); + return new EsqlQueryResponse(headers, values, 0, 0, null, false, false, 0L, 0L, null); } private static RestRequest req() { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatterTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatterTests.java index 91456c4f44893..fc37e9dee02e5 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatterTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/formatter/TextFormatterTests.java @@ -84,6 +84,8 @@ public class TextFormatterTests extends ESTestCase { null, randomBoolean(), randomBoolean(), + 0L, + 0L, new EsqlExecutionInfo(randomBoolean()) ); @@ -188,6 +190,8 @@ public void testFormatWithoutHeader() { null, randomBoolean(), randomBoolean(), + 0L, + 0L, new EsqlExecutionInfo(randomBoolean()) ); @@ -231,6 +235,8 @@ public void testVeryLongPadding() { null, randomBoolean(), randomBoolean(), + 0L, + 0L, new EsqlExecutionInfo(randomBoolean()) ), false,