private Object convertLiteral(Object o) {
      // This is a bit hackish to fix mismatch between SARG and Hive types
      // for Timestamp and Date. TODO: Move those types to storage-api.
      if (o instanceof java.sql.Date) {
        java.sql.Date sqlDate = (java.sql.Date)o;
        return Date.ofEpochDay(
            DateWritable.millisToDays(sqlDate.getTime()));
      } else if (o instanceof java.sql.Timestamp) {
        java.sql.Timestamp sqlTimestamp = (java.sql.Timestamp)o;
        return Timestamp.ofEpochMilli(sqlTimestamp.getTime(), sqlTimestamp.getNanos());
      }
      return o;
    }
Fixed bucket pruning optimizer goes through all the table scans and annotates them
with a bucketing inclusion bit-set.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/FixedBucketPruningOptimizer.java