Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -74,10 +74,12 @@ public static EsqlMetadata readHeader(JsonParser parser, JsonpMapper mapper) {
}

/**
* Checks the footer of an ES|QL response, once the values have been read.
* Reads the footer of an ES|QL response, once the values have been read.
*/
public static void readFooter(JsonParser parser) {
JsonpUtils.expectNextEvent(parser, JsonParser.Event.END_OBJECT);
// Ignore everything until we reach the end of the response's top-level object
while (parser.next() != JsonParser.Event.END_OBJECT) {
JsonpUtils.skipValue(parser);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,41 @@ public void testMissingColumns() throws IOException {
assertTrue(jsonMappingException.getMessage().contains("Expecting a 'columns' property"));
}

@Test
public void testProfilingInfo() throws IOException {
String badJson = """
{
"took": 10,
"columns": [
{"name": "avg_salary", "type": "double"},
{"name": "lang", "type": "keyword"}
],
"values": [
[43760.0, "Spanish"],
[48644.0, "French"],
[48832.0, "German"]
],
"profile": {
"query": {
"start_millis": 1760459492830,
"stop_millis": 1760459492853,
"took_millis": 23,
"took_nanos": 23290250
}
}
}
""";

ElasticsearchClient esClient = new MockHttpClient()
.add("/_query", "application/json", badJson)
.client(new JacksonJsonpMapper());

esClient.esql().query(
new ObjectsEsqlAdapter<>(Data.class),
"FROM employees | STATS avg_salary = AVG(salary) by country"
);
}

@Test
public void testObjectDeserializer() throws IOException {

Expand Down