Skip to content

fix: skip None when sorting unique values for range condition - #282

Open
iabaako wants to merge 1 commit into
mainfrom
fix/281-null-sort-remove-rows
Open

fix: skip None when sorting unique values for range condition#282
iabaako wants to merge 1 commit into
mainfrom
fix/281-null-sort-remove-rows

Conversation

@iabaako

@iabaako iabaako commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Pull Request Summary 🚀

What does this PR do? 📝

Fixes a crash in the "remove rows" prep step's range condition when a
selected column contains a mix of floats and nulls.
_get_unique_values_from_columns now filters out None before calling
sorted().

Fixes #281

Why is this change needed? 🤔

Python can't compare float and NoneType, so sorted() raised
TypeError: '<' not supported between instances of 'float' and 'NoneType'
whenever a selected range-condition column had missing values, crashing the
app on every rerun of that prep step.

How was this implemented? 🛠️

In src/datasure/views/prep_view.py, _get_unique_values_from_columns
(line 504) now sorts (v for v in value_options if v is not None) instead
of sorting the raw list. Nulls aren't meaningful bounds for a range
condition, so dropping them before sort is correct and minimal.

How to test or reproduce ? 🧪

  1. Start the app (uv run datasure) and open a project's prep view
  2. Add a "remove rows" prep step
  3. Choose a range condition and select a column containing both numeric
    values and missing/null values
  4. Before the fix: app crashes with the TypeError above
  5. After the fix: min/max selectboxes populate with the non-null values

Screenshots (if applicable) 📷

N/A (backend logic fix, no UI change beyond no longer crashing)

Checklist ✅

  • I have run and tested my changes locally
  • I have limit this PR to less than 1000 lines of code change (if not, explain why)
  • I have updated/added tests to cover my changes (if applicable)
  • I have updated/added requirements to cover my changes (if applicable)
  • I have run linting and formatting on any code changes (if applicable)
  • I have updated the documentation (README, etc.) accordingly
  • I have reviewed and resolved any merge conflict

Selecting a column with both floats and nulls raised TypeError since
None can't be compared to float. Filter out nulls before sorting, as
they aren't meaningful bounds for a range condition.

Fixes #281
@iabaako
iabaako requested a review from a team as a code owner August 29, 2026 18:09
@sonarqubecloud

Copy link
Copy Markdown

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.

Fix: TypeError in remove-rows range condition when column has null values

1 participant