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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

} else {
if (!SCHEMA_TYPE_MAP.containsKey(type)) {
throw new DirectiveParseException(String.format("'%s' is an unsupported type. " +
Expand Down
Loading