Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 17CA6200B14 for ; Sat, 4 Jun 2016 02:45:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 16A77160A50; Sat, 4 Jun 2016 00:45:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 60DFF160A49 for ; Sat, 4 Jun 2016 02:45:21 +0200 (CEST) Received: (qmail 9524 invoked by uid 500); 4 Jun 2016 00:45:20 -0000 Mailing-List: contact commits-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@drill.apache.org Delivered-To: mailing list commits@drill.apache.org Received: (qmail 9513 invoked by uid 99); 4 Jun 2016 00:45:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jun 2016 00:45:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5A7A4DFBA1; Sat, 4 Jun 2016 00:45:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: parthc@apache.org To: commits@drill.apache.org Message-Id: <61d5f4404ca445b59b9ccd2c2440530c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: drill git commit: DRILL-4607: - Fix unittest failure. Janino cannot compile a function that uses generics; so replaced the implementation of StringFunctions.Split to not use any. Date: Sat, 4 Jun 2016 00:45:20 +0000 (UTC) archived-at: Sat, 04 Jun 2016 00:45:22 -0000 Repository: drill Updated Branches: refs/heads/master 3186217e5 -> d1ac6fbae DRILL-4607: - Fix unittest failure. Janino cannot compile a function that uses generics; so replaced the implementation of StringFunctions.Split to not use any. Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/d1ac6fba Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/d1ac6fba Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/d1ac6fba Branch: refs/heads/master Commit: d1ac6fbae025723d54eeeb7d15b89a0df5912a3c Parents: 3186217 Author: Parth Chandra Authored: Thu Jun 2 17:23:13 2016 -0700 Committer: Parth Chandra Committed: Fri Jun 3 17:43:07 2016 -0700 ---------------------------------------------------------------------- .../drill/exec/expr/fn/impl/StringFunctions.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/d1ac6fba/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java index 41ff55f..524d254 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java @@ -172,7 +172,9 @@ public class StringFunctions{ @Override public void setup() { - matcher = java.util.regex.Pattern.compile(org.apache.drill.exec.expr.fn.impl.RegexpUtil.sqlToRegexSimilar(org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(pattern.start, pattern.end, pattern.buffer))).matcher(""); + matcher = java.util.regex.Pattern.compile(org.apache.drill.exec.expr.fn.impl.RegexpUtil.sqlToRegexSimilar( + org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers + .toStringFromUTF8(pattern.start, pattern.end, pattern.buffer))).matcher(""); charSequenceWrapper = new org.apache.drill.exec.expr.fn.impl.CharSequenceWrapper(); matcher.reset(charSequenceWrapper); } @@ -231,7 +233,8 @@ public class StringFunctions{ @Override public void setup() { - matcher = java.util.regex.Pattern.compile(org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(pattern.start, pattern.end, pattern.buffer)).matcher(""); + matcher = java.util.regex.Pattern.compile(org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8( + pattern.start, pattern.end, pattern.buffer)).matcher(""); charSequenceWrapper = new org.apache.drill.exec.expr.fn.impl.CharSequenceWrapper(); matcher.reset(charSequenceWrapper); } @@ -1345,7 +1348,7 @@ public class StringFunctions{ public void setup() { int len = delimiter.end - delimiter.start; if (len != 1) { - throw new IllegalArgumentException("Only single character delimiters are supportted for split()"); + throw new IllegalArgumentException("Only single character delimiters are supported for split()"); } char splitChar = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers. toStringFromUTF8(delimiter.start, delimiter.end, delimiter.buffer).charAt(0); @@ -1354,12 +1357,13 @@ public class StringFunctions{ @Override public void eval() { - Iterable tokens = splitter.split( - org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start, input.end, input.buffer)); + // Convert the iterable to an array as Janino will not handle generics. + Object[] tokens = com.google.common.collect.Iterables.toArray(splitter.split( + org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start, input.end, input.buffer)), String.class); org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter list = writer.rootAsList(); list.startList(); - for (String token : tokens) { - final byte[] strBytes = token.getBytes(com.google.common.base.Charsets.UTF_8); + for(int i = 0; i < tokens.length; i++ ) { + final byte[] strBytes = ((String)tokens[i]).getBytes(com.google.common.base.Charsets.UTF_8); buffer = buffer.reallocIfNeeded(strBytes.length); buffer.setBytes(0, strBytes); list.varChar().writeVarChar(0, strBytes.length, buffer);