Summary
PR 279 fixes the plain-Ibis/no-xorq YAML calculated_measures path for normal post-aggregation derived measures, but .all(...) percent-of-total calculated measures still fail on Postgres because BSL generates a FIRST(...) aggregate that Postgres does not provide.
Repro context
- BSL source:
julien/plain-ibis-demo-window-pr278 / PR 279
- Commit tested:
2a226da (fix: resolve YAML calculated measures against measures first)
- Mode: plain Ibis, no xorq (
HAS_XORQ=False)
- Ibis:
11.0.0
- Backend: Postgres
Minimal semantic YAML shape
target_phase_cells:
table: target_phase_cells
dimensions:
phase: _.phase
measures:
target_cells: _.target_cells.sum()
calculated_measures:
pct_of_all_target_cells: _.target_cells / _.all(_.target_cells) * 100
Query
models["target_phase_cells"].query(
dimensions=("phase",),
measures=("pct_of_all_target_cells",),
).execute()
Actual result
psycopg.errors.UndefinedFunction: function first(bigint) does not exist
LINE 1: ... FIRST("t2"...
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Expected result
The .all(...) calculated measure should execute on Postgres, likely by compiling to a backend-supported window/subquery expression rather than FIRST(...), or by using a portable aggregate/window equivalent.
What does work in PR 279
Normal YAML calculated measures now work in the same plain-Ibis/Postgres setup, e.g.:
calculated_measures:
coverage_ratio: _.scheduled_people / _.required_people
avg_required_per_cell: _.required_people / _.target_cells
scheduled_per_cell: _.scheduled_people / _.target_cells
gap_ratio: _.coverage_gap / _.required_people
These all execute successfully against the mart layer.
Repro script location from local validation
In my local playground, this is captured as an expected failure in:
packages/core/bi/playground/scripts/test_bsl_healio_marts.py
The failing section is named:
target phase percent-of-total calculated measure (Postgres FIRST() gap)
Summary
PR 279 fixes the plain-Ibis/no-xorq YAML
calculated_measurespath for normal post-aggregation derived measures, but.all(...)percent-of-total calculated measures still fail on Postgres because BSL generates aFIRST(...)aggregate that Postgres does not provide.Repro context
julien/plain-ibis-demo-window-pr278/ PR 2792a226da(fix: resolve YAML calculated measures against measures first)HAS_XORQ=False)11.0.0Minimal semantic YAML shape
Query
Actual result
Expected result
The
.all(...)calculated measure should execute on Postgres, likely by compiling to a backend-supported window/subquery expression rather thanFIRST(...), or by using a portable aggregate/window equivalent.What does work in PR 279
Normal YAML calculated measures now work in the same plain-Ibis/Postgres setup, e.g.:
These all execute successfully against the mart layer.
Repro script location from local validation
In my local playground, this is captured as an expected failure in:
The failing section is named: