public static TypeInfo deriveInType(List<ExprNodeDesc> children) {
    TypeInfo returnType = null;
    for (ExprNodeDesc node : children) {
      TypeInfo ti = node.getTypeInfo();
      if (ti.getCategory() == Category.PRIMITIVE
        && ((PrimitiveTypeInfo)ti).getPrimitiveCategory() == PrimitiveCategory.VOID) {
        continue;
      }
      if (returnType == null) {
        returnType = ti;
        continue;
      }
      if (returnType == ti) continue;
      TypeInfo commonTypeInfo = FunctionRegistry.getCommonClassForComparison(returnType, ti);
      if (commonTypeInfo == null) return null;
      returnType = commonTypeInfo;
    }
    return returnType;
  }
Convert the return Object if necessary (when the ObjectInspectors of
different possibilities are not all the same). If reuse is true,
the result Object will be the same object as the last invocation
(as long as the oi is the same)
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUtils.java