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

[CDAP-15361] Fix set-type directive for decimal when scale is null #673

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

minurajeeve
Copy link
Contributor

Fix set-type directive for decimal by adding a default value for scale in case it is null/not provided.

@minurajeeve minurajeeve added the build Triggers unit test build label Oct 5, 2023
@@ -317,7 +317,8 @@ public static Schema getSchemaForType(String type, Integer scale) throws Directi
type = type.toUpperCase();
if (type.equals(ColumnTypeNames.DECIMAL)) {
// TODO make set-type support setting decimal precision
typeSchema = Schema.nullableOf(Schema.decimalOf(38, scale));
scale = scale != null ? scale : 38;
typeSchema = Schema.nullableOf(Schema.decimalOf(76, scale));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can keep precision as 77 because according to the docs, a max precision of 76.76 is allowed. Besides, the other plugins (like Oracle) follow 38, 77 as default scale, precision.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@minurajeeve minurajeeve merged commit 0707064 into develop Oct 24, 2023
4 of 5 checks passed
@minurajeeve minurajeeve deleted the scale-null-bug-fix branch October 24, 2023 06:36
@minurajeeve minurajeeve changed the title Fix set-type directive for decimal when scale is null [CDAP-15361] Fix set-type directive for decimal when scale is null Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Triggers unit test build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants