Skip to content

fix: coerce None filter_rate in Label/Int Filter charts - #851

Open
daviddallakyan2005 wants to merge 1 commit into
zilliztech:mainfrom
daviddallakyan2005:filter-rate-none-crash
Open

fix: coerce None filter_rate in Label/Int Filter charts#851
daviddallakyan2005 wants to merge 1 commit into
zilliztech:mainfrom
daviddallakyan2005:filter-rate-none-crash

Conversation

@daviddallakyan2005

@daviddallakyan2005 daviddallakyan2005 commented Aug 15, 2026

Copy link
Copy Markdown

Summary

Label Filter and Int Filter Streamlit charts crash with TypeError when a result row has filter_rate=None. dict.get(metric, 0) still returns None when the key is present, so min/sort compare None with a float.

PerformanceCustomDataset never passed filter_rate into the case (unlike LabelFilterPerformanceCase, which sets it to 1.0 - label_percentage). Custom-dataset filter runs therefore land in result files with filter_rate=None.

This PR:

  • Coerces missing/None metric values to 0 in both getRange and the x-axis sort (label_filter/charts.py and int_filter/charts.py) so leftover result files still render.
  • Sets filter_rate = 1.0 - label_percentage on PerformanceCustomDataset when use_filter and label_percentage are set, matching LabelFilter.

How to test

pip install -e '.[test]'
PYTHONPATH=. python3 -m pytest tests/test_filter_charts.py tests/test_custom_dataset_filter.py -q
make lint

Expected: 8 passed; black --check and ruff check vectordb_bench clean.

To reproduce the crash without the chart-side coerce: open Label Filter (or Int Filter) on a custom-dataset filter result whose case.filter_rate is None.

PerformanceCustomDataset never set filter_rate, so Streamlit getRange/sort
TypeError'd when the key was present with a None value. Mirror
LabelFilterPerformanceCase and treat None as 0 on the chart axis.
@sre-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: daviddallakyan2005
To complete the pull request process, please assign xuanyang-cn after the PR has been reviewed.
You can assign the PR to them by writing /assign @xuanyang-cn in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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