Skip to content

Feature: Categorical values distribution - #1450

Open
IvannKurchenko wants to merge 20 commits into
databrickslabs:mainfrom
IvannKurchenko:feature/categorical_values_distribution
Open

Feature: Categorical values distribution#1450
IvannKurchenko wants to merge 20 commits into
databrickslabs:mainfrom
IvannKurchenko:feature/categorical_values_distribution

Conversation

@IvannKurchenko

@IvannKurchenko IvannKurchenko commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Changes

New check: Categorical values distribution check at dataset level using TDV measurement.

Linked issues

Resolves #1344

Tests

  • manually tested
  • added unit tests
  • added integration tests
  • added end-to-end tests
  • added performance tests

Documentation and Demos

  • added/updated demos
  • added/updated docs
  • added/updated agent skills

@mwojtyczka mwojtyczka 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.

Automated code review (high-effort recall pass) for is_in_distribution. 6 findings inline, ranked most-severe first. Correctness items #1#3 are marked plausible — verified by reading the sibling dataset-check closures rather than executing Spark locally.

This review was generated with assistance from Claude Code.

Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread tests/resources/all_dataset_checks.yaml
@mwojtyczka mwojtyczka added the under-review This PR is currently being reviewed by one of DQX maintainers. label Aug 11, 2026
@IvannKurchenko IvannKurchenko changed the title Feature/categorical values distribution Feature: Categorical values distribution Aug 15, 2026
@IvannKurchenko
IvannKurchenko marked this pull request as ready for review August 15, 2026 11:48
@IvannKurchenko
IvannKurchenko requested a review from a team as a code owner August 15, 2026 11:48
@IvannKurchenko
IvannKurchenko requested review from pratikk-databricks and removed request for a team August 15, 2026 11:48
@IvannKurchenko

Copy link
Copy Markdown
Contributor Author

Hello, @mwojtyczka! Thanks for a review. The previous feedback has been addressed. Would it be possible to have another round?

@mwojtyczka mwojtyczka 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.

Follow-up review pass

Resolved (verified against HEAD — threads now closed): the earlier .collect()/streaming (L599), driver-baked verdict (L646), df.schema[expr] KeyError (L565), implicit int upcast (L640), and missing -> None (L691) concerns are all addressed by the refactor to lazy conditional aggregation + explicit key casts. Marked those five threads resolved.

Still open: the YAML fixture thread (all_dataset_checks.yaml:267) is only partially addressed — the new second entry (TVD=0.5, distance=1.0) guards against a comparison inversion, but no fixture entry actually flags a mismatch end-to-end (both entries use distance: 1.0 and pass by design). Left open so you can decide whether positive-detection belongs here or in the integration test.

New findings (inline): two correctness edge cases (0.0-probability key under impute=False; is_close abs_tol=0 at distance=0) plus three minor items.

Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated

@mwojtyczka mwojtyczka 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.

Left some additional comments, previous comments resolved except one only partilally addressed.

@mwojtyczka mwojtyczka added the needs-changes Changes required after review label Sep 1, 2026
@IvannKurchenko

Copy link
Copy Markdown
Contributor Author

@mwojtyczka May I ask for another review round, please? Your previous comments has been addressed.

Comment thread src/databricks/labs/dqx/check_funcs.py
…DX build

The '{A: 0.5, B: 0.3}' example in the is_in_distribution docstring was
emitted verbatim into docs/reference/api/check_funcs.md, where MDX parsed
'{...}' as a JS expression and failed ('Could not parse expression with
acorn'), breaking the Build Docusaurus CI job. Wrap the literal in inline
code so MDX treats it as text, matching the existing pattern in
has_valid_json_schema. Verified with a full 'yarn build' (docs build now
succeeds).

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved to Merge When PR is reviewed and approved. To be merged once all tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: New check for categorical values distribution

2 participants