Package org.apache.drill.metastore.util
Class TableMetadataUtils
java.lang.Object
org.apache.drill.metastore.util.TableMetadataUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Comparator<T> ReturnsComparatorinstance considering specifiedtype.static <T extends Comparable<T>>
Comparator<T> Returns "natural order" comparator which threads nulls as min values.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 ofColumnStatisticswith columns as keys.static TableMetadataupdateRowCount(TableMetadata tableMetadata, Collection<? extends BaseMetadata> statistics) Updates row count and column nulls count for specified table metadata and returns newTableMetadatainstance with updated statistics.
-
Constructor Details
-
TableMetadataUtils
public TableMetadataUtils()
-
-
Method Details
-
getComparator
ReturnsComparatorinstance considering specifiedtype.- Parameters:
type- type of the column- Returns:
Comparatorinstance
-
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 ofColumnStatisticswith columns as keys.- Type Parameters:
T- type of metadata to collect- Parameters:
metadataList- list of metadata to be mergedcolumns- set of columns whose statistics should be mergedstatisticsToCollect- 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 newTableMetadatainstance with updated statistics.- Parameters:
tableMetadata- table statistics to updatestatistics- list of statistics whose row count should be considered- Returns:
- new
TableMetadatainstance with updated statistics
-