Class Metrics

java.lang.Object
org.apache.iceberg.Metrics
All Implemented Interfaces:
Serializable

public class Metrics extends Object implements Serializable
Iceberg file format metrics.
See Also:
  • Constructor Details

    • Metrics

      public Metrics()
      Creates an empty metrics instance with no statistics set.
    • Metrics

      public Metrics(long rowCount)
      Creates a new metrics instance with only the row count set.
      Parameters:
      rowCount - the number of rows (records) in the file
    • Metrics

      public Metrics(Long rowCount, Map<Integer,Long> columnSizes, Map<Integer,Long> valueCounts, Map<Integer,Long> nullValueCounts, Map<Integer,Long> nanValueCounts)
      Creates a new metrics instance.
      Parameters:
      rowCount - the number of rows (records) in the file, or null if unknown
      columnSizes - a map of field id to the size in bytes of the column, or null if unknown
      valueCounts - a map of field id to the number of all values (including nulls, NaN, and repeated), or null if unknown
      nullValueCounts - a map of field id to the number of null values, or null if unknown
      nanValueCounts - a map of field id to the number of NaN values, or null if unknown
    • Metrics

      public Metrics(Long rowCount, Map<Integer,Long> columnSizes, Map<Integer,Long> valueCounts, Map<Integer,Long> nullValueCounts, Map<Integer,Long> nanValueCounts, Map<Integer,ByteBuffer> lowerBounds, Map<Integer,ByteBuffer> upperBounds)
      Creates a new metrics instance.
      Parameters:
      rowCount - the number of rows (records) in the file, or null if unknown
      columnSizes - a map of field id to the size in bytes of the column, or null if unknown
      valueCounts - a map of field id to the number of all values (including nulls, NaN, and repeated), or null if unknown
      nullValueCounts - a map of field id to the number of null values, or null if unknown
      nanValueCounts - a map of field id to the number of NaN values, or null if unknown
      lowerBounds - a map of field id to the lower bound of the column, or null if unknown
      upperBounds - a map of field id to the upper bound of the column, or null if unknown
    • Metrics

      public Metrics(Long rowCount, Map<Integer,Long> columnSizes, Map<Integer,Long> valueCounts, Map<Integer,Long> nullValueCounts, Map<Integer,Long> nanValueCounts, Map<Integer,ByteBuffer> lowerBounds, Map<Integer,ByteBuffer> upperBounds, Map<Integer,Type> originalTypes)
      Creates a new metrics instance.
      Parameters:
      rowCount - the number of rows (records) in the file, or null if unknown
      columnSizes - a map of field id to the size in bytes of the column, or null if unknown
      valueCounts - a map of field id to the number of all values (including nulls, NaN, and repeated), or null if unknown
      nullValueCounts - a map of field id to the number of null values, or null if unknown
      nanValueCounts - a map of field id to the number of NaN values, or null if unknown
      lowerBounds - a map of field id to the lower bound of the column, or null if unknown
      upperBounds - a map of field id to the upper bound of the column, or null if unknown
      originalTypes - a map of field id to the original type of the lower/upper bound, or null if unknown
    • Metrics

      public Metrics(Long rowCount, Map<Integer,Long> columnSizes, Map<Integer,Long> valueCounts, Map<Integer,Long> nullValueCounts, Map<Integer,Long> nanValueCounts, Map<Integer,ByteBuffer> lowerBounds, Map<Integer,ByteBuffer> upperBounds, Map<Integer,Integer> avgValueSizes, Map<Integer,Type> originalTypes)
      Creates a new metrics instance.
      Parameters:
      rowCount - the number of rows (records) in the file, or null if unknown
      columnSizes - a map of field id to the size in bytes of the column, or null if unknown
      valueCounts - a map of field id to the number of all values (including nulls, NaN, and repeated), or null if unknown
      nullValueCounts - a map of field id to the number of null values, or null if unknown
      nanValueCounts - a map of field id to the number of NaN values, or null if unknown
      lowerBounds - a map of field id to the lower bound of the column, or null if unknown
      upperBounds - a map of field id to the upper bound of the column, or null if unknown
      avgValueSizes - a map of field id to the average size in bytes of the column's non-null values, or null if unknown
      originalTypes - a map of field id to the original type of the lower/upper bound, or null if unknown
  • Method Details

    • recordCount

      public Long recordCount()
      Get the number of records (rows) in file.
      Returns:
      the count of records (rows) in the file as a long
    • columnSizes

      public Map<Integer,Long> columnSizes()
      Get the number of bytes for all fields in a file.
      Returns:
      a Map of fieldId to the size in bytes
    • valueCounts

      public Map<Integer,Long> valueCounts()
      Get the number of all values, including nulls, NaN and repeated.
      Returns:
      a Map of fieldId to the number of all values including nulls, NaN and repeated
    • nullValueCounts

      public Map<Integer,Long> nullValueCounts()
      Get the number of null values for all fields in a file.
      Returns:
      a Map of fieldId to the number of nulls
    • nanValueCounts

      public Map<Integer,Long> nanValueCounts()
      Get the number of NaN values for all float and double fields in a file.
      Returns:
      a Map of fieldId to the number of NaN counts
    • lowerBounds

      public Map<Integer,ByteBuffer> lowerBounds()
      Get the non-null lower bound values for all fields in a file.

      To convert the ByteBuffer back to a value, use Conversions.fromByteBuffer(org.apache.iceberg.types.Type, java.nio.ByteBuffer).

      Returns:
      a Map of fieldId to the lower bound value as a ByteBuffer
      See Also:
    • upperBounds

      public Map<Integer,ByteBuffer> upperBounds()
      Get the non-null upper bound values for all fields in a file.
      Returns:
      a Map of fieldId to the upper bound value as a ByteBuffer
    • avgValueSizes

      public Map<Integer,Integer> avgValueSizes()
      Get the average value size in memory (uncompressed) in bytes over non-null values, for all fields where it was collected.
      Returns:
      a Map of fieldId to average value size in bytes