-
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 7 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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -169,7 +169,17 @@ def _fill_ast(self, ast: proto.DataType) -> None: | |||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| class _NumericType(_AtomicType): | ||||||||||||||
| pass | ||||||||||||||
| def __init__(self, **kwargs) -> None: | ||||||||||||||
| self._precision = kwargs.get("precision", None) | ||||||||||||||
| self._scale = kwargs.get("scale", None) | ||||||||||||||
|
||||||||||||||
| def __init__(self, **kwargs) -> None: | |
| self._precision = kwargs.get("precision", None) | |
| self._scale = kwargs.get("scale", None) | |
| def __init__(self, precision: int | None = None, scale: int | None = None) -> None: | |
| self._precision = precision | |
| self._scale = scale |
Can we do this style instead to make it more explicit?
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.
this is a internal only feature, I think we don't want to expose this information to customer?
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.
OK, we can just keep it as kwargs then.
What do you think about moving the arguments onto _IntegralType instead of _NumericType? It looks like Snowflake only has a single precision for FLOAT and DECIMAL (docs), so we should never have to expose precision information for those types.
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.
+1 on using _IntegralType, I don't think we need _scale as it would always be 0
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.
i see, will fix this
Outdated
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.
why we overwrite the logic to exclude the new prop?
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.
here is a example test:
expected_fields = [
StructField("COL1", LongType(), nullable=True),
StructField("COL2", LongType(), nullable=True),
]
assert df.schema.fields == expected_fields
we exclude the private var so that these existing test does not fail
Uh oh!
There was an error while loading. Please reload this page.