@Override
    public Optional<ColStatistics> estimate(List<ColStatistics> argStats) {
      PessimisticStatCombiner combiner = new PessimisticStatCombiner();
      for (int i = 1; i < argStats.size(); i += 2) {
        combiner.add(argStats.get(i));
      }
      if (argStats.size() % 2 == 1) {
        combiner.add(argStats.get(argStats.size() - 1));
      }
      return combiner.getResult();
    }
GenericUDF Class for SQL construct
"CASE WHEN a THEN b WHEN c THEN d [ELSE f] END".

NOTES: 1. a and c should be boolean, or an exception will be thrown. 2. b, d
and f should be common types, or an exception will be thrown.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFWhen.java