Skip to content

fix(vquery): unify SQL dialects and make IndexedDB opt-in - #559

Merged
youngwinds merged 3 commits into
mainfrom
codex/vquery-sql-dialects
Oct 14, 2026
Merged

youngwinds merged 3 commits into
mainfrom
codex/vquery-sql-dialects

Conversation

@youngwinds

@youngwinds youngwinds commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

💡 Background and solution

Expose reusable, parameterized DSL compilation through compileQuery(dsl, { table, columns, dialect }), defaulting to MySQL. MySQL and DuckDB strategies own their SQL differences; dataset queries explicitly keep using DuckDB.

  • Replace convertDSLToSQL with convertDSLToMysql and convertDSLToDuckDB; export the compiler and option/result types from both entrypoints.
  • Align aggregation, date buckets, string comparisons/LIKE, NULL ordering, median and discrete quantiles. MySQL computes median/quantile with window expressions, including grouped and HAVING-only statistics.
  • Maintain one supermarket-schema JSON catalog containing 394 DSL cases and one snapshot suite covering both dialects. Update the existing example generator, regression tests and test workflow docs without database test infrastructure.
  • Default Node and browser storage to independent in-memory adapters through separate Node and browser strategy entrypoints. Export VQueryOptions; new VQuery({ enableIndexedDB: true }) explicitly selects IndexedDB persistence. Queries continue to run in memory.
  • Add a changeset declaring @visactor/vquery: patch.

Callers of the removed convertDSLToSQL helper should select the explicit dialect helper, or use compileQuery for { sql, parameters } output.

🧪 Validation

  • pnpm --filter @visactor/vquery run g: generated output reviewed; no new SQL snapshot differences.
  • pnpm --filter @visactor/vquery run test:coverage: 595 tests passed; statements, branches, functions and lines all 100%.
  • Fresh unit-only coverage before/after the storage change: 144 → 154 tests passed; all four metrics remain 100% → 100%. Both use Istanbul, src/** and the existing thresholds. Both independent strategy constructors are fully covered; neither runtime entrypoint is excluded from coverage.
  • Root lint:check, format:check, typecheck --force and separate vquery test typechecking: passed; 24 typecheck/build tasks executed with no cache hits.
  • changeset status --since=origin/main: passed.
  • Browser smoke at http://localhost:3000/VBI/, the vquery storage documentation and aggregation examples: average 6,400 rendered correctly; no console warnings/errors observed.
  • Real-browser storage acceptance with the built browser entry: default queries work in a sandbox that denies IndexedDB (total 30); opt-in IndexedDB correctly reports the sandbox restriction; real IndexedDB restores schemas/sources across instances; default memory storage remains isolated from persisted data. All four checks passed, and the temporary acceptance dataset was removed.
  • Separate MySQL audit against 9,959 supplied CSV rows: all 394 DSL cases executed as parameterized and inline SQL (788 successful queries), with results matching an independent CSV/DSL evaluator. This audit did not add database tests or fixtures to the repository; 29 cases returned empty results on this dataset.

☑️ Self-Check before Merge

  • Documentation and generated examples reviewed
  • TypeScript definitions exported and checked
  • Patch changeset provided
  • Changes limited to vquery and its related tests/documentation

@youngwinds youngwinds changed the title fix(vquery): support parameterized MySQL and DuckDB SQL compilation fix(vquery): unify SQL dialects and make IndexedDB opt-in Oct 13, 2026
@youngwinds
youngwinds merged commit 1122399 into main Oct 14, 2026
4 checks passed
@youngwinds
youngwinds deleted the codex/vquery-sql-dialects branch October 14, 2026 03:26
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