Skip to content

fix: use portable min/any instead of arbitrary for windowed totals (#281) - #320

Open
mathisdrn wants to merge 1 commit into
boringdata:mainfrom
mathisdrn:fix/issue-281-portable-windowed-totals
Open

mathisdrn wants to merge 1 commit into
boringdata:mainfrom
mathisdrn:fix/issue-281-portable-windowed-totals

Conversation

@mathisdrn

Copy link
Copy Markdown

Fixes #281.

Problem

_carry_constant_total_col in src/boring_semantic_layer/calc_compiler.py used .arbitrary(), which compiles to FIRST(...) on plain-Ibis Postgres and fails because Postgres does not have a built-in FIRST aggregate function.

Fix

  • Update _carry_constant_total_col to use .any() for boolean columns and .min() for orderable types instead of .arbitrary().
  • Update the SQL snapshot in src/boring_semantic_layer/tests/snapshots/calc_percent_of_total.sql (ANY_VALUE -> MIN) and add Postgres SQL compilation coverage in src/boring_semantic_layer/tests/test_percent_of_total.py.

Verification

  • ruff check . and ruff format --check . passed.
  • .venv/bin/pytest -q src/boring_semantic_layer/tests/test_percent_of_total.py src/boring_semantic_layer/tests/test_calc_compiler.py src/boring_semantic_layer/tests/test_totals_semantics.py src/boring_semantic_layer/tests/test_sql_snapshots.py: 45 passed.

Note: This PR is AI-generated and human-reviewed.

This branch has not been deployed

No deployments
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.

Postgres plain-Ibis .all(...) calculated measures compile to unsupported FIRST(...)

1 participant