Anurag-S1ngh opened a new pull request, #4549:
URL: https://github.com/apache/iceberg-python/pull/4549

   Closes #3101
   
   # Rationale for this change
   
   mypy generates constructor signatures from pydantic field annotations, not 
from the explicit `__init__` overrides. `UnboundPredicate` and 
`LiteralPredicate` declared `term: UnboundTerm`, so `EqualTo("col", value)` 
failed with `arg-type` unless the pydantic mypy plugin was enabled.
   
   Widen the field to `str | UnboundTerm` and normalize strings with 
`BeforeValidator`. Binding casts the validated field back to `UnboundTerm`, and 
`SetPredicate.__getnewargs__` follows the widened type.
   
   ## Are these changes tested?
   
   - `pytest tests/expressions` (619 passed)
   - mypy on a snippet using `EqualTo`, `In`, and `IsNull` with string terms, 
without the pydantic plugin
   - Added a test for model validation with a string term
   - `ruff check` and `ruff format --check` on the changed files
   
   ## Are there any user-facing changes?
   
   No. This is a typing compatibility fix; runtime behavior is unchanged.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to