@Override
  protected DoubleWritable doEvaluate(DoubleWritable a) {
    if (a.get() < 0) {
      return null;
    } else {
      result.set(StrictMath.sqrt(a.get()));
      return result;
    }
  }
Return NULL for negative inputs; otherwise, return the square root.
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSqrt.java