use of org.apache.flink.table.catalog.stats.CatalogColumnStatistics in project flink by apache.
the class GenericInMemoryCatalog method getPartitionColumnStatistics.
@Override
public CatalogColumnStatistics getPartitionColumnStatistics(ObjectPath tablePath, CatalogPartitionSpec partitionSpec) throws PartitionNotExistException {
checkNotNull(tablePath);
checkNotNull(partitionSpec);
if (!partitionExists(tablePath, partitionSpec)) {
throw new PartitionNotExistException(getName(), tablePath, partitionSpec);
}
CatalogColumnStatistics result = partitionColumnStats.get(tablePath).get(partitionSpec);
return result != null ? result.copy() : CatalogColumnStatistics.UNKNOWN;
}
use of org.apache.flink.table.catalog.stats.CatalogColumnStatistics in project flink by apache.
the class DatabaseCalciteSchema method extractTableStats.
private TableStats extractTableStats(ContextResolvedTable lookupResult, ObjectIdentifier identifier) {
if (lookupResult.isTemporary()) {
return TableStats.UNKNOWN;
}
final Catalog catalog = lookupResult.getCatalog().orElseThrow(IllegalStateException::new);
final ObjectPath tablePath = identifier.toObjectPath();
try {
final CatalogTableStatistics tableStatistics = catalog.getTableStatistics(tablePath);
final CatalogColumnStatistics columnStatistics = catalog.getTableColumnStatistics(tablePath);
return convertToTableStats(tableStatistics, columnStatistics);
} catch (TableNotExistException e) {
throw new ValidationException(format("Could not get statistic for table: [%s, %s, %s]", identifier.getCatalogName(), tablePath.getDatabaseName(), tablePath.getObjectName()), e);
}
}
Aggregations