-
Notifications
You must be signed in to change notification settings - Fork 141
SNOW-2866776: add private var in numeric type #4022
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
Changes from all commits
d2649c3
6065ebf
7b8960e
eacb904
0defc75
5d61d3d
ac2e712
1be3e95
3ee94c5
20735a1
13ebe54
8ad136a
e508e83
692ad3b
e877f84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -370,7 +370,27 @@ def _fill_ast(self, ast: proto.DataType) -> None: | |
|
|
||
| # Numeric types | ||
| class _IntegralType(_NumericType): | ||
| pass | ||
| def __init__(self, **kwargs) -> None: | ||
| self._precision = kwargs.pop("_precision", None) | ||
|
|
||
| if kwargs != {}: | ||
| raise TypeError( | ||
| f"__init__() takes 0 argument but {len(kwargs.keys())} were given" | ||
| ) | ||
|
|
||
| def __eq__(self, other): | ||
| def filtered(d: dict) -> dict: | ||
| return {k: v for k, v in d.items() if k != "_precision"} | ||
|
|
||
| if context._is_snowpark_connect_compatible_mode: | ||
| return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | ||
| else: | ||
| return isinstance(other, self.__class__) and filtered( | ||
| self.__dict__ | ||
| ) == filtered(other.__dict__) | ||
|
|
||
| def __hash__(self): | ||
| return hash(repr(self)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need a custom hash implementation for this class?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TL:DR: this is to fix some test failure |
||
|
|
||
|
|
||
| class _FractionalType(_NumericType): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar Error in Exception Message
The error message uses singular "argument" but will be grammatically incorrect when multiple arguments are passed.
# Current: "takes 0 argument but 2 were given" (incorrect grammar)Fix: Use proper singular/plural form:
Or simply use plural consistently:
Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.