Github user daveoshinsky commented on a diff in the pull request:
https://github.com/apache/drill/pull/570#discussion_r160777281
--- Diff:
exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java ---
@@ -68,15 +68,31 @@ public void setup() {
public void eval() {
out.scale = (int) scale.value;
+
+ <#if !type.to.endsWith("VarDecimal")>
out.precision = (int) precision.value;
+ </#if>
- <#if type.to == "Decimal9" || type.to == "Decimal18">
+ <#if type.to.endsWith("VarDecimal")>
+ out.start = 0;
+ out.buffer = buffer;
+ String s = Long.toString((long)in.value);
+ for (int i = 0; i < out.scale; ++i) { // add 0's to get unscaled
integer
+ s += "0";
--- End diff --
Agreed
---