NVIDIA-NeMo / NVIDIA-NeMo/DataDesigner

Report generation crashes on empty categorical histograms

Open
#905 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.2k
Forks
211
Avg merge
2d 6h
Merged PRs (30d)
40

Description

Priority Level

Medium (Annoying but has workaround)

Describe the bug

DatasetProfilerResults accepts categorical histogram data with empty categories and counts lists, but to_report() crashes while rendering it:

ValueError: max() arg is an empty sequence

This prevents report generation for a schema-valid analysis result with no categorical observations.

Steps/Code to reproduce bug

from pathlib import Path

from data_designer.config.analysis.dataset_profiler import DatasetProfilerResults


document = {
    "num_records": 1,
    "target_num_records": 1,
    "column_statistics": [
        {
            "column_type": "general",
            "column_name": "text",
            "num_records": 1,
            "num_null": 0,
            "num_unique": 1,
            "pyarrow_dtype": "string",
            "simple_dtype": "str",
        }
    ],
    "column_profiles": [
        {
            "column_name": "quality",
            "summaries": {
                "helpfulness": {
                    "score_name": "helpfulness",
                    "summary": "No observations",
                    "score_samples": [],
                }
            },
            "score_distributions": {
                "scores": {"helpfulness": []},
                "reasoning": {"helpfulness": []},
                "distribution_types": {"helpfulness": "categorical"},
                "distributions": {"helpfulness": "--"},
                "histograms": {
                    "helpfulness": {"categories": [], "counts": []},
                },
            },
        }
    ],
}

results = DatasetProfilerResults.model_validate(document)
results.to_report(Path("report.html"))

Model validation succeeds, then report rendering raises ValueError: max() arg is an empty sequence.

Expected behavior

An empty categorical histogram should render an empty-state placeholder, or it should be rejected during model validation with a clear validation error. to_report() should not raise an exception for an accepted input.

Agent Diagnostic / Prior Investigation

Reproduced on the current main branch. A histogram containing one category and one count renders successfully as a negative control.

CategoricalHistogramData in packages/data-designer-config/src/data_designer/config/analysis/column_statistics.py allows empty lists. The report path converts those lists into an empty mapping and passes it to create_rich_histogram_table() in packages/data-designer-config/src/data_designer/config/utils/visualization.py, which calls max(data.values()) without checking whether the mapping is empty.

The issue tracker was searched for CategoricalHistogramData, empty categorical histograms, and max() arg is an empty sequence; no matching issue was found.

Additional context

Regression coverage should exercise the public DatasetProfilerResults.to_report() method with empty categorical histogram data. Handling the empty state in the renderer would also make the shared visualization helper more robust.

Checklist

  • I reproduced this issue or provided a minimal example
  • I searched the docs/issues myself, or had my agent do so
  • If I used an agent, I included its diagnostics above

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CategoricalHistogramData in packages/data-designer-config/src/data_designer/config/analysis/column_statistics.py, then follow DatasetProfilerResults.to_report() to create_rich_histogram_table() in packages/data-designer-config/src/data_designer/config/utils/visualization.py. Add regression coverage through the public to_report() entry point using the provided empty histogram data; done means accepted input no longer raises and the empty state is handled clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.