Skip to content

Conversation

LDrago27
Copy link
Collaborator

@LDrago27 LDrago27 commented Sep 29, 2025

Description

The PPL grammar defines searchCommand as follows

searchCommand
   : (SEARCH)? (searchExpression)* fromClause? (searchExpression)*     # searchFrom

However when we write a query

`attributes.EnvName` = "Production" SOURCE = logs-otel-v1* 

It gives no result.

The issue lies with us appending source = at the beginning of the query.

Query Being sent:

"source = logs-otel-v1* `attributes.EnvName` = \"Production\" SOURCE = logs-otel-v1* | WHERE `time` >= '2024-06-23 17:39:57.609' AND `time` <= '2025-09-23 17:39:57.609'"

This treats the second SOURCE as a column name creating failures.

This PR fixes the Source Command detection Logic, expanding the logic to check the first | and check if it contains source = or not.

Issues Resolved

Screenshot

Testing the changes

Before:
https://github.com/user-attachments/assets/0be09f44-b271-4d3b-ba50-32261c2bde80

After:
https://github.com/user-attachments/assets/ccc9ed0a-9467-4be3-958d-81fc65afcb50

Changelog

  • fix: Source command detection if we have a field expression before source

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
Copy link

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.25%. Comparing base (dd1f5ae) to head (c874382).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10598      +/-   ##
==========================================
+ Coverage   60.19%   60.25%   +0.05%     
==========================================
  Files        4300     4385      +85     
  Lines      115053   116753    +1700     
  Branches    18680    19010     +330     
==========================================
+ Hits        69259    70346    +1087     
- Misses      41049    41568     +519     
- Partials     4745     4839      +94     
Flag Coverage Δ
Linux_1 26.66% <ø> (+<0.01%) ⬆️
Linux_2 38.83% <ø> (+<0.01%) ⬆️
Linux_3 38.42% <ø> (?)
Linux_4 32.60% <100.00%> (+<0.01%) ⬆️
Windows_1 26.67% <ø> (+<0.01%) ⬆️
Windows_2 38.80% <ø> (+<0.01%) ⬆️
Windows_3 38.42% <ø> (+0.60%) ⬆️
Windows_4 32.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@angle943 angle943 added the OSD Changes being merged by the OSD team label Sep 30, 2025
@LDrago27 LDrago27 merged commit 6f74d7f into opensearch-project:main Sep 30, 2025
133 of 137 checks passed
yanatha99 pushed a commit to yanatha99/OpenSearch-Dashboards that referenced this pull request Oct 2, 2025
…rce (opensearch-project#10598)

* Fix source command detection if we have a field expression before source

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>

* Changeset file for PR opensearch-project#10598 created/updated

---------

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Signed-off-by: Nathan Yang <yanatha@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor OSD Changes being merged by the OSD team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants