use of org.apache.flink.table.catalog.exceptions.PartitionNotExistException in project flink by apache.
the class GenericInMemoryCatalog method getPartitionStatistics.
@Override
public CatalogTableStatistics getPartitionStatistics(ObjectPath tablePath, CatalogPartitionSpec partitionSpec) throws PartitionNotExistException {
checkNotNull(tablePath);
checkNotNull(partitionSpec);
if (!partitionExists(tablePath, partitionSpec)) {
throw new PartitionNotExistException(getName(), tablePath, partitionSpec);
}
CatalogTableStatistics result = partitionStats.get(tablePath).get(partitionSpec);
return result != null ? result.copy() : CatalogTableStatistics.UNKNOWN;
}
use of org.apache.flink.table.catalog.exceptions.PartitionNotExistException 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.exceptions.PartitionNotExistException in project flink by apache.
the class GenericInMemoryCatalog method alterPartition.
@Override
public void alterPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition newPartition, boolean ignoreIfNotExists) throws PartitionNotExistException, CatalogException {
checkNotNull(tablePath);
checkNotNull(partitionSpec);
checkNotNull(newPartition);
if (partitionExists(tablePath, partitionSpec)) {
CatalogPartition existingPartition = partitions.get(tablePath).get(partitionSpec);
if (existingPartition.getClass() != newPartition.getClass()) {
throw new CatalogException(String.format("Partition types don't match. Existing partition is '%s' and new partition is '%s'.", existingPartition.getClass().getName(), newPartition.getClass().getName()));
}
partitions.get(tablePath).put(partitionSpec, newPartition.copy());
} else if (!ignoreIfNotExists) {
throw new PartitionNotExistException(getName(), tablePath, partitionSpec);
}
}
Aggregations