-
Notifications
You must be signed in to change notification settings - Fork 202
feat(ppl): wire patterns command for analytics-engine dashboard route #5467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ahkcs
merged 15 commits into
opensearch-project:main
from
ahkcs:feat/ppl-patterns-analytics-engine
May 27, 2026
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3cb7845
feat(api): add PATTERN_* settings defaults to UnifiedQueryContext
ahkcs ced491b
feat(core): emit 4-arg regexp_replace with 'g' flag for SIMPLE patterns
ahkcs ee8b6ab
test(integ-test): add CalcitePPLDashboardPatternsIT pinning BRAIN-lab…
ahkcs e9ad4e5
style: apply spotless formatting
ahkcs 90fe3b9
test(integ-test): update SIMPLE-patterns explain YAML for 4-arg regex…
ahkcs 467195e
fix(opensearch): collapse 4-arg REGEXP_REPLACE_PG_4 'g' to 3-arg at s…
ahkcs cb117fb
fix(opensearch): revert arity-aware toOp; restore spath/JSON_EXTRACT …
ahkcs 9938e73
style: trim verbose comments per review
ahkcs 6e7b676
test(integ-test): add verifyDataRows to dashboard patterns IT
ahkcs ab79941
refactor(core): fuse PATTERNS if-else in buildParseRelNode
ahkcs b35aa03
test(integ-test): include CalcitePPLDashboardPatternsIT in CalciteNoP…
ahkcs 628d660
test(integ-test): regenerate agg-push explain YAML for 3-arg REGEXP_R…
ahkcs 31f248a
revert(core): drop SQL-side 'g' flag for patterns; move to DataFusion…
ahkcs b830582
test(api): pin UnifiedQueryContext PATTERN_* defaults via planner test
ahkcs 42799d4
style: spotlessApply
ahkcs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
74 changes: 74 additions & 0 deletions
74
...g-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLDashboardPatternsIT.java
This file contains hidden or 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,74 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.calcite.remote; | ||
|
|
||
| import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_HDFS_LOGS; | ||
| import static org.opensearch.sql.util.MatcherUtils.rows; | ||
| import static org.opensearch.sql.util.MatcherUtils.schema; | ||
| import static org.opensearch.sql.util.MatcherUtils.verifyDataRows; | ||
| import static org.opensearch.sql.util.MatcherUtils.verifySchemaInOrder; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import java.io.IOException; | ||
| import org.json.JSONObject; | ||
| import org.junit.Test; | ||
| import org.opensearch.sql.ppl.PPLIntegTestCase; | ||
|
|
||
| /** Pins the BRAIN-label pattern panel query shape used by OpenSearch Dashboards. */ | ||
| public class CalcitePPLDashboardPatternsIT extends PPLIntegTestCase { | ||
| @Override | ||
| public void init() throws Exception { | ||
| super.init(); | ||
| enableCalcite(); | ||
| loadIndex(Index.HDFS_LOGS); | ||
| } | ||
|
|
||
| @Test | ||
| public void testDashboardBrainLabelStatsByPatternsField() throws IOException { | ||
| JSONObject result = | ||
| executeQuery( | ||
| String.format( | ||
| "source=%s" | ||
| + " | patterns content method=BRAIN mode=label" | ||
| + " max_sample_count=5 variable_count_threshold=5" | ||
| + " frequency_threshold_percentage=0.2" | ||
| + " | stats count() as pattern_count, take(content, 1) as sample_logs" | ||
| + " by patterns_field" | ||
| + " | sort - pattern_count" | ||
| + " | fields patterns_field, pattern_count, sample_logs", | ||
| TEST_INDEX_HDFS_LOGS)); | ||
| verifySchemaInOrder( | ||
|
dai-chen marked this conversation as resolved.
|
||
| result, | ||
| schema("patterns_field", "string"), | ||
| schema("pattern_count", "bigint"), | ||
| schema("sample_logs", "array")); | ||
| verifyDataRows( | ||
| result, | ||
| rows( | ||
| "BLOCK* NameSystem.addStoredBlock: blockMap updated: <*IP*> is added to blk_<*> size" | ||
| + " <*>", | ||
| 2, | ||
| ImmutableList.of( | ||
| "BLOCK* NameSystem.addStoredBlock: blockMap updated: 10.251.31.85:50010 is added" | ||
| + " to blk_-7017553867379051457 size 67108864")), | ||
| rows( | ||
| "PacketResponder failed <*> blk_<*>", | ||
| 2, | ||
| ImmutableList.of("PacketResponder failed for blk_6996194389878584395")), | ||
| rows( | ||
| "Verification succeeded <*> blk_<*>", | ||
| 2, | ||
| ImmutableList.of("Verification succeeded for blk_-1547954353065580372")), | ||
| rows( | ||
| "<*> NameSystem.allocateBlock:" | ||
| + " /user/root/sortrand/_temporary/_task_<*>_<*>_r_<*>_<*>/part<*> blk_<*>", | ||
| 2, | ||
| ImmutableList.of( | ||
| "BLOCK* NameSystem.allocateBlock:" | ||
| + " /user/root/sortrand/_temporary/_task_200811092030_0002_r_000296_0/part-00296." | ||
| + " blk_-6620182933895093708"))); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.