Search in sources :

Example 11 with PartitionNotExistException

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;
}
Also used : PartitionNotExistException(org.apache.flink.table.catalog.exceptions.PartitionNotExistException) CatalogTableStatistics(org.apache.flink.table.catalog.stats.CatalogTableStatistics)

Example 12 with PartitionNotExistException

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;
}
Also used : PartitionNotExistException(org.apache.flink.table.catalog.exceptions.PartitionNotExistException) CatalogColumnStatistics(org.apache.flink.table.catalog.stats.CatalogColumnStatistics)

Example 13 with PartitionNotExistException

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);
    }
}
Also used : CatalogException(org.apache.flink.table.catalog.exceptions.CatalogException) PartitionNotExistException(org.apache.flink.table.catalog.exceptions.PartitionNotExistException)

Aggregations

PartitionNotExistException (org.apache.flink.table.catalog.exceptions.PartitionNotExistException)13 CatalogException (org.apache.flink.table.catalog.exceptions.CatalogException)7 PartitionSpecInvalidException (org.apache.flink.table.catalog.exceptions.PartitionSpecInvalidException)6 TableNotExistException (org.apache.flink.table.catalog.exceptions.TableNotExistException)6 TException (org.apache.thrift.TException)6 CatalogPartition (org.apache.flink.table.catalog.CatalogPartition)5 Partition (org.apache.hadoop.hive.metastore.api.Partition)5 SqlCreateHiveTable (org.apache.flink.sql.parser.hive.ddl.SqlCreateHiveTable)4 CatalogBaseTable (org.apache.flink.table.catalog.CatalogBaseTable)4 CatalogTable (org.apache.flink.table.catalog.CatalogTable)4 Table (org.apache.hadoop.hive.metastore.api.Table)4 CatalogColumnStatistics (org.apache.flink.table.catalog.stats.CatalogColumnStatistics)3 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)3 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)3 CatalogTableStatistics (org.apache.flink.table.catalog.stats.CatalogTableStatistics)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AlterTableOp (org.apache.flink.sql.parser.hive.ddl.SqlAlterHiveTable.AlterTableOp)1 CatalogPartitionImpl (org.apache.flink.table.catalog.CatalogPartitionImpl)1 CatalogPartitionSpec (org.apache.flink.table.catalog.CatalogPartitionSpec)1