Skip to content

fix: treat empty property strings as present in helpers - #3801

Open
daviddallakyan2005 wants to merge 1 commit into
apache:mainfrom
daviddallakyan2005:fix-3713-empty-property-helpers
Open

fix: treat empty property strings as present in helpers#3801
daviddallakyan2005 wants to merge 1 commit into
apache:mainfrom
daviddallakyan2005:fix-3713-empty-property-helpers

Conversation

@daviddallakyan2005

Copy link
Copy Markdown

Closes #3713

Rationale for this change

property_as_int, property_as_float, property_as_bool, and get_first_property_value used a truthy walrus check (if value := properties.get(...)). An empty string is falsy in Python, so a present "" was treated as a missing key: the typed helpers returned the default instead of parsing, and get_first_property_value skipped to the next name.

This is the same class of bug as #3660 (falsy 0 collapsed to unset) and #3745 (CLI property lookup reported "" as missing). The helpers now use is not None, matching those PRs and the typed getters already in Config.get_int / get_bool. A missing key still returns the default. A present empty string is a value: int/float/bool raise ValueError (same as any other unparseable string), and get_first_property_value returns "".

Other walrus .get sites (IO, catalog, table locations/metadata) are left for follow-ups.

Are these changes tested?

Yes. Regression tests pass "" for int, float, and bool properties and for get_first_property_value.

  • make lint
  • make test → 3933 passed, 3 skipped, 1569 deselected

Are there any user-facing changes?

Yes. An explicitly empty int/float/bool property now raises ValueError instead of silently using the default, and get_first_property_value no longer skips an empty string. Changelog label requested.

Walrus `.get` truthiness treated "" as missing. Match the is-not-None
check from apache#3660/apache#3745 so a present empty value is parsed (or returned)
instead of falling back.
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.

check codebase for python truthiness error

1 participant