Skip to content

feat: compile structured semantic queries for DuckDB - #1137

Closed
yvonneyx wants to merge 2 commits into
aifrom
codex/lovsem-query
Closed

yvonneyx wants to merge 2 commits into
aifrom
codex/lovsem-query

Conversation

@yvonneyx

@yvonneyx yvonneyx commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add compileSemanticQuery(model, query) in src/duckdb/compiler.ts. It translates dimensions, dataset metrics, filters, sorting, and limits into DuckDB SQL using AVA's SQL quoting utilities.
  • Aggregate each fact dataset separately along declared many-to-one paths and join the grouped results. This preserves order totals when one order has multiple refunds.
  • Callers execute the returned SQL through the existing ava.query(sql) API.

The first version covers dataset-level measures. Model-scoped expressions such as AGG(dataset.metric) return a compile error.

Verification

  • Build and lint passed. The targeted regression run passed 168 tests.
  • The compiler suite passed with a live GLM-5.1 tool call. The model produced the structured query and AVA executed the compiled SQL.
  • The eight-order Qingbei Coffee example returned the expected channel breakdown and April totals of 5,500 in paid GMV and 500 in completed refunds.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ Preview is ready!

PR preview ✅ Ready ✅ Ready
🔗 Preview https://antvis-AVA-preview-pr-1137.surge.sh
📝 Commit49afcfb
⏱️ Build time0.011s
📦 Size33.5 MB (-34.4 KB ⬇️) · 498 files
🪵 LogsView logs
📱 MobileScan to open preview on mobile

↩️ Previous: ⚡️ 49afcfb · antvis-AVA-preview-pr-1137.surge.sh (open ↗) · 2026-11-30 14:17:01 UTC

🤖 Powered by surge-preview

@yvonneyx yvonneyx changed the title feat: execute structured semantic queries with LovSem feat: compile structured semantic queries for DuckDB Nov 30, 2026
@yvonneyx yvonneyx closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant