Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a9e63bb
feat(native): recover CTE facts natively behind the preview engine
kvlonge Oct 9, 2026
3c903e7
test(compile): allow a 1.2x wall-time cache-write overhead in the fre…
kvlonge Oct 9, 2026
1640fbd
Merge remote-tracking branch 'origin/main' into feat/native-cte-facts
kvlonge Oct 9, 2026
1efb420
test(native): compare CTE fact recovery with Python function for func…
kvlonge Oct 9, 2026
046309c
fix(compile): reuse SQL test artifacts whose bytes are unchanged when…
kvlonge Oct 9, 2026
702b6be
feat(native): batch dynamic pivot proofs and opt-out syntax checks th…
kvlonge Oct 9, 2026
c51b7c4
fix(native): keep the finished analysis session out of CompiledProjec…
kvlonge Oct 9, 2026
8cbd849
perf(native): evaluate model contracts without repeated failing type …
kvlonge Oct 9, 2026
6c83a03
test(perf): report a phase missing from any run instead of counting i…
kvlonge Oct 9, 2026
6838836
feat(native): assemble SQL test facts natively behind the preview engine
kvlonge Oct 9, 2026
4182487
refactor(native): bundle SQL test assembly inputs and count only cons…
kvlonge Oct 9, 2026
194b280
test(native): assert exact seeded SQL-test assembly counts and deferrals
kvlonge Oct 9, 2026
309713e
test(native): count remaining native-to-Python fallbacks and add gold…
kvlonge Oct 9, 2026
0a806f6
test(native): record goldens and allow-list entries for the merged se…
kvlonge Oct 9, 2026
c815a7a
test(native): regenerate goldens and the fallback allow-list from mai…
kvlonge Oct 9, 2026
81ab203
test(native): count native answers per stage and close the review's g…
kvlonge Oct 9, 2026
26f793a
test(native): refuse vanished fallbacks without native answers and fa…
kvlonge Oct 9, 2026
3e003c0
test(native): count native SQL test planning and record baselines aft…
kvlonge Oct 9, 2026
d5c99e8
feat(native): feed semantic completion from the finished analysis ses…
kvlonge Oct 9, 2026
78f5d90
test(native): record baselines after native project assembly
kvlonge Oct 9, 2026
33c50dc
wip(native): share binding analyses across equal session members and …
kvlonge Oct 9, 2026
5cec154
test(native): pin shared, re-analysed and unshared session members ag…
kvlonge Oct 9, 2026
e4da413
test(perf): cover the model analysis CPU gate with compile arguments
kvlonge Oct 9, 2026
8e8de91
refactor(native): name the sharing helpers fensu requires and keep th…
kvlonge Oct 9, 2026
0bca3af
refactor(perf): share one clock-driven timer between wall and CPU com…
kvlonge Oct 9, 2026
ca84d84
perf(native): share equal inferred columns across session analyses an…
kvlonge Oct 9, 2026
10fc771
refactor(native): keep the shared column memo on the session analysis
kvlonge Oct 9, 2026
bd20f84
ci: gate native-preview custom rules CPU only against gross regressions
kvlonge Oct 9, 2026
9d4a40f
Merge remote-tracking branch 'origin/test/cache-write-wall-limit' int…
kvlonge Oct 9, 2026
7050b76
Merge remote-tracking branch 'origin/fix/native-custom-rules-speed' i…
kvlonge Oct 9, 2026
71d410f
Merge remote-tracking branch 'origin/feat/native-cte-facts' into feat…
kvlonge Oct 9, 2026
0f3b84c
Merge remote-tracking branch 'origin/feat/native-sql-test-assembly' i…
kvlonge Oct 9, 2026
c04abef
Merge remote-tracking branch 'origin/feat/native-project-session' int…
kvlonge Oct 9, 2026
909f518
Merge remote-tracking branch 'origin/fix/sql-test-cache-content-check…
kvlonge Oct 9, 2026
78eb5f9
Merge remote-tracking branch 'origin/test/native-fallback-counter' in…
kvlonge Oct 9, 2026
e541401
chore(native): drop imports the combined analysis session no longer uses
kvlonge Oct 9, 2026
e87407a
test(native): record baselines for the combined M4 batch
kvlonge Oct 9, 2026
0f0a01f
refactor(native): move SQL test scope dependencies out of project ass…
kvlonge Oct 9, 2026
82592d6
test(native): update session-fact counts for the combined generated c…
kvlonge Oct 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 44 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
;;
esac
case "${path}" in
scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|.github/workflows/verify.yml|Makefile)
scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|tests/goldens/*|tests/e2e/fixtures/*|website/examples/*|src/sqlbuild/cli/commands/_helpers/compile/*|.github/workflows/verify.yml|Makefile)
compiler_differential=true
;;
esac
Expand Down Expand Up @@ -318,7 +318,7 @@ jobs:
path: ${{ runner.temp }}/compiler-differential-wheel-sites.json
if-no-files-found: warn
retention-days: 30
- name: Compare generated seeds and the failure corpus (python vs shipped native)
- name: Compare fixtures, examples, generated seeds and the failure corpus (python vs shipped native)
run: >-
make compiler-differential-shipped
COMPILER_DIFFERENTIAL_ARGS="--stage-captures --require-discovery-coverage
Expand Down Expand Up @@ -595,7 +595,7 @@ jobs:
run: make test-e2e-diagnostic-compile-performance

compile_performance_ratio:
name: Same-runner compile ratio (${{ matrix.kind }} 3000 models)
name: Same-runner compile ratio (${{ matrix.label || matrix.kind }} 3000 models)
needs: [changes, lockfile]
if: needs.changes.outputs.performance == 'true'
runs-on: ubuntu-24.04
Expand All @@ -608,6 +608,25 @@ jobs:
max_ratio: "1.10"
- kind: fresh
max_ratio: "1.10"
- kind: dense
label: native-preview contracts vs python
base_engine: python
head_engine: native-preview
gate_phase: contracts_cpu_ms
max_ratio: "1.00"
- kind: dense
label: native-preview model analysis vs python
base_engine: python
head_engine: native-preview
gate_phase: model_analysis_cpu_ms
compile_args: --compile-arg=--select=*
max_ratio: "1.50"
- kind: dense
label: native-preview custom rules vs python
base_engine: python
head_engine: native-preview
gate_phase: custom_rules_cpu_ms
max_ratio: "1.25"
steps:
- uses: actions/checkout@v4
- name: Check out the comparison base
Expand All @@ -634,7 +653,29 @@ jobs:
- name: Install base dependencies
working-directory: base
run: uv sync --locked --all-groups --all-extras
- name: Compare python and native-preview phase CPU on head
if: matrix.gate_phase
env:
KIND: ${{ matrix.kind }}
MAX_RATIO: ${{ matrix.max_ratio }}
BASE_ENGINE: ${{ matrix.base_engine }}
HEAD_ENGINE: ${{ matrix.head_engine }}
GATE_PHASE: ${{ matrix.gate_phase }}
COMPILE_ARGS: ${{ matrix.compile_args }}
run: |
uv run python -m scripts.compare_compile_performance \
--kind "${KIND}" \
--modes cold \
--max-ratio "${MAX_RATIO}" \
--models 3000 \
--base-python .venv/bin/python \
--head-python .venv/bin/python \
--base-engine "${BASE_ENGINE}" \
--head-engine "${HEAD_ENGINE}" \
--gate-phase "${GATE_PHASE}" \
${COMPILE_ARGS:+"${COMPILE_ARGS}"}
- name: Compare base and head cold, warm and one-model edit compiles
if: ${{ !matrix.gate_phase }}
env:
KIND: ${{ matrix.kind }}
MAX_RATIO: ${{ matrix.max_ratio }}
Expand Down
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ SHELL := /bin/bash
test-e2e-duckdb-integrations test-e2e-performance \
test-e2e-cold-compile-performance test-e2e-cache-compile-performance \
test-e2e-dense-compile-performance test-e2e-varied-cache-performance \
compiler-differential compiler-differential-shipped compiler-differential-dense
compiler-differential compiler-differential-shipped compiler-differential-dense \
compiler-baselines

format:
uv run ruff format .
Expand Down Expand Up @@ -293,19 +294,32 @@ COMPILER_DIFFERENTIAL_SEEDS ?= 12
COMPILER_DIFFERENTIAL_SHIPPED_SEEDS ?= 12
COMPILER_DIFFERENTIAL_DENSE_MODELS ?= 3000
COMPILER_DIFFERENTIAL_ARGS ?=
# Native-to-Python fallbacks and analysis deferrals must match the allow-list exactly, and every
# output its golden. `make compiler-baselines` rewrites both (see scripts/compiler_differential/README.md).
COMPILER_DIFFERENTIAL_GATES := --native-fallbacks check --goldens check

compiler-differential:
env PYTHONUNBUFFERED=1 uv run python -m scripts.run_compiler_differential \
--jobs $(COMPILER_DIFFERENTIAL_JOBS) --seeds $(COMPILER_DIFFERENTIAL_SEEDS) \
$(COMPILER_DIFFERENTIAL_ARGS)
$(COMPILER_DIFFERENTIAL_GATES) $(COMPILER_DIFFERENTIAL_ARGS)

# python vs native-preview above covers every native stage; this keeps the shipped `native` default
# (native discovery and rendering) covered on a bounded corpus.
# (native discovery and rendering) and its goldens covered on the same corpus.
compiler-differential-shipped:
env PYTHONUNBUFFERED=1 uv run python -m scripts.run_compiler_differential \
--engines python native --corpus seeds failures \
--engines python native --corpus fixtures examples seeds failures \
--jobs $(COMPILER_DIFFERENTIAL_JOBS) --seeds $(COMPILER_DIFFERENTIAL_SHIPPED_SEEDS) \
$(COMPILER_DIFFERENTIAL_ARGS)
$(COMPILER_DIFFERENTIAL_GATES) $(COMPILER_DIFFERENTIAL_ARGS)

# Rewrite the goldens (from the python oracle) and the fallback allow-list from both CI runs.
# Review the diff like code; see scripts/compiler_differential/README.md.
COMPILER_DIFFERENTIAL_CI_ARGS := --stage-captures --require-discovery-coverage --require-render-coverage
compiler-baselines:
rm -rf tests/goldens/compiler
$(MAKE) compiler-differential COMPILER_DIFFERENTIAL_ARGS="$(COMPILER_DIFFERENTIAL_CI_ARGS) \
--require-analysis-coverage --native-fallbacks update --goldens update"
$(MAKE) compiler-differential-shipped COMPILER_DIFFERENTIAL_ARGS="$(COMPILER_DIFFERENTIAL_CI_ARGS) \
--native-fallbacks update --goldens update"

compiler-differential-dense:
env PYTHONUNBUFFERED=1 uv run python -m scripts.run_compiler_differential \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ pub(crate) struct SessionCatalog {
additions: Shapes,
analysis_names: Vec<String>,
recorded_analysis: HashSet<String>,
/// The `(types, nullability)` this session gave each relation's analysis.
analysis_shapes: HashMap<String, (Pairs, Pairs)>,
pub(crate) shared_members: usize,
pub(crate) reanalysed_members: usize,
}

impl SessionCatalog {
Expand All @@ -28,6 +32,9 @@ impl SessionCatalog {
additions: Vec::new(),
analysis_names: Vec::new(),
recorded_analysis: HashSet::new(),
analysis_shapes: HashMap::new(),
shared_members: 0,
reanalysed_members: 0,
}
}

Expand Down Expand Up @@ -86,6 +93,8 @@ impl SessionCatalog {
name.clone(),
(catalog_columns(&column_types), catalog_columns(columns)),
);
self.analysis_shapes
.insert(name.clone(), (column_types, columns.clone()));
if self.recorded_analysis.insert(name.clone()) {
self.analysis_names.push(name.clone());
}
Expand All @@ -95,6 +104,27 @@ impl SessionCatalog {
}
}

/// `(shared members, shared members re-analysed alone)` so far.
pub(crate) fn sharing(&self) -> (usize, usize) {
(self.shared_members, self.reanalysed_members)
}

/// The analysis shape this session set for `name`; inherited shapes are not known here.
pub(crate) fn session_analysis_shape(&self, name: &str) -> Option<&(Pairs, Pairs)> {
self.analysis_shapes.get(name)
}

/// The shape a binding of `columns` for `name` resolves: Python's override or catalog entry.
pub(crate) fn effective_binding_shape(&self, name: &str, columns: &Pairs) -> Pairs {
if columns.is_empty() {
return Vec::new();
}
match self.schemas.get(name) {
Some(known) if same_mapping(known, columns) => known.clone(),
_ => columns.clone(),
}
}

pub(crate) fn register_override(&mut self, overrides: Relations) -> usize {
self.native.register_override(overrides)
}
Expand Down
Loading
Loading