diff options
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java')
-rw-r--r-- | exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java | 159 |
1 files changed, 1 insertions, 158 deletions
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 13edf33c3..2497e1199 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 @@ -23,20 +23,12 @@ import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.holders.BigIntHolder; -import org.apache.drill.exec.expr.holders.Decimal18Holder; -import org.apache.drill.exec.expr.holders.Decimal28SparseHolder; import org.apache.drill.exec.expr.holders.VarDecimalHolder; import org.apache.drill.exec.expr.holders.NullableVarDecimalHolder; -import org.apache.drill.exec.expr.holders.Decimal38SparseHolder; -import org.apache.drill.exec.expr.holders.Decimal9Holder; import org.apache.drill.exec.expr.holders.Float4Holder; import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.expr.holders.NullableBigIntHolder; -import org.apache.drill.exec.expr.holders.NullableDecimal18Holder; -import org.apache.drill.exec.expr.holders.NullableDecimal28SparseHolder; -import org.apache.drill.exec.expr.holders.NullableDecimal38SparseHolder; -import org.apache.drill.exec.expr.holders.NullableDecimal9Holder; import org.apache.drill.exec.expr.holders.NullableFloat4Holder; import org.apache.drill.exec.expr.holders.NullableFloat8Holder; import org.apache.drill.exec.expr.holders.NullableIntHolder; @@ -49,6 +41,7 @@ import org.apache.drill.exec.expr.holders.NullableIntHolder; * as expected we would need to hash the same value represented in different data types (int, bigint, float etc) * to hash to the same node, this is why we cast all numeric values to double before performing the actual hash. */ +@SuppressWarnings("unused") public class Hash64WithSeedAsDouble { @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL ) public static class NullableFloatHash implements DrillSimpleFunc { @@ -196,84 +189,11 @@ public class Hash64WithSeedAsDouble { } @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class Decimal9Hash implements DrillSimpleFunc { - @Param Decimal9Holder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class NullableDecimal9Hash implements DrillSimpleFunc { - @Param NullableDecimal9Holder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - public void eval() { - if (in.isSet == 0) { - 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class Decimal18Hash implements DrillSimpleFunc { - @Param Decimal18Holder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class NullableDecimal18Hash implements DrillSimpleFunc { - @Param NullableDecimal18Holder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - public void eval() { - if (in.isSet == 0) { - 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) public static class VarDecimalHash implements DrillSimpleFunc { @Param VarDecimalHolder in; @Param BigIntHolder seed; @Output BigIntHolder out; - public void setup() { } @@ -290,7 +210,6 @@ public class Hash64WithSeedAsDouble { @Param BigIntHolder seed; @Output BigIntHolder out; - public void setup() { } @@ -304,81 +223,5 @@ public class Hash64WithSeedAsDouble { } } } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class Decimal28Hash implements DrillSimpleFunc { - @Param Decimal28SparseHolder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class NullableDecimal28Hash implements DrillSimpleFunc { - @Param NullableDecimal28SparseHolder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - public void eval() { - if (in.isSet == 0) { - out.value = seed.value; - } 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class Decimal38Hash implements DrillSimpleFunc { - @Param Decimal38SparseHolder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - - @FunctionTemplate(name = "hash64AsDouble", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL) - public static class NullableDecimal38Hash implements DrillSimpleFunc { - @Param NullableDecimal38SparseHolder in; - @Param BigIntHolder seed; - @Output BigIntHolder out; - - - public void setup() { - } - - public void eval() { - if (in.isSet == 0) { - out.value = seed.value; - } 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.HashHelper.hash64(input.doubleValue(), seed.value); - } - } - } } |