-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for query profiler with concurrent aggregation
Signed-off-by: Ticheng Lin <[email protected]>
- Loading branch information
1 parent
d352f2c
commit 777a7bb
Showing
3 changed files
with
190 additions
and
4 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
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
142 changes: 142 additions & 0 deletions
142
...c/test/java/org/opensearch/search/profile/query/ConcurrentQueryProfileBreakdownTests.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,142 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.search.profile.query; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ConcurrentQueryProfileBreakdownTests extends OpenSearchTestCase { | ||
|
||
public void testBuildQueryProfileBreakdownMap() { | ||
Map<String, Long> testMap = new HashMap<>(); | ||
testMap.put("set_min_competitive_score_count", 0L); | ||
testMap.put("match_count", 0L); | ||
testMap.put("score_start_time", 0L); | ||
testMap.put("shallow_advance_count", 0L); | ||
testMap.put("create_weight_start_time", 1598347679188617L); | ||
testMap.put("next_doc", 0L); | ||
testMap.put("compute_max_score_start_time", 0L); | ||
testMap.put("shallow_advance_min_start_time", 0L); | ||
testMap.put("score_count", 5L); | ||
testMap.put("compute_max_score_count", 0L); | ||
testMap.put("advance_start_time", 0L); | ||
testMap.put("advance", 0L); | ||
testMap.put("advance_count", 3L); | ||
testMap.put("compute_max_score_min_start_time", 0L); | ||
testMap.put("score", 0L); | ||
testMap.put("next_doc_max_end_time", 1598347688298671L); | ||
testMap.put("advance_max_end_time", 1598347688280739L); | ||
testMap.put("next_doc_start_time", 0L); | ||
testMap.put("shallow_advance", 0L); | ||
testMap.put("build_scorer_max_end_time", 1598347688270123L); | ||
testMap.put("create_weight_count", 1L); | ||
testMap.put("create_weight_max_end_time", 1598347679558960L); | ||
testMap.put("match_min_start_time", 0L); | ||
testMap.put("build_scorer", 0L); | ||
testMap.put("compute_max_score_max_end_time", 0L); | ||
testMap.put("next_doc_min_start_time", 1598347688110288L); | ||
testMap.put("set_min_competitive_score", 0L); | ||
testMap.put("set_min_competitive_score_start_time", 0L); | ||
testMap.put("match", 0L); | ||
testMap.put("set_min_competitive_score_max_end_time", 0L); | ||
testMap.put("match_start_time", 0L); | ||
testMap.put("shallow_advance_max_end_time", 0L); | ||
testMap.put("build_scorer_start_time", 0L); | ||
testMap.put("next_doc_count", 5L); | ||
testMap.put("shallow_advance_start_time", 0L); | ||
testMap.put("set_min_competitive_score_min_start_time", 0L); | ||
testMap.put("compute_max_score", 0L); | ||
testMap.put("create_weight_min_start_time", 1598347679188617L); | ||
testMap.put("build_scorer_count", 6L); | ||
testMap.put("create_weight", 370343L); | ||
testMap.put("score_min_start_time", 1598347688018500L); | ||
testMap.put("match_max_end_time", 0L); | ||
testMap.put("advance_min_start_time", 1598347687991984L); | ||
testMap.put("score_max_end_time", 1598347688282743L); | ||
testMap.put("build_scorer_min_start_time", 1598347686448701L); | ||
Map<String, Long> breakdownMap = ConcurrentQueryProfileBreakdown.buildQueryProfileBreakdownMap(testMap); | ||
assertEquals(18, breakdownMap.size()); | ||
assertEquals( | ||
"{set_min_competitive_score_count=0, match_count=0, shallow_advance_count=0, set_min_competitive_score=0, next_doc=188383, match=0, next_doc_count=5, score_count=5, compute_max_score_count=0, compute_max_score=0, advance=288755, advance_count=3, score=264243, build_scorer_count=6, create_weight=370343, shallow_advance=0, create_weight_count=1, build_scorer=1821422}", | ||
breakdownMap.toString() | ||
); | ||
} | ||
|
||
public void testAddMaxEndTimeAndMinStartTime() { | ||
Map<String, Long> map = new HashMap<>(); | ||
map.put("set_min_competitive_score_count", 0L); | ||
map.put("match_count", 0L); | ||
map.put("score_start_time", 0L); | ||
map.put("shallow_advance_count", 0L); | ||
map.put("create_weight_start_time", 1629732014278990L); | ||
map.put("next_doc", 0L); | ||
map.put("compute_max_score_start_time", 0L); | ||
map.put("score_count", 2L); | ||
map.put("compute_max_score_count", 0L); | ||
map.put("advance_start_time", 0L); | ||
map.put("advance", 0L); | ||
map.put("advance_count", 1L); | ||
map.put("score", 0L); | ||
map.put("next_doc_start_time", 0L); | ||
map.put("shallow_advance", 0L); | ||
map.put("create_weight_count", 1L); | ||
map.put("build_scorer", 0L); | ||
map.put("set_min_competitive_score", 0L); | ||
map.put("set_min_competitive_score_start_time", 0L); | ||
map.put("match", 0L); | ||
map.put("match_start_time", 0L); | ||
map.put("build_scorer_start_time", 0L); | ||
map.put("next_doc_count", 2L); | ||
map.put("shallow_advance_start_time", 0L); | ||
map.put("compute_max_score", 0L); | ||
map.put("build_scorer_count", 2L); | ||
map.put("create_weight", 201692L); | ||
Map<String, Long> breakdown = new HashMap<>(); | ||
breakdown.put("set_min_competitive_score_count", 0L); | ||
breakdown.put("match_count", 0L); | ||
breakdown.put("score_start_time", 1629732030778977L); | ||
breakdown.put("shallow_advance_count", 0L); | ||
breakdown.put("create_weight_start_time", 0L); | ||
breakdown.put("next_doc", 1150L); | ||
breakdown.put("compute_max_score_start_time", 0L); | ||
breakdown.put("score_count", 2L); | ||
breakdown.put("compute_max_score_count", 0L); | ||
breakdown.put("advance_start_time", 1629732030776129L); | ||
breakdown.put("advance", 920L); | ||
breakdown.put("advance_count", 1L); | ||
breakdown.put("score", 1050L); | ||
breakdown.put("next_doc_start_time", 1629732030806446L); | ||
breakdown.put("shallow_advance", 0L); | ||
breakdown.put("create_weight_count", 0L); | ||
breakdown.put("build_scorer", 9649L); | ||
breakdown.put("set_min_competitive_score", 0L); | ||
breakdown.put("set_min_competitive_score_start_time", 0L); | ||
breakdown.put("match", 0L); | ||
breakdown.put("match_start_time", 0L); | ||
breakdown.put("build_scorer_start_time", 1629732030749745L); | ||
breakdown.put("next_doc_count", 2L); | ||
breakdown.put("shallow_advance_start_time", 0L); | ||
breakdown.put("compute_max_score", 0L); | ||
breakdown.put("build_scorer_count", 2L); | ||
breakdown.put("create_weight", 0L); | ||
ConcurrentQueryProfileBreakdown.addMaxEndTimeAndMinStartTime(map, breakdown); | ||
assertEquals(45, map.size()); | ||
assertEquals( | ||
"{set_min_competitive_score_count=0, match_count=0, score_start_time=0, shallow_advance_count=0, create_weight_start_time=1629732014278990, next_doc=0, compute_max_score_start_time=0, shallow_advance_min_start_time=0, score_count=2, compute_max_score_count=0, advance_start_time=0, advance=0, advance_count=1, compute_max_score_min_start_time=0, score=0, next_doc_max_end_time=1629732030807596, advance_max_end_time=1629732030777049, next_doc_start_time=0, shallow_advance=0, build_scorer_max_end_time=1629732030759394, create_weight_count=1, create_weight_max_end_time=1629732014480682, match_min_start_time=0, build_scorer=0, compute_max_score_max_end_time=0, next_doc_min_start_time=1629732030806446, set_min_competitive_score=0, set_min_competitive_score_start_time=0, match=0, set_min_competitive_score_max_end_time=0, match_start_time=0, shallow_advance_max_end_time=0, build_scorer_start_time=0, next_doc_count=2, shallow_advance_start_time=0, set_min_competitive_score_min_start_time=0, compute_max_score=0, create_weight_min_start_time=1629732014278990, build_scorer_count=2, create_weight=201692, score_min_start_time=1629732030778977, match_max_end_time=0, advance_min_start_time=1629732030776129, score_max_end_time=1629732030780027, build_scorer_min_start_time=1629732030749745}", | ||
map.toString() | ||
); | ||
} | ||
} |