-
Notifications
You must be signed in to change notification settings - Fork 56
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
bug fix for using set-type when it's the first directive in the recipie #688
base: develop
Are you sure you want to change the base?
Conversation
Pair<Integer, Integer> scaleAndPrecision = getPrecisionAndScale(fieldSchema); | ||
Integer inputSchemaScale = scaleAndPrecision.getSecond(); | ||
Integer inputSchemaPrecision = scaleAndPrecision.getFirst(); | ||
if (type.equalsIgnoreCase("decimal") && field.getSchema().isNullable()) { |
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.
What happens when schema is non nullable but set type directive is applied with 'decimal' as the type?
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.
If the schema is non nullable it will skip this if condition and will go to the return statement in line no:167. By default outputScale and outputPrecision are the scale and precision specified by the user. In this case we don't validate if the user specified scale and precision values clash with the original scale and precision values of that column.
Integer inputSchemaScale = scaleAndPrecision.getSecond(); | ||
Integer inputSchemaPrecision = scaleAndPrecision.getFirst(); | ||
if (type.equalsIgnoreCase("decimal") && field.getSchema().isNullable()) { | ||
Schema fieldSchema = field.getSchema().getNonNullable(); |
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.
Also, I think this giant block that calculates precision and scale to use can be moved to a different function. Can refactor the function used in .map()
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.
Done
d07f02d
to
6ffcfaa
Compare
No description provided.