Search in sources :

Example 1 with NotFoundException

use of com.facebook.presto.spi.NotFoundException in project presto by prestodb.

the class CassandraMetadata method listTableColumns.

@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix) {
    requireNonNull(prefix, "prefix is null");
    ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
    for (SchemaTableName tableName : listTables(session, prefix)) {
        try {
            columns.put(tableName, getTableMetadata(session, tableName).getColumns());
        } catch (NotFoundException e) {
        // table disappeared during listing operation
        }
    }
    return columns.build();
}
Also used : NotFoundException(com.facebook.presto.spi.NotFoundException) SchemaNotFoundException(com.facebook.presto.spi.SchemaNotFoundException) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) SchemaTableName(com.facebook.presto.spi.SchemaTableName) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 2 with NotFoundException

use of com.facebook.presto.spi.NotFoundException in project presto by prestodb.

the class MongoMetadata method listTableColumns.

@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix) {
    requireNonNull(prefix, "prefix is null");
    ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
    for (SchemaTableName tableName : listTables(session, prefix)) {
        try {
            columns.put(tableName, getTableMetadata(session, tableName).getColumns());
        } catch (NotFoundException e) {
        // table disappeared during listing operation
        }
    }
    return columns.build();
}
Also used : NotFoundException(com.facebook.presto.spi.NotFoundException) TableNotFoundException(com.facebook.presto.spi.TableNotFoundException) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) SchemaTableName(com.facebook.presto.spi.SchemaTableName) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

NotFoundException (com.facebook.presto.spi.NotFoundException)2 SchemaTableName (com.facebook.presto.spi.SchemaTableName)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 List (java.util.List)2 Collectors.toList (java.util.stream.Collectors.toList)2 SchemaNotFoundException (com.facebook.presto.spi.SchemaNotFoundException)1 TableNotFoundException (com.facebook.presto.spi.TableNotFoundException)1