You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using snowpark-python in conjunction with the pyre type checker. While doing this we came across some weird type errors, e.g. with this piece of code:
ƛ Found 2 type errors!
src/reproduction.py:3:39 Invalid inheritance [39]: `Union[snowflake.snowpark.column.Column, str]` is not a valid parent class.
src/reproduction.py:8:4 Incompatible parameter type [6]: In call `min`, for 1st positional argument, expected `ColumnOrName` but got `str`.
This leads to our assumption that snowpark-python isn't using NewType correctly. Indeed, the same snippet without NewType:
sfc-gh-mkeller
changed the title
Pyre type checker returns unexpected type errors with snowpark-python
SNOW-801097: Pyre type checker returns unexpected type errors with snowpark-python
Apr 25, 2023
I agree, according to the docs NewType is meant for distinctive types which this shouldn't be.
Great investigation @nerdinand , would you like to raise a PR to fix this issue?
Please answer these questions before submitting your issue. Thanks!
pip freeze
)?Redacted to the most relevant packages:
See: facebook/pyre-check#716
We're using snowpark-python in conjunction with the pyre type checker. While doing this we came across some weird type errors, e.g. with this piece of code:
We get the type error:
Since
ColumnOrName
is defined aswe would not expect such an error.
As outlined in facebook/pyre-check#716 (comment), the code
produces to two type errors:
This leads to our assumption that snowpark-python isn't using
NewType
correctly. Indeed, the same snippet withoutNewType
:passes the type checks.
This piece of code should not result in an error with the pyre type checker:
The text was updated successfully, but these errors were encountered: