-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add status for enrich operator (#106036)
This PR adds a status for the enrich operator. This status should help us answer how fast the enrich operator is.
- Loading branch information
Showing
10 changed files
with
395 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 106036 | ||
summary: Add status for enrich operator | ||
area: ES|QL | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...ql/compute/src/test/java/org/elasticsearch/compute/operator/AsyncOperatorStatusTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.compute.operator; | ||
|
||
import org.elasticsearch.common.Strings; | ||
import org.elasticsearch.common.io.stream.Writeable; | ||
import org.elasticsearch.core.TimeValue; | ||
import org.elasticsearch.test.AbstractWireSerializingTestCase; | ||
import org.elasticsearch.test.ESTestCase; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class AsyncOperatorStatusTests extends AbstractWireSerializingTestCase<AsyncOperator.Status> { | ||
@Override | ||
protected Writeable.Reader<AsyncOperator.Status> instanceReader() { | ||
return AsyncOperator.Status::new; | ||
} | ||
|
||
@Override | ||
protected AsyncOperator.Status createTestInstance() { | ||
return new AsyncOperator.Status( | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomLongBetween(1, TimeValue.timeValueHours(1).millis()) | ||
); | ||
} | ||
|
||
@Override | ||
protected AsyncOperator.Status mutateInstance(AsyncOperator.Status in) throws IOException { | ||
int field = randomIntBetween(0, 2); | ||
return switch (field) { | ||
case 0 -> new AsyncOperator.Status( | ||
randomValueOtherThan(in.receivedPages(), ESTestCase::randomNonNegativeLong), | ||
in.completedPages(), | ||
in.totalTimeInMillis() | ||
); | ||
case 1 -> new AsyncOperator.Status( | ||
in.receivedPages(), | ||
randomValueOtherThan(in.completedPages(), ESTestCase::randomNonNegativeLong), | ||
in.totalTimeInMillis() | ||
); | ||
case 2 -> new AsyncOperator.Status( | ||
in.receivedPages(), | ||
in.completedPages(), | ||
randomValueOtherThan(in.totalTimeInMillis(), ESTestCase::randomNonNegativeLong) | ||
); | ||
default -> throw new AssertionError("unknown "); | ||
}; | ||
} | ||
|
||
public void testToXContent() { | ||
var status = new AsyncOperator.Status(100, 50, TimeValue.timeValueSeconds(10).millis()); | ||
String json = Strings.toString(status, true, true); | ||
assertThat(json, equalTo(""" | ||
{ | ||
"received_pages" : 100, | ||
"completed_pages" : 50, | ||
"total_time_in_millis" : 10000, | ||
"total_time" : "10s" | ||
}""")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.