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

Distinguish between np type hints from Py ones #4953

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

jmao-denver
Copy link
Contributor

Fixes #4933

return type(x) == {p_type}
"""
exec(func_str, globals())
t = empty_table(1).update(["X = i", f"Y = f((float)X)"])
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it is only testing the np.float32 case or is casting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests are just to make sure that the converted args' types are what we expected, the exact types of the values are not a concern here and they are tested in other test cases in the same test class.

return type(x) == {p_type}
"""
exec(func_str, globals())
t = empty_table(1).update(["X = i", f"Y = f(({p_type})X)"])
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this should also be testing with long and double since the python types are wide.

Copy link
Contributor Author

@jmao-denver jmao-denver Dec 18, 2023

Choose a reason for hiding this comment

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

see the comment above.

return type(x) == {p_type}
"""
exec(func_str, globals())
t = empty_table(1).update(["X = i", f"Y = f(X)"])
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it is only testing the np.int32 case or is doing casting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see the comment above.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the behavior here is correct. X is an np.int32. Here np.int8 is an accepted input in one iteration, which would be a downconversion -- certainly bad and should fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't yet statically check if the parameter types and argument types match. That's something for the improvement of the QLP. Runtime exception however will be thrown if the arg value is outside the range of a numpy integer type.

@jmao-denver jmao-denver merged commit 7364cf5 into deephaven:main Dec 18, 2023
25 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2023
@jmao-denver jmao-denver deleted the 4933-bug-non-np-typehints branch March 4, 2024 18:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected change with type hints not returning as specified type
2 participants