Search in sources :

Example 1 with Encoding

use of org.apache.parquet.format.Encoding in project parquet-mr by apache.

the class ParquetMetadataConverter method fromFormatEncodings.

// Visible for testing
Set<org.apache.parquet.column.Encoding> fromFormatEncodings(List<Encoding> encodings) {
    Set<org.apache.parquet.column.Encoding> converted = new HashSet<org.apache.parquet.column.Encoding>();
    for (Encoding encoding : encodings) {
        converted.add(getEncoding(encoding));
    }
    // make converted unmodifiable, drop reference to modifiable copy
    converted = Collections.unmodifiableSet(converted);
    // atomically update the cache
    Set<org.apache.parquet.column.Encoding> cached = cachedEncodingSets.putIfAbsent(converted, converted);
    if (cached == null) {
        // cached == null signifies that converted was *not* in the cache previously
        // so we can return converted instead of throwing it away, it has now
        // been cached
        cached = converted;
    }
    return cached;
}
Also used : Encoding(org.apache.parquet.format.Encoding) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 Encoding (org.apache.parquet.format.Encoding)1