mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 08:09:22 +00:00
### **User description** - #8080 - #8098 ___ ### **PR Type** Bug fix, Enhancement ___ ### **Description** - Fix stream selection for CTE queries - Add robust stream extraction utility - Make query updates async-aware - Adjust watchers to trigger reliably ___ ### Diagram Walkthrough ```mermaid flowchart LR SQL["SQL query (incl. CTE)"] -- parse --> Extract["getStreamNameFromQuery()"] Extract -- returns stream --> Panel["useDashboardPanel: updateQueryValue()"] Panel -- set --> StreamField["currentQuery.fields.stream"] Watcher["Vue watch hooks"] -- trigger on changes --> Panel ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>FieldList.vue</strong><dd><code>Stabilize watcher for stream type changes</code> </dd></summary> <hr> web/src/components/dashboards/addPanel/FieldList.vue <ul><li>Change watcher source to array form.<br> <li> Ensure stream list reloads on type changes.</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/8116/files#diff-a071c06e3e26629cb4ae4751450acc39c61fa49b07a1cc4be3711697829668d4">+5/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>sqlUtils.ts</strong><dd><code>Add robust stream extractor for SQL/CTE queries</code> </dd></summary> <hr> web/src/utils/query/sqlUtils.ts <ul><li>Add <code>getStreamNameFromQuery</code> to parse SQL/CTE.<br> <li> Safeguard recursion and circular refs with WeakSet.<br> <li> Handle FROM, WHERE, SELECT subqueries.<br> <li> Gracefully handle parser errors.</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/8116/files#diff-dde40e8fcb5c37b06c011ede08922c44a3c025682fbc341aee97ba046b73a0e3">+76/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>useDashboardPanel.ts</strong><dd><code>Async query parsing and CTE-aware stream resolution</code> </dd></summary> <hr> web/src/composables/useDashboardPanel.ts <ul><li>Import <code>getStreamNameFromQuery</code>.<br> <li> Make <code>updateQueryValue</code> async and await in watcher.<br> <li> Use stream name from parser for selection, including CTE.<br> <li> Remove redundant parsing branch; minor bug introduced in logs flag.</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/8116/files#diff-fbba1700750053b9eaf38ddd30dab84531bc44131c795ebb713811e4930cd7cb">+15/-23</a> </td> </tr> </table></td></tr></tr></tbody></table> </details> ___