private static Object boxLiteral(ExprNodeConstantDesc constantDesc,
                                   BoxType boxType) {
    Object lit = constantDesc.getValue();
    if (lit == null) {
      return null;
    }
    switch (boxType) {
      case LONG:
        if (lit instanceof HiveDecimal) {
          HiveDecimal dec = (HiveDecimal) lit;
          if (!dec.isLong()) {
            throw new ArithmeticException("Overflow");
          }
          return dec.longValue();
        }
        return ((Number) lit).longValue();
      case STRING:
        if (lit instanceof HiveChar) {
          return ((HiveChar) lit).getPaddedValue();
        } else if (lit instanceof String) {
          return lit;
        } else {
          return lit.toString();
        }
      case DOUBLE:
        final Number dbl;
        if (lit instanceof HiveDecimal) {
          // HiveDecimal -> Number -> Double
          dbl = ((HiveDecimal) lit).doubleValue();
        } else {
          dbl = ((Number) lit);
        }
        return dbl.doubleValue();
      case FLOAT:
        final Number fl;
        if (lit instanceof HiveDecimal) {
          // HiveDecimal -> Float -> Number
          fl = ((Number)((HiveDecimal) lit).floatValue());
        } else {
          fl = ((Number) lit);
        }
        return fl.doubleValue();
      case TIMESTAMP:
        final Timestamp ts;
        if (lit instanceof Timestamp) {
          ts = (Timestamp) lit;
        } else if (lit instanceof org.apache.hadoop.hive.common.type.Timestamp) {
          ts = ((org.apache.hadoop.hive.common.type.Timestamp) lit)
              .toSqlTimestamp();
        } else if (lit instanceof org.apache.hadoop.hive.common.type.TimestampTZ) {
          ts =  Timestamp.valueOf(((TimestampTZ)lit).getZonedDateTime().toLocalDateTime());
        } else {
          ts = org.apache.hadoop.hive.common.type.Timestamp.valueOf(lit.toString())
              .toSqlTimestamp();
        }
        return ts;
      case DATE:
        // TODO [ORC-661]: use ChronoLocalDate and day of epoch instead of java's sql Date
        return Date.valueOf(LocalDate.parse(lit.toString()));
      case DECIMAL:
        return new HiveDecimalWritable(lit.toString());
      case BOOLEAN:
        return lit;
      default:
        throw new IllegalArgumentException("Unknown literal " + boxType);
    }
  }
Get the column name referenced in the expression. It must be at the top
level of this expression and there must be exactly one column.
@param expr the expression to look in
@param variable the slot the variable is expected in
@return the column name or null if there isn't exactly one column
ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java