-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
AVRO-3521: "Scale" property from decimal object #1689
Conversation
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 LGTM, can you just fix the error messages to reflect the corrected behaviour! This should be included in the next minor release.
lang/py/avro/io.py
Outdated
@@ -699,7 +699,7 @@ def read_data(self, writers_schema: avro.schema.Schema, readers_schema: avro.sch | |||
warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal precision {precision}. Must be a positive integer.")) | |||
return decoder.read_bytes() | |||
scale = writers_schema.get_prop("scale") | |||
if not (isinstance(scale, int) and scale > 0): | |||
if not (isinstance(scale, int) and scale >= 0): | |||
warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal scale {scale}. Must be a positive integer.")) |
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.
warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal scale {scale}. Must be a positive integer.")) | |
warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal scale {scale}. Must be a non-negative integer.")) |
…nSkraba's improvement).
Hello, RyanScraba! |
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.
LGTM! Thanks for the contribution.
* AVRO-3521 * Fixed style for "AVRO-3521" * Changed from 'a positive integer' to 'a non-negative integer' (by RyanSkraba's improvement). * Update error message in test Co-authored-by: Ryan Skraba <ryan@skraba.com>
Make sure you have checked all steps below.
Jira
Tests
Commits
Documentation