presto-parquet/src/main/java/io/prestosql/parquet/reader/MetadataReader.java/MetadataReader/tryReadOldUtf8Stats
class MetadataReader:    private static void tryReadOldUtf8Stats(Statistics statistics, BinaryStatistics columnStatistics)
    {
        byte[] min = statistics.getMin();
        byte[] max = statistics.getMax();

        if (Arrays.equals(min, max)) {
            // If min=max, then there is single value only
            min = min.clone();
            max = min;
        }
        else {
            // For min it's enough to retain leading all-ASCII, because this produces a strictly lower value.
            int minFirstNonAsciiOffset = firstOutsideRange(min, 0, 128);
            min = Arrays.copyOf(min, minFirstNonAsciiOffset);

            // For max we chop away everything at the first non-ASCII, then increment last character.
            int maxFirstBadCharacter = firstOutsideRange(max, 0, 127); // last ASCII is also bad because we can't increment it
            if (maxFirstBadCharacter == 0) {
                // We can't help.
                return;
            }
            max[maxFirstBadCharacter - 1]++;
            max = Arrays.copyOf(max, maxFirstBadCharacter);
        }

        columnStatistics.setMinMaxFromBytes(min, max);
        if (!columnStatistics.isNumNullsSet() && statistics.isSetNull_count()) {
            columnStatistics.setNumNulls(statistics.getNull_count());
        }
    }