private static RexNode makeCast(SqlTypeName typeName, final RexNode child, RexBuilder rexBuilder) {
    RelDataType sqlType = rexBuilder.getTypeFactory().createSqlType(typeName);
    RelDataType nullableType = rexBuilder.getTypeFactory().createTypeWithNullability(sqlType, true);
    return rexBuilder.makeCast(nullableType, child);
  }
Adds explicit casts if Calcite's type system could not resolve the CASE branches to a common type.

Calcite is more stricter than hive w.r.t type conversions.
If a CASE has branches with string/int/boolean branch types; there is no common type.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java