java.lang.Object
org.odpi.openmetadata.adapters.connectors.datastore.parquetfile.footer.ParquetStatisticsDecoder

public class ParquetStatisticsDecoder extends Object
ParquetStatisticsDecoder converts the minimum and maximum values that a writer saved in the footer of a Parquet file into Java objects. The class of the object depends on the type of the column:
  • Boolean - for boolean columns;
  • Long - for integer columns;
  • BigInteger - for unsigned 64-bit integer columns;
  • Double - for floating point columns;
  • BigDecimal - for decimal columns;
  • LocalDate - for date columns;
  • LocalTime - for time columns;
  • Instant - for timestamps that are on the UTC timeline;
  • LocalDateTime - for timestamps that have no time zone;
  • String - for everything else: text is returned as is, a UUID in its standard form, and other binary values in hexadecimal.
All of these classes are comparable, and each column only ever produces values of one class, so that values from different row groups can be compared with one another.
  • Method Details

    • usesSignedOrder

      public static boolean usesSignedOrder(ParquetSchemaElement column)
      Return whether the values of a column are ordered using a simple signed comparison. The minimum and maximum values written to the original statistics fields (by writers from before 2017) were always calculated this way, whatever the type of the column. This means they are only correct for these columns.
      Parameters:
      column - description of the column
      Returns:
      boolean
    • decode

      public static Comparable<?> decode(byte[] value, ParquetSchemaElement column)
      Convert a value from the statistics.
      Parameters:
      value - value as stored in the file
      column - description of the column that the value is from
      Returns:
      comparable object, or null if the value is missing or not usable
    • min

      public static Comparable<?> min(Comparable<?> first, Comparable<?> second)
      Return the smaller of two values from the same column.
      Parameters:
      first - value (may be null)
      second - value (may be null)
      Returns:
      the smaller value, or the value that is not null
    • max

      public static Comparable<?> max(Comparable<?> first, Comparable<?> second)
      Return the larger of two values from the same column.
      Parameters:
      first - value (may be null)
      second - value (may be null)
      Returns:
      the larger value, or the value that is not null