Repository navigation
feat: show generated SQL in the SQL query filter preview - #3823
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 1a2e248 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
After Preview values, the SQL query filter editor shows the filter's SQL with variables and macros filled in, in a collapsed Generated SQL section like the raw SQL tile's. It's built by the same helpers the values query uses, and shows even when the query fails. - renderSqlQueryFilterValuesQuery also returns expandedSql, without the values wrapper - Move useSqlQueryFilterValues' per-filter setup and $__filters step into helpers shared with the new useSqlQueryFilterGeneratedSql - QueryPreviewAccordion takes an optional variant
afad5c0 to
191195c
Compare
E2E Test Results✅ All tests passed • 474 passed • 1 skipped • 1115s
Tests ran across 4 shards in parallel. |
PR Review
1 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 0 P3 None could be anchored to changed lines; they are listed below. Findings outside the changed lines
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep ReviewMulti-agent review of the SQL query filter "Generated SQL" preview. Scope: ✅ No critical issues found. The 🟡 P2 — recommended
🔵 P3 nitpicks (1)
Reviewers (12): correctness, adversarial, security, testing, maintainability, project-standards, api-contract, kieran-typescript, julik-frontend-races, previous-comments, agent-native, learnings-researcher. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
Summary
Shows the SQL a SQL query filter runs, with its variables and macros filled in, below Preview values in the filter editor. This matches the raw SQL tile's Generated SQL, so users can see what
$svc,$__filter(...),$__timeFilter(...),$__sourceTableand$__filtersturned into.renderSqlQueryFilterValuesQueryalso returnsexpandedSql: the filter's SQL after expansion, without theSELECT DISTINCT … LIMITwrapper the values query adds.useSqlQueryFilterValuesmoves its per-filter setup and its$__filtersstep into helpers, with no behavior change. The newuseSqlQueryFilterGeneratedSqluses the same helpers, so the SQL shown is built by the code that runs the values query. It sends nothing to ClickHouse.QueryPreviewAccordiontakes an optionalvariant. The filter editor passesnoPadding, so the section lines up with the other form fields.Screenshots or video
How to reproduce
Starting point:
yarn app:dev:localconnected to the demo server (onboarding → "Connect to Demo Server"), or the Vercel preview.On
main:Servicewith optionsfrontendandcheckout, and variable namesvc. Save it.Severityon connection Demo and source Logs, with:$svcexpanded to.On this branch:
$__sourceTableand timestamps in place of$__timeFilter.$__filter(ServiceName, $svc)shows as(1=1 /** no values selected for variable 'svc' */).frontendin Service.(ServiceName IN ('frontend')), and the values narrow to match.References