Class TableMetadataUtils

java.lang.Object
org.apache.drill.metastore.util.TableMetadataUtils

public class TableMetadataUtils extends Object
  • Constructor Details

    • TableMetadataUtils

      public TableMetadataUtils()
  • Method Details

    • getComparator

      public static <T> Comparator<T> getComparator(TypeProtos.MinorType type)
      Returns Comparator instance considering specified type.
      Parameters:
      type - type of the column
      Returns:
      Comparator instance
    • getNaturalNullsFirstComparator

      public static <T extends Comparable<T>> Comparator<T> getNaturalNullsFirstComparator()
      Returns "natural order" comparator which threads nulls as min values.
      Type Parameters:
      T - type to compare
      Returns:
      "natural order" comparator
    • mergeColumnsStatistics

      public static <T extends BaseMetadata> Map<SchemaPath,ColumnStatistics<?>> mergeColumnsStatistics(Collection<T> metadataList, Set<SchemaPath> columns, List<CollectableColumnStatisticsKind<?>> statisticsToCollect)
      Merges list of specified metadata into the map of ColumnStatistics with columns as keys.
      Type Parameters:
      T - type of metadata to collect
      Parameters:
      metadataList - list of metadata to be merged
      columns - set of columns whose statistics should be merged
      statisticsToCollect - kinds of statistics that should be collected
      Returns:
      list of merged metadata
    • updateRowCount

      public static TableMetadata updateRowCount(TableMetadata tableMetadata, Collection<? extends BaseMetadata> statistics)
      Updates row count and column nulls count for specified table metadata and returns new TableMetadata instance with updated statistics.
      Parameters:
      tableMetadata - table statistics to update
      statistics - list of statistics whose row count should be considered
      Returns:
      new TableMetadata instance with updated statistics