Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1232#discussion_r183761333
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Hash64WithSeedAsDouble.java
 ---
    @@ -265,6 +268,42 @@ public void eval() {
         }
       }
     
    +  @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() {
    +    }
    +
    +    public void eval() {
    +      java.math.BigDecimal input = 
org.apache.drill.exec.util.DecimalUtility.getBigDecimalFromDrillBuf(in.buffer,
    +              in.start, in.end - in.start, 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 NullableVarDecimalHash implements DrillSimpleFunc {
    +    @Param  NullableVarDecimalHolder 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.getBigDecimalFromDrillBuf(in.buffer,
    +                in.start, in.end - in.start, in.scale);
    +        out.value = 
org.apache.drill.exec.expr.fn.impl.HashHelper.hash64(input.doubleValue(), 
seed.value);
    +      }
    +    }
    +  }
    --- End diff --
    
    Please consider removing functions using old decimals.


---

Reply via email to