public static boolean shouldIgnoreStatistics(String createdBy, PrimitiveTypeName columnType) {

    if (columnType != PrimitiveTypeName.BINARY && columnType != PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
      // the bug only applies to binary columns
      return false;
    }

    if (Strings.isNullOrEmpty(createdBy)) {
      // created_by is not populated, which could have been caused by
      // parquet-mr during the same time as PARQUET-251, see PARQUET-297
      warnOnce("Ignoring statistics because created_by is null or empty! See PARQUET-251 and PARQUET-297");
      return true;
    }

    try {
      ParsedVersion version = VersionParser.parse(createdBy);

      if (!"parquet-mr".equals(version.application)) {
        // assume other applications don't have this bug
        return false;
      }

      if (Strings.isNullOrEmpty(version.version)) {
        warnOnce("Ignoring statistics because created_by did not contain a semver (see PARQUET-251): "
            + createdBy);
        return true;
      }

      SemanticVersion semver = SemanticVersion.parse(version.version);

      if (semver.compareTo(PARQUET_251_FIXED_VERSION) < 0
          && !(semver.compareTo(CDH_5_PARQUET_251_FIXED_START) >= 0
              && semver.compareTo(CDH_5_PARQUET_251_FIXED_END) < 0)) {
        warnOnce("Ignoring statistics because this file was created prior to "
            + PARQUET_251_FIXED_VERSION
            + ", see PARQUET-251");
        return true;
      }

      // this file was created after the fix
      return false;
    } catch (RuntimeException | SemanticVersionParseException | VersionParseException e) {
      // couldn't parse the created_by field, log what went wrong, don't trust the stats,
      // but don't make this fatal.
      warnParseErrorOnce(createdBy, e);
      return true;
    }
  }
@Test
  public void testDistributionCorruptStatistics() {
    assertTrue(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.0-cdh5.4.999 (build abcd)", PrimitiveTypeName.BINARY));
    assertFalse(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.0-cdh5.5.0-SNAPSHOT (build 956ed6c14c611b4c4eaaa1d6e5b9a9c6d4dfa336)",
        PrimitiveTypeName.BINARY));
    assertFalse(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.0-cdh5.5.0 (build abcd)", PrimitiveTypeName.BINARY));
    assertFalse(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.0-cdh5.5.1 (build abcd)", PrimitiveTypeName.BINARY));
    assertFalse(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.0-cdh5.6.0 (build abcd)", PrimitiveTypeName.BINARY));
    assertTrue(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.4.10 (build abcd)", PrimitiveTypeName.BINARY));
    assertTrue(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.0 (build abcd)", PrimitiveTypeName.BINARY));
    assertTrue(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.5.1 (build abcd)", PrimitiveTypeName.BINARY));
    assertTrue(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.6.0 (build abcd)", PrimitiveTypeName.BINARY));
    assertTrue(CorruptStatistics.shouldIgnoreStatistics(
        "parquet-mr version 1.7.0 (build abcd)", PrimitiveTypeName.BINARY));
  }