Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/2304#discussion_r79572690 --- Diff: flink-core/src/main/java/org/apache/flink/types/parser/BigDecParser.java --- @@ -55,9 +56,20 @@ public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, B return -1; } - String str = new String(bytes, startPos, i - startPos); try { - this.result = new BigDecimal(str); + final int length = i - startPos; + if (reuse == null || reuse.length != length) { + reuse = new char[length]; + } + for (int j = 0; j < length; j++) { + final byte b = bytes[startPos + j]; + if ((b < '0' || b > '9') && b != '-' && b != '+' && b != '.' && b != 'E' && b != 'e') { + throw new NumberFormatException(); + } + reuse[j] = (char) bytes[startPos + j]; + } + + this.result = new BigDecimal(reuse); --- End diff -- we can use the `BigDecimal(char[] in, int offset, int len)` and reuse the `reuse` object also if it is larger than then provided input.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---