From commits-return-3998-apmail-drill-commits-archive=drill.apache.org@drill.apache.org Wed Apr 20 05:32:33 2016 Return-Path: X-Original-To: apmail-drill-commits-archive@www.apache.org Delivered-To: apmail-drill-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6E6CB185B8 for ; Wed, 20 Apr 2016 05:32:33 +0000 (UTC) Received: (qmail 37736 invoked by uid 500); 20 Apr 2016 05:32:33 -0000 Delivered-To: apmail-drill-commits-archive@drill.apache.org Received: (qmail 37667 invoked by uid 500); 20 Apr 2016 05:32:33 -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 37645 invoked by uid 99); 20 Apr 2016 05:32:33 -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; Wed, 20 Apr 2016 05:32:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0FE7ADFF41; Wed, 20 Apr 2016 05:32:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sudheesh@apache.org To: commits@drill.apache.org Date: Wed, 20 Apr 2016 05:32:34 -0000 Message-Id: In-Reply-To: <2b2e05fddd924b15bf67b3abd350a828@git.apache.org> References: <2b2e05fddd924b15bf67b3abd350a828@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] drill git commit: DRILL-4237, DRILL-4478: Implement hash to use murmur3 and add correspondent unit tests DRILL-4237, DRILL-4478: Implement hash to use murmur3 and add correspondent unit tests + Avoid object or extra buffer creation + Clean up tests closes #485 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/c6a03eb1 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/c6a03eb1 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/c6a03eb1 Branch: refs/heads/master Commit: c6a03eb1708f3cea6cea2f9530057ad707c374c0 Parents: 3b056db Author: chunhui-shi Authored: Tue Mar 15 10:36:54 2016 -0700 Committer: Sudheesh Katkam Committed: Tue Apr 19 21:58:16 2016 -0700 ---------------------------------------------------------------------- .../drill/common/util/DrillStringUtils.java | 4 +- .../drill/exec/expr/fn/impl/DrillHash.java | 50 ++++ .../drill/exec/expr/fn/impl/Hash32AsDouble.java | 33 +-- .../exec/expr/fn/impl/Hash32Functions.java | 60 ++-- .../expr/fn/impl/Hash32FunctionsWithSeed.java | 63 +++-- .../expr/fn/impl/Hash32WithSeedAsDouble.java | 32 +-- .../drill/exec/expr/fn/impl/Hash64AsDouble.java | 32 +-- .../exec/expr/fn/impl/Hash64Functions.java | 60 ++-- .../expr/fn/impl/Hash64FunctionsWithSeed.java | 60 ++-- .../expr/fn/impl/Hash64WithSeedAsDouble.java | 32 +-- .../drill/exec/expr/fn/impl/HashHelper.java | 45 ++- .../drill/exec/expr/fn/impl/MurmurHash3.java | 280 +++++++++++++++++++ .../apache/drill/exec/expr/fn/impl/XXHash.java | 80 ++---- .../org/apache/drill/TestFunctionsQuery.java | 69 +++-- 14 files changed, 638 insertions(+), 262 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java b/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java index b016184..4dad397 100644 --- a/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java +++ b/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java @@ -163,10 +163,10 @@ public class DrillStringUtils { public static int parseBinaryString(ByteBuf str, int strStart, int strEnd) { int length = (strEnd - strStart); int dstEnd = strStart; - for (int i = strStart; i < length ; i++) { + for (int i = strStart; i < strStart+length ; i++) { byte b = str.getByte(i); if (b == '\\' - && length > i+3 + && strEnd > i+3 && (str.getByte(i+1) == 'x' || str.getByte(i+1) == 'X')) { // ok, take next 2 hex digits. byte hd1 = str.getByte(i+2); http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillHash.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillHash.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillHash.java new file mode 100644 index 0000000..8a92b81 --- /dev/null +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillHash.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.drill.exec.expr.fn.impl; + +import io.netty.buffer.DrillBuf; +import io.netty.util.internal.PlatformDependent; + +/** + * The base class of hash classes used in Drill. + */ +public class DrillHash { + + public static final long getLongLittleEndian(long offset) { + //return PlatformDependent.getLong(offset); + return ((long) PlatformDependent.getByte(offset+7) << 56) + | ((PlatformDependent.getByte(offset+6) & 0xffL) << 48) + | ((PlatformDependent.getByte(offset+5) & 0xffL) << 40) + | ((PlatformDependent.getByte(offset+4) & 0xffL) << 32) + | ((PlatformDependent.getByte(offset+3) & 0xffL) << 24) + | ((PlatformDependent.getByte(offset+2) & 0xffL) << 16) + | ((PlatformDependent.getByte(offset+1) & 0xffL) << 8) + | ((PlatformDependent.getByte(offset) & 0xffL)); + } + + public static final long getIntLittleEndian(long offset) { + long retl = 0; + retl = ((PlatformDependent.getByte(offset+3) &0xffL) << 24) + | ((PlatformDependent.getByte(offset+2) & 0xffL) << 16) + | ((PlatformDependent.getByte(offset+1) & 0xffL) << 8) + | ((PlatformDependent.getByte(offset) & 0xffL)); + return retl; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32AsDouble.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32AsDouble.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32AsDouble.java index 5a8e10a..0d912e8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32AsDouble.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32AsDouble.java @@ -45,6 +45,7 @@ import org.apache.drill.exec.expr.holders.NullableIntHolder; */ public class Hash32AsDouble { @FunctionTemplate(name = "hash32AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) + public static class NullableFloatHash implements DrillSimpleFunc { @Param @@ -59,7 +60,7 @@ public class Hash32AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -76,7 +77,7 @@ public class Hash32AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -95,7 +96,7 @@ public class Hash32AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -112,7 +113,7 @@ public class Hash32AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -131,7 +132,7 @@ public class Hash32AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((long) in.value, 0); } } } @@ -150,7 +151,7 @@ public class Hash32AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -167,7 +168,7 @@ public class Hash32AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((long)in.value, 0); } } @@ -182,7 +183,7 @@ public class Hash32AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -198,7 +199,7 @@ public class Hash32AsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } @@ -217,7 +218,7 @@ public class Hash32AsDouble { out.value = 0; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } } @@ -234,7 +235,7 @@ public class Hash32AsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } @@ -253,7 +254,7 @@ public class Hash32AsDouble { out.value = 0; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } } @@ -271,7 +272,7 @@ public class Hash32AsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } @@ -291,7 +292,7 @@ public class Hash32AsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } } @@ -309,7 +310,7 @@ public class Hash32AsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } @@ -329,7 +330,7 @@ public class Hash32AsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), 0); } } } http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32Functions.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32Functions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32Functions.java index f4b0c56..bb08197 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32Functions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32Functions.java @@ -68,7 +68,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -83,7 +83,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -100,7 +100,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -115,7 +115,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -132,7 +132,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, 0); } } } @@ -150,7 +150,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, 0); } } } @@ -168,7 +168,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, 0); } } } @@ -187,7 +187,7 @@ public class Hash32Functions { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -205,7 +205,7 @@ public class Hash32Functions { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -220,7 +220,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, 0); } } @@ -234,7 +234,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, 0); } } @@ -248,7 +248,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, 0); } } @@ -262,7 +262,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -275,7 +275,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @FunctionTemplate(names = {"hash", "hash32", "hash32AsDouble"}, scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) @@ -287,7 +287,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -303,7 +303,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -317,7 +317,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -333,7 +333,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -347,7 +347,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -363,7 +363,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -377,7 +377,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -393,7 +393,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -407,7 +407,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } @@ -423,7 +423,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -442,7 +442,7 @@ public class Hash32Functions { for (int i = 0; i < in.nDecimalDigits; i++) { xor = xor ^ Decimal28SparseHolder.getInteger(i, in.start, in.buffer); } - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(xor, 0); } } @@ -462,7 +462,7 @@ public class Hash32Functions { for (int i = 0; i < in.nDecimalDigits; i++) { xor = xor ^ NullableDecimal28SparseHolder.getInteger(i, in.start, in.buffer); } - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(xor, 0); } } } @@ -481,7 +481,7 @@ public class Hash32Functions { for (int i = 0; i < in.nDecimalDigits; i++) { xor = xor ^ Decimal38SparseHolder.getInteger(i, in.start, in.buffer); } - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(xor, 0); } } @@ -501,7 +501,7 @@ public class Hash32Functions { for (int i = 0; i < in.nDecimalDigits; i++) { xor = xor ^ NullableDecimal38SparseHolder.getInteger(i, in.start, in.buffer); } - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(xor, 0); } } } @@ -519,7 +519,7 @@ public class Hash32Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } } @@ -534,7 +534,7 @@ public class Hash32Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, 0); } } http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32FunctionsWithSeed.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32FunctionsWithSeed.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32FunctionsWithSeed.java index 5851956..7d49249 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32FunctionsWithSeed.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32FunctionsWithSeed.java @@ -72,7 +72,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -89,7 +89,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -108,7 +108,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -125,7 +125,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -144,7 +144,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, seed.value); } } } @@ -164,7 +164,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, seed.value); } } } @@ -184,7 +184,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, seed.value); } } } @@ -205,7 +205,7 @@ public class Hash32FunctionsWithSeed { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -225,7 +225,7 @@ public class Hash32FunctionsWithSeed { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -242,7 +242,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, seed.value); } } @@ -258,7 +258,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, seed.value); } } @@ -274,7 +274,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.end, in.buffer, seed.value); } } @@ -290,7 +290,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -306,7 +306,7 @@ public class Hash32FunctionsWithSeed { public void eval() { // TODO: implement hash function for other types - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @FunctionTemplate(names = {"hash32", "hash32AsDouble"}, scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) @@ -320,7 +320,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -338,7 +338,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -354,7 +354,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -372,7 +372,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -388,7 +388,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -406,7 +406,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -422,7 +422,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -440,7 +440,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -456,7 +456,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -474,7 +474,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -490,7 +490,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.start + Decimal28SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.start + Decimal28SparseHolder.WIDTH, in.buffer, seed.value); } } @@ -508,7 +508,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.start + NullableDecimal28SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.start + NullableDecimal28SparseHolder.WIDTH, in.buffer, seed.value); } } } @@ -524,7 +524,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.start + Decimal38SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.start + Decimal38SparseHolder.WIDTH, in.buffer, seed.value); } } @@ -542,7 +542,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.start + NullableDecimal38SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.start, in.start + NullableDecimal38SparseHolder.WIDTH, in.buffer, seed.value); } } } @@ -562,7 +562,7 @@ public class Hash32FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -579,6 +579,7 @@ public class Hash32FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } - }} + } +} http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32WithSeedAsDouble.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32WithSeedAsDouble.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32WithSeedAsDouble.java index cd4dfa2..f3d4d54 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32WithSeedAsDouble.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash32WithSeedAsDouble.java @@ -59,7 +59,7 @@ public class Hash32WithSeedAsDouble { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((double) in.value, seed.value); } } } @@ -76,7 +76,7 @@ public class Hash32WithSeedAsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((double) in.value, seed.value); } } @@ -95,7 +95,7 @@ public class Hash32WithSeedAsDouble { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } } @@ -112,7 +112,7 @@ public class Hash32WithSeedAsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(in.value, seed.value); } } @@ -132,7 +132,7 @@ public class Hash32WithSeedAsDouble { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((double) in.value, seed.value); } } } @@ -152,7 +152,7 @@ public class Hash32WithSeedAsDouble { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((double) in.value, seed.value); } } } @@ -169,7 +169,7 @@ public class Hash32WithSeedAsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((double) in.value, seed.value); } } @@ -185,7 +185,7 @@ public class Hash32WithSeedAsDouble { public void eval() { // TODO: implement hash function for other types - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32((double) in.value, seed.value); } } @@ -201,7 +201,7 @@ public class Hash32WithSeedAsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } @@ -220,7 +220,7 @@ public class Hash32WithSeedAsDouble { out.value = seed.value; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } } @@ -237,7 +237,7 @@ public class Hash32WithSeedAsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } @@ -256,7 +256,7 @@ public class Hash32WithSeedAsDouble { out.value = seed.value; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } } @@ -274,7 +274,7 @@ public class Hash32WithSeedAsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } @@ -294,7 +294,7 @@ public class Hash32WithSeedAsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } } @@ -312,7 +312,7 @@ public class Hash32WithSeedAsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } @@ -332,7 +332,7 @@ public class Hash32WithSeedAsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash32(input.doubleValue(), seed.value); } } } http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64AsDouble.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64AsDouble.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64AsDouble.java index 91caafc..f9080b7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64AsDouble.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64AsDouble.java @@ -63,7 +63,7 @@ public class Hash64AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } } @@ -80,7 +80,7 @@ public class Hash64AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } @@ -99,7 +99,7 @@ public class Hash64AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } } @@ -116,7 +116,7 @@ public class Hash64AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -135,7 +135,7 @@ public class Hash64AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } } @@ -154,7 +154,7 @@ public class Hash64AsDouble { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } } @@ -171,7 +171,7 @@ public class Hash64AsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } @@ -187,7 +187,7 @@ public class Hash64AsDouble { public void eval() { // TODO: implement hash function for other types - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, 0); } } @@ -203,7 +203,7 @@ public class Hash64AsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } @@ -222,7 +222,7 @@ public class Hash64AsDouble { out.value = 0; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } } @@ -239,7 +239,7 @@ public class Hash64AsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } @@ -258,7 +258,7 @@ public class Hash64AsDouble { out.value = 0; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } } @@ -276,7 +276,7 @@ public class Hash64AsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } @@ -296,7 +296,7 @@ public class Hash64AsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } } @@ -314,7 +314,7 @@ public class Hash64AsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } @@ -334,7 +334,7 @@ public class Hash64AsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 0); } } } http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64Functions.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64Functions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64Functions.java index 5145af2..157cbcd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64Functions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64Functions.java @@ -72,7 +72,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -89,7 +89,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -108,7 +108,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -125,7 +125,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -144,7 +144,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, 0); } } } @@ -164,7 +164,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, 0); } } } @@ -184,7 +184,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, 0); } } } @@ -204,7 +204,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -223,7 +223,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -240,7 +240,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, 0); } } @@ -256,7 +256,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, 0); } } @@ -272,7 +272,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, 0); } } @@ -288,7 +288,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -304,7 +304,7 @@ public class Hash64Functions { public void eval() { // TODO: implement hash function for other types - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -319,7 +319,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -337,7 +337,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -353,7 +353,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -371,7 +371,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -387,7 +387,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -405,7 +405,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -421,7 +421,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -439,7 +439,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -455,7 +455,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } @@ -473,7 +473,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -489,7 +489,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + Decimal28SparseHolder.WIDTH, + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + Decimal28SparseHolder.WIDTH, in.buffer, 0); } } @@ -508,7 +508,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + NullableDecimal28SparseHolder.WIDTH, in.buffer, 0); } } @@ -525,7 +525,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + Decimal38SparseHolder.WIDTH, + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + Decimal38SparseHolder.WIDTH, in.buffer, 0); } } @@ -544,7 +544,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + NullableDecimal38SparseHolder.WIDTH, in.buffer, 0); } } @@ -565,7 +565,7 @@ public class Hash64Functions { if (in.isSet == 0) { out.value = 0; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } @@ -582,7 +582,7 @@ public class Hash64Functions { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, 0); } } } http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64FunctionsWithSeed.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64FunctionsWithSeed.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64FunctionsWithSeed.java index 004a221..833a209 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64FunctionsWithSeed.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64FunctionsWithSeed.java @@ -72,7 +72,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -89,7 +89,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -108,7 +108,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -125,7 +125,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -144,7 +144,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, seed.value); } } } @@ -164,7 +164,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, seed.value); } } } @@ -184,7 +184,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, seed.value); } } } @@ -205,7 +205,7 @@ public class Hash64FunctionsWithSeed { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -225,7 +225,7 @@ public class Hash64FunctionsWithSeed { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -242,7 +242,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, seed.value); } } @@ -258,7 +258,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, seed.value); } } @@ -274,7 +274,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.end, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.end, in.buffer, seed.value); } } @@ -290,7 +290,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -306,7 +306,7 @@ public class Hash64FunctionsWithSeed { public void eval() { // TODO: implement hash function for other types - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @FunctionTemplate(names = {"hash64", "hash64AsDouble"}, scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) @@ -320,7 +320,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -338,7 +338,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -354,7 +354,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -372,7 +372,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -388,7 +388,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -406,7 +406,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -422,7 +422,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -440,7 +440,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -456,7 +456,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -474,7 +474,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -490,7 +490,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + Decimal28SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + Decimal28SparseHolder.WIDTH, in.buffer, seed.value); } } @@ -508,7 +508,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + NullableDecimal28SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + NullableDecimal28SparseHolder.WIDTH, in.buffer, seed.value); } } } @@ -524,7 +524,7 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + Decimal38SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + Decimal38SparseHolder.WIDTH, in.buffer, seed.value); } } @@ -542,7 +542,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.start, in.start + NullableDecimal38SparseHolder.WIDTH, in.buffer, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.start, in.start + NullableDecimal38SparseHolder.WIDTH, in.buffer, seed.value); } } } @@ -562,7 +562,7 @@ public class Hash64FunctionsWithSeed { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -579,6 +579,6 @@ public class Hash64FunctionsWithSeed { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } }} http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java index fbe1868..0079d98 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java @@ -63,7 +63,7 @@ public class Hash64WithSeedAsDouble { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, seed.value); } } } @@ -80,7 +80,7 @@ public class Hash64WithSeedAsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, seed.value); } } @@ -99,7 +99,7 @@ public class Hash64WithSeedAsDouble { if (in.isSet == 0) { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } } @@ -116,7 +116,7 @@ public class Hash64WithSeedAsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(in.value, seed.value); } } @@ -136,7 +136,7 @@ public class Hash64WithSeedAsDouble { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, seed.value); } } } @@ -156,7 +156,7 @@ public class Hash64WithSeedAsDouble { out.value = seed.value; } else { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, seed.value); } } } @@ -173,7 +173,7 @@ public class Hash64WithSeedAsDouble { } public void eval() { - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, seed.value); } } @@ -189,7 +189,7 @@ public class Hash64WithSeedAsDouble { public void eval() { // TODO: implement hash function for other types - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64((double) in.value, seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64((double) in.value, seed.value); } } @@ -205,7 +205,7 @@ public class Hash64WithSeedAsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } @@ -224,7 +224,7 @@ public class Hash64WithSeedAsDouble { out.value = seed.value; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } } @@ -241,7 +241,7 @@ public class Hash64WithSeedAsDouble { public void eval() { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } @@ -260,7 +260,7 @@ public class Hash64WithSeedAsDouble { out.value = seed.value; } else { java.math.BigDecimal input = new java.math.BigDecimal(java.math.BigInteger.valueOf(in.value), in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), seed.value); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } } @@ -278,7 +278,7 @@ public class Hash64WithSeedAsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } @@ -298,7 +298,7 @@ public class Hash64WithSeedAsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } } @@ -316,7 +316,7 @@ public class Hash64WithSeedAsDouble { public void eval() { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } @@ -336,7 +336,7 @@ public class Hash64WithSeedAsDouble { } else { java.math.BigDecimal input = org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromSparse(in.buffer, in.start, in.nDecimalDigits, in.scale); - out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash64(input.doubleValue(), 0); + out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), seed.value); } } } http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java index 0e9509a..22d0d82 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java @@ -17,12 +17,12 @@ */ package org.apache.drill.exec.expr.fn.impl; +import io.netty.buffer.DrillBuf; + import java.nio.ByteBuffer; import java.nio.ByteOrder; public class HashHelper { - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashHelper.class); - /** taken from mahout **/ public static int hash(ByteBuffer buf, int seed) { @@ -60,4 +60,45 @@ public class HashHelper { return h; } + public static int hash32(int val, long seed) { + double converted = val; + return hash32(converted, seed); + } + public static int hash32(long val, long seed) { + double converted = val; + return hash32(converted, seed); + } + public static int hash32(float val, long seed){ + double converted = val; + return hash32(converted, seed); + } + + + public static long hash64(float val, long seed){ + double converted = val; + return hash64(converted, seed); + } + public static long hash64(long val, long seed){ + double converted = val; + return hash64(converted, seed); + } + + public static long hash64(double val, long seed){ + return MurmurHash3.hash64(val, (int)seed); + } + + public static long hash64(long start, long end, DrillBuf buffer, long seed){ + return MurmurHash3.hash64(start, end, buffer, (int)seed); + } + + public static int hash32(double val, long seed) { + //return com.google.common.hash.Hashing.murmur3_128().hashLong(Double.doubleToLongBits(val)).asInt(); + return MurmurHash3.hash32(val, (int)seed); + } + + public static int hash32(int start, int end, DrillBuf buffer, int seed){ + return MurmurHash3.hash32(start, end, buffer, seed); + } + } + http://git-wip-us.apache.org/repos/asf/drill/blob/c6a03eb1/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java new file mode 100644 index 0000000..b21117b --- /dev/null +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java @@ -0,0 +1,280 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.drill.exec.expr.fn.impl; + +import io.netty.buffer.DrillBuf; +import io.netty.util.internal.PlatformDependent; + + +/** + * + * MurmurHash3 was written by Austin Appleby, and is placed in the public + * domain. + * See http://smhasher.googlecode.com/svn/trunk/MurmurHash3.cpp + * MurmurHash3_x64_128 + * MurmurHash3_x86_32 + */ +public final class MurmurHash3 extends DrillHash{ + + public static final long fmix64(long k) { + k ^= k >>> 33; + k *= 0xff51afd7ed558ccdL; + k ^= k >>> 33; + k *= 0xc4ceb9fe1a85ec53L; + k ^= k >>> 33; + return k; + } + + /* + Take 64 bit of murmur3_128's output + */ + public static long murmur3_64(long bStart, long bEnd, DrillBuf buffer, int seed) { + + long h1 = seed & 0x00000000FFFFFFFFL; + long h2 = seed & 0x00000000FFFFFFFFL; + + final long c1 = 0x87c37b91114253d5L; + final long c2 = 0x4cf5ad432745937fL; + long start = buffer.memoryAddress() + bStart; + long end = buffer.memoryAddress() + bEnd; + long length = bEnd - bStart; + long roundedEnd = start + ( length & 0xFFFFFFF0); // round down to 16 byte block + for (long i=start; i>> 17); + + lk1 *= c2; + lk1 = lk1 & UINT_MASK; + lh1 ^= lk1; + lh1 = ((lh1 << 13) & UINT_MASK) | (lh1 >>> 19); + + lh1 = lh1*5+0xe6546b64L; + lh1 = UINT_MASK & lh1; + } + + // tail + long lk1 = 0; + + switch((byte)length & 0x03) { + case 3: + lk1 = (PlatformDependent.getByte(roundedEnd + 2) & 0xff) << 16; + case 2: + lk1 |= (PlatformDependent.getByte(roundedEnd + 1) & 0xff) << 8; + case 1: + lk1 |= (PlatformDependent.getByte(roundedEnd) & 0xff); + lk1 *= c1; + lk1 = UINT_MASK & lk1; + lk1 = ((lk1 << 15) & UINT_MASK) | (lk1 >>> 17); + + lk1 *= c2; + lk1 = lk1 & UINT_MASK; + + lh1 ^= lk1; + } + + // finalization + lh1 ^= length; + + lh1 ^= lh1 >>> 16; + lh1 *= 0x85ebca6b; + lh1 = UINT_MASK & lh1; + lh1 ^= lh1 >>> 13; + + lh1 *= 0xc2b2ae35; + lh1 = UINT_MASK & lh1; + lh1 ^= lh1 >>> 16; + + return (int)(lh1 & UINT_MASK); + } + + public static int murmur3_32(long val, int seed) { + final long c1 = 0xcc9e2d51L; + final long c2 = 0x1b873593; + long length = 8; + long UINT_MASK=0xffffffffL; + long lh1 = seed & UINT_MASK; + for (int i=0; i<2; i++) { + //int ik1 = (int)((val >> i*32) & UINT_MASK); + long lk1 = ((val >> i*32) & UINT_MASK); + + //k1 *= c1; + lk1 *= c1; + lk1 &= UINT_MASK; + + lk1 = ((lk1 << 15) & UINT_MASK) | (lk1 >>> 17); + + lk1 *= c2; + lk1 &= UINT_MASK; + + lh1 ^= lk1; + lh1 = ((lh1 << 13) & UINT_MASK) | (lh1 >>> 19); + + lh1 = lh1*5+0xe6546b64L; + lh1 = UINT_MASK & lh1; + } + // finalization + lh1 ^= length; + + lh1 ^= lh1 >>> 16; + lh1 *= 0x85ebca6bL; + lh1 = UINT_MASK & lh1; + lh1 ^= lh1 >>> 13; + lh1 *= 0xc2b2ae35L; + lh1 = UINT_MASK & lh1; + lh1 ^= lh1 >>> 16; + + return (int)lh1; + } + + public static long hash64(double val, long seed){ + return murmur3_64(Double.doubleToLongBits(val), (int)seed); + } + + public static long hash64(long start, long end, DrillBuf buffer, long seed){ + return murmur3_64(start, end, buffer, (int)seed); + } + + public static int hash32(double val, long seed) { + //return com.google.common.hash.Hashing.murmur3_128().hashLong(Double.doubleToLongBits(val)).asInt(); + return (int)murmur3_64(Double.doubleToLongBits(val), (int)seed); + } + + public static int hash32(int start, int end, DrillBuf buffer, int seed){ + return (int)murmur3_64(start, end, buffer, seed); + } + +} +