Github user vvysotskyi commented on a diff in the pull request:
https://github.com/apache/drill/pull/570#discussion_r161006318
--- Diff:
exec/java-exec/src/main/codegen/templates/Decimal/CastVarCharDecimal.java ---
@@ -85,6 +85,30 @@ public void eval() {
// Assign the scale and precision
out.scale = (int) scale.value;
+
+ <#if type.to.endsWith("VarDecimal")>
+
+ // VarDecimal gets its own cast logic
+ int readIndex = in.start;
+ int endIndex = in.end;
+ StringBuffer sb = new StringBuffer();
--- End diff --
I think it would be easier to receive string using this code:
```
byte[] buf = new byte[in.end - in.start];
buffer.getBytes(in.start, buf, 0, in.end - in.start);
String s = new String(buf, Charsets.UTF_8);
```
---