public String isWithinCheckInterval(String expr, long intervalInSeconds) throws MetaException {
    String condition;
    switch (dbType) {
    case DERBY:
    case CUSTOM:
      condition = " {fn TIMESTAMPDIFF(sql_tsi_second, " + expr + ", current_timestamp)} <= " + intervalInSeconds;
      break;
    case MYSQL:
    case POSTGRES:
      condition = expr + " >= current_timestamp - interval '" + intervalInSeconds + "' second";
      break;
    case SQLSERVER:
      condition = "DATEDIFF(second, " + expr + ", current_timestamp) <= " + intervalInSeconds;
      break;
    case ORACLE:
      condition = expr + " >= current_timestamp - numtodsinterval(" + intervalInSeconds + " , 'second')";
      break;
    default:
      String msg = "Unknown database product: " + dbType.toString();
      LOG.error(msg);
      throw new MetaException(msg);
  }
    return condition;
  }
Given an expr (such as a column name) returns a database specific SQL function string
which when executed returns if the value of the expr is within the given interval of
the current timestamp in the database
@param expr
@param intervalInSeconds
@return
@throws MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java