From ad3f91b1d4e3a263dccea01c67172afb95bc4994 Mon Sep 17 00:00:00 2001 From: minurajeeve Date: Thu, 5 Oct 2023 15:03:16 +0530 Subject: [PATCH] Fix set-type directive for decimal by adding a default value for scale in case it is null/not provided. --- .../src/main/java/io/cdap/wrangler/utils/ColumnConverter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wrangler-core/src/main/java/io/cdap/wrangler/utils/ColumnConverter.java b/wrangler-core/src/main/java/io/cdap/wrangler/utils/ColumnConverter.java index be9c7f0bf..777eb5048 100644 --- a/wrangler-core/src/main/java/io/cdap/wrangler/utils/ColumnConverter.java +++ b/wrangler-core/src/main/java/io/cdap/wrangler/utils/ColumnConverter.java @@ -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)); } else { if (!SCHEMA_TYPE_MAP.containsKey(type)) { throw new DirectiveParseException(String.format("'%s' is an unsupported type. " +