Skip to content

Fix semantic UNKNOWN error#78

Merged
ruizmaa merged 1 commit into
semantic-errorsfrom
fix/unknown-error
May 27, 2026
Merged

Fix semantic UNKNOWN error#78
ruizmaa merged 1 commit into
semantic-errorsfrom
fix/unknown-error

Conversation

@ruizmaa
Copy link
Copy Markdown
Contributor

@ruizmaa ruizmaa commented May 27, 2026

Closes #80

Two unhandled crashes in the semantic analyser were raising UNKNOWN errors instead of producing a valid result.

  1. Binary.validate_types in operators/base.py raised Exception("Mixed type promotion requires a result dataframe") when one operand was Mixed but no result dataframe existed (semantic-only mode, Scalar + ScalarSet path). Fixed by returning the operator's fixed return type directly when result_dataframe is None.

  2. visitExprWithSelection in ast/constructor.py hardcoded ctx_list[3] as the body expression. When the optional [WHERE expression] block is present the body shifts to a higher index, causing visit(None)NotImplementedError. Fixed by using ctx_list[-1].

Result

4 operations fixed.

operation_vid code release expression
10474 v22841_a-1 4.0 {tB_05.01, c0070} in { [eba_CT:x212], [eba_CT:x213] }
10475 v22861_a-3 4.0 {tB_05.01, c0080} in { [eba_GA:AL], [eba_GA:AT], [eba_GA:BE], ... }
10477 v22874_a-1 4.0 {tB_05.01, c0070} in { [eba_CT:x212], [eba_CT:x213] }
19007 v12213_m 4.2 with {tR_04.00.a, c*, default: 0, interval: true} [where qPYB = [eba_qIA:qx2090]]: {r0100} + {r0060} >= 9000000 * {r0040} ...

This are the failures after the fix: test_data_failures.csv

Checklist

  • Code quality checks pass (ruff format, ruff check, mypy)
  • Tests pass (pytest) with 100% branch coverage (coverage report --fail-under=100)
  • Documentation updated (if applicable)

Impact / Risk

  • Breaking changes? (public API / CLI / REST endpoints / Django models)
  • Database schema or migration concerns?
  • Notes for release/changelog?

Notes

@ruizmaa ruizmaa requested a review from a team May 27, 2026 09:03
@ruizmaa ruizmaa changed the base branch from master to semantic-errors May 27, 2026 09:03
@ruizmaa ruizmaa merged commit 9c75304 into semantic-errors May 27, 2026
6 of 18 checks passed
@ruizmaa ruizmaa deleted the fix/unknown-error branch May 27, 2026 09:07
@ruizmaa ruizmaa linked an issue May 27, 2026 that may be closed by this pull request
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.

Review semantic errors Error UNKNOWN: unhandled crashes in the semantic analyser

1 participant