public boolean validatePatternIfPresent(Retention retention, TableUri tableUri, String schema) {
    if (retention.getColumnPattern() != null) {
      if (retention.getColumnPattern().getColumnName() != null
          && !columnExists(
              getSchemaFromSchemaJson(schema), retention.getColumnPattern().getColumnName())) {
        return false;
      }
      return isPatternValid(retention.getColumnPattern().getPattern(), tableUri);
    }

    return true;
  }
@Test
  void testValidatePatternNegative() {
    RetentionColumnPattern malformedPattern =
        RetentionColumnPattern.builder().pattern("random_pattern").columnName("aa").build();
    Retention testRetention =
        Retention.builder()
            .columnPattern(malformedPattern)
            .count(1)
            .granularity(TimePartitionSpec.Granularity.DAY)
            .build();
    Assertions.assertFalse(
        validator.validatePatternIfPresent(
            testRetention, TableUri.builder().build(), getSchemaJsonFromSchema(dummySchema)));
  }