Skip to content

refactor: convert to_untagged() to return xorq-vendored ibis types at…#203

Merged
boringdata merged 10 commits intomainfrom
hussain/xorq-vendored-to-untagged
Mar 9, 2026
Merged

refactor: convert to_untagged() to return xorq-vendored ibis types at…#203
boringdata merged 10 commits intomainfrom
hussain/xorq-vendored-to-untagged

Conversation

@hussainsultan
Copy link
Collaborator

… the leaf

Convert SemanticTableOp.to_untagged() to return xorq-vendored ibis types via _ensure_xorq_table(), eliminating ad-hoc from_ibis() calls and module-sniffing workarounds throughout the codebase. Add unify_backends() helper using walk_nodes to ensure all DatabaseTable nodes share a single canonical backend at execution time. Update all internal ibis.window(), ibis.literal(), ibis. usages to xorq-vendored equivalents.

hussainsultan and others added 10 commits March 5, 2026 09:06
… the leaf

Convert SemanticTableOp.to_untagged() to return xorq-vendored ibis types
via _ensure_xorq_table(), eliminating ad-hoc from_ibis() calls and
module-sniffing workarounds throughout the codebase. Add _unify_backends()
helper using walk_nodes to ensure all DatabaseTable nodes share a single
canonical backend at execution time. Update all internal ibis.window(),
ibis.literal(), ibis._ usages to xorq-vendored equivalents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same LegacyWindowBuilder fix as other test files — the rolling window
lambda needs xorq's window builder since to_untagged() now returns
xorq-vendored ibis types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace `from xorq.vendor import ibis as xibis` / `xibis.*` with
`import xorq.api as xo` / `xo.*` throughout source and test files.
Keep `from xorq.vendor import ibis` only where xorq.api lacks the
needed API (to_sql with dialect parameter, TimestampScalar type).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ibis.window(), ibis.dense_rank(), ibis.row_number(),
ibis.desc(), ibis.date() with xorq.api equivalents in example
scripts that pass these through semantic layer lambdas.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AllOf.ref can be an AggregationExpr at runtime (e.g. t.all(t.value.sum().coalesce(0))),
but _serialize_calc_expr had no handler for it, silently producing None and crashing
deserialization with TypeError: 'NoneType' object is not subscriptable.

Add "agg_expr" tag for AggregationExpr serialization/deserialization, using
_list_to_tuple to restore tuple structure from xorq's list-based tag metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace xorq_convert.py monolith with serialization/ package:
- extract.py: singledispatch extractors on actual op types
- reconstruct.py: decorator-based handler registry
- context.py: BSLSerializationContext centralizes deserialization
- freeze.py: clean freeze/thaw utilities for FrozenOrderedDict
- helpers.py: shared deserialization helpers
- Remove all pickle support (v1.0 backward compat)
- Delete xorq_convert.py, update all imports directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
COUNT DISTINCT (nunique) was being pre-aggregated per source table and
re-aggregated with SUM, which overcounts when the same value appears
across partitions. Since distinct counts are immune to fan-out, they
are now computed on the full joined table instead of pre-aggregated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of always using the full fanned-out joined table for deferred
count-distinct measures, compute on the raw source table when all
group-by columns are local. Falls back to the joined table only for
cross-table group-bys where the join is needed to resolve foreign dims.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@boringdata boringdata merged commit 2906746 into main Mar 9, 2026
3 checks passed
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.

2 participants