Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing #1056

Merged
merged 22 commits into from
Oct 18, 2023
Merged

Typing #1056

merged 22 commits into from
Oct 18, 2023

Conversation

alexmojaki
Copy link
Contributor

This is an attempt to make some progress on #1055. Before this PR, pyright reports 625 errors, afterwards it reports 468. In particular I resolved all the type errors in src/snowflake/snowpark/_internal/analyzer/.

@alexmojaki alexmojaki requested a review from a team as a code owner September 24, 2023 18:04
@github-actions
Copy link

github-actions bot commented Sep 24, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@alexmojaki
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@sfc-gh-sfan
Copy link
Collaborator

Test pr in #1061

@sfc-gh-sfan sfc-gh-sfan added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Sep 26, 2023
@sfc-gh-sfan
Copy link
Collaborator

tests/integ/scala/test_snowflake_plan_suite.py:78: in test_multiple_queries
    plan2 = SnowflakePlan(
E   TypeError: SnowflakePlan.__init__() missing 1 required keyword-only argument: 'session'

@sfc-gh-stan sfc-gh-stan self-requested a review October 10, 2023 16:10
@@ -90,7 +93,10 @@ def convert_result_meta_to_attribute(meta: List[ResultMetadata]) -> List[Attribu
Attribute(
quoted_name,
convert_sf_to_sp_type(
FIELD_ID_TO_NAME[type_value], precision, scale, internal_size
FIELD_ID_TO_NAME[type_value],
precision or 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the default should be 38.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens today if it is None?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only None when the result is not Decimal type, where the parameter would not be used in convert_sf_to_sp_type. So technically the most "rigorous" way of writing this is checking the column type in convert_result_meta_to_attribute and define convert_sf_to_sp_type separately.

@sfc-gh-stan sfc-gh-stan force-pushed the typing branch 3 times, most recently from cde07a0 to b42d9a9 Compare October 17, 2023 21:43
@sfc-gh-stan
Copy link
Collaborator

Sorry all, I messed up a rebase and had to create a new test pr: #1095

@@ -90,7 +93,10 @@ def convert_result_meta_to_attribute(meta: List[ResultMetadata]) -> List[Attribu
Attribute(
quoted_name,
convert_sf_to_sp_type(
FIELD_ID_TO_NAME[type_value], precision, scale, internal_size
FIELD_ID_TO_NAME[type_value],
precision or 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens today if it is None?

Copy link
Collaborator

@sfc-gh-mkeller sfc-gh-mkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🚢

@sfc-gh-stan
Copy link
Collaborator

After discussing with @sfc-gh-mkeller , we have decided to use mypy as the source of truth for type checking. We will refer to the mypy configuration from the upstream snowflakedb/snowflake-connector-python@eee76d1#diff-6f2d4ba9ca9a357d31014946667b7bed1bfdbc6d2530afc77778fa0a36bee457. Ideally speaking this should not conflict with pyright checks, so I will keep the pyright merge gate, but mypy takes precedence if such conflict arise. I will mark the pyright merge gate as optional when we add mypy in the CI.

@sfc-gh-stan sfc-gh-stan merged commit a78e3ec into snowflakedb:main Oct 18, 2023
59 of 103 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants