Skip to content

VTL regular names are now case-insensitive#861

Open
albertohernandez1995 wants to merge 8 commits into
mainfrom
cr-633-2
Open

VTL regular names are now case-insensitive#861
albertohernandez1995 wants to merge 8 commits into
mainfrom
cr-633-2

Conversation

@albertohernandez1995

Copy link
Copy Markdown
Contributor

Summary

VTL regular names are case-insensitive per the spec, but the engine was treating
them case-sensitively — so DS_r <- ds_1; or DS_1[filter ME_1 > 15] would blow
up during semantic analysis even though DS_1/Me_1 existed. This makes regular
names (datasets, components, scalars, UDOs, hierarchical/datapoint rulesets, value
domains, external routines) resolve case-insensitively across the whole pipeline,
while keeping the casing the user actually wrote in the output.

The core of it is a small CaseInsensitiveDict (matches keys case-insensitively but
preserves the original casing for display) backing the symbol tables and
Dataset.components, plus shared normalize_name / names_equal helpers for the
remaining name comparisons. It's wired through both the interpreter (structure
inference) and the DuckDB transpiler (execution), the DAG analyzer, and input
loading. At the API boundary we convert back to plain dicts so the internal type
never leaks to callers or SDMX output.

"Written casing wins" for clauses: DS_1[calc ME_1 := Me_1 * 2] produces a single
ME_1 column, and rename/aggr behave the same way.

Fixes #633

Checklist

  • Code quality checks pass (ruff format, ruff check, mypy)
  • Tests pass (pytest)
  • Documentation updated (if applicable)

Impact / Risk

  • Scripts that were valid before keep working. The one behavioral change is that
    names differing only in case are now the same name — e.g. using A and a as
    two separate datasets is no longer allowed (that's the intended spec behavior).
    One DAG test fixture was updated to reflect this.
  • No SDMX/output compatibility concerns: output structures keep the user's casing
    and the API returns plain dicts as before.
  • Note for the changelog: regular-name resolution is now case-insensitive.

Notes

  • Quoted/non-regular names are treated case-insensitively too in this version.
    Making them spec-exact (case-sensitive) would mean threading a "quoted" flag
    through the parser and all lookups — deferred as a follow-up since it's out of
    scope for VTL regular names must be case insensitive #633.

@albertohernandez1995 albertohernandez1995 requested a review from a team June 19, 2026 13:59
@albertohernandez1995 albertohernandez1995 self-assigned this Jun 19, 2026
@albertohernandez1995 albertohernandez1995 linked an issue Jun 19, 2026 that may be closed by this pull request
2 tasks
Comment thread tests/Model/test_case_insensitive_dict.py Fixed
albertohernandez1995 and others added 3 commits June 19, 2026 16:03
…e-effect'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Signed-off-by: Alberto <155883871+albertohernandez1995@users.noreply.github.com>

@mla2001 mla2001 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine!
It would only be necessary to add a few more VTL tests and verify that the case insensitive behavior of the operands actually works in a normal VTL run, not just check that the dictionary works.

@albertohernandez1995

Copy link
Copy Markdown
Contributor Author

Looks fine! It would only be necessary to add a few more VTL tests and verify that the case insensitive behavior of the operands actually works in a normal VTL run, not just check that the dictionary works.

It should be now fine.

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.

VTL regular names must be case insensitive

2 participants