Package org.apache.drill.metastore.util
Class TableMetadataUtils
java.lang.Object
org.apache.drill.metastore.util.TableMetadataUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Comparator<T>
ReturnsComparator
instance 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 ofColumnStatistics
with columns as keys.static TableMetadata
updateRowCount
(TableMetadata tableMetadata, Collection<? extends BaseMetadata> statistics) Updates row count and column nulls count for specified table metadata and returns newTableMetadata
instance with updated statistics.
-
Constructor Details
-
TableMetadataUtils
public TableMetadataUtils()
-
-
Method Details
-
getComparator
ReturnsComparator
instance considering specifiedtype
.- Parameters:
type
- type of the column- Returns:
Comparator
instance
-
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 ofColumnStatistics
with 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 newTableMetadata
instance with updated statistics.- Parameters:
tableMetadata
- table statistics to updatestatistics
- list of statistics whose row count should be considered- Returns:
- new
TableMetadata
instance with updated statistics
-