message: Optimize logic around time comparisons
  The time comparison can be expensive. If the types match, we don't need
  to do this logic.
  This improves the tpcds optimization time from 67s to 61s on my laptop
  (~9% improvement).
  Authored-by: Chris Hajas
diff: @@ -216,12 +216,16 @@ IDatumStatisticsMappable::StatsAreComparable
  const IDatumStatisticsMappable *datum_cast = dynamic_cast<const IDatumStatisticsMappable*>(datum);
  BOOL is_types_match = this->MDId()->Equals(datum_cast->MDId());
  - BOOL is_time_comparison = CMDTypeGenericGPDB::IsTimeRelatedType(this->MDId())
  - && CMDTypeGenericGPDB::IsTimeRelatedType(datum_cast->MDId());
  +
  // the statistics for different time related types can't be directly compared, eg: timestamp vs timestamp with time zone.
  // to prevent inaccurate statistics, mark as non-comparable
  - if (is_time_comparison && !is_types_match)
  + if (!is_types_match)
  + {
  + BOOL is_time_comparison = CMDTypeGenericGPDB::IsTimeRelatedType(this->MDId())
  + && CMDTypeGenericGPDB::IsTimeRelatedType(datum_cast->MDId());
  + if (is_time_comparison)
  return false;
  + }
  // datums can be compared based on either LINT or Doubles or BYTEA values
  BOOL is_double_comparison = this->IsDatumMappableToDouble() && datum_cast->IsDatumMappableToDouble();
  BOOL is_lint_comparison = this->IsDatumMappableToLINT() && datum_cast->IsDatumMappableToLINT();
  