Github user daveoshinsky commented on a diff in the pull request: https://github.com/apache/drill/pull/570#discussion_r161067313 --- Diff: exec/java-exec/src/main/codegen/templates/Decimal/CastDecimalVarchar.java --- @@ -150,6 +150,14 @@ public void setup() { public void eval() { +<#if type.from.contains("VarDecimal")> + java.math.BigDecimal bigDecimal = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromDrillBuf(in.buffer, in.start, in.end - in.start, in.scale); + String str = bigDecimal.toString(); + out.buffer = buffer; + out.start = 0; + out.end = Math.min((int)len.value, str.length()); + out.buffer.setBytes(0, str.getBytes()); --- End diff -- I take that back. Your change ensures it doesn't copy too many bytes. I'm including it in the remerged file.
---