Search in sources :

Example 1 with UnknownTableTypeException

use of io.trino.plugin.iceberg.UnknownTableTypeException in project trino by trinodb.

the class GlueIcebergTableOperations method getRefreshedLocation.

@Override
protected String getRefreshedLocation() {
    Table table = getTable();
    if (isPrestoView(table.getParameters()) && isHiveOrPrestoView(table.getTableType())) {
        // this is a Presto Hive view, hence not a table
        throw new TableNotFoundException(getSchemaTableName());
    }
    if (!isIcebergTable(table.getParameters())) {
        throw new UnknownTableTypeException(getSchemaTableName());
    }
    String metadataLocation = table.getParameters().get(METADATA_LOCATION_PROP);
    if (metadataLocation == null) {
        throw new TrinoException(ICEBERG_INVALID_METADATA, format("Table is missing [%s] property: %s", METADATA_LOCATION_PROP, getSchemaTableName()));
    }
    return metadataLocation;
}
Also used : TableNotFoundException(io.trino.spi.connector.TableNotFoundException) Table(com.amazonaws.services.glue.model.Table) HiveUtil.isIcebergTable(io.trino.plugin.hive.util.HiveUtil.isIcebergTable) TrinoException(io.trino.spi.TrinoException) UnknownTableTypeException(io.trino.plugin.iceberg.UnknownTableTypeException)

Example 2 with UnknownTableTypeException

use of io.trino.plugin.iceberg.UnknownTableTypeException in project trino by trinodb.

the class AbstractMetastoreTableOperations method getRefreshedLocation.

@Override
protected final String getRefreshedLocation() {
    Table table = getTable();
    if (isPrestoView(table) && isHiveOrPrestoView(table)) {
        // this is a Hive view, hence not a table
        throw new TableNotFoundException(getSchemaTableName());
    }
    if (!isIcebergTable(table)) {
        throw new UnknownTableTypeException(getSchemaTableName());
    }
    String metadataLocation = table.getParameters().get(METADATA_LOCATION_PROP);
    if (metadataLocation == null) {
        throw new TrinoException(ICEBERG_INVALID_METADATA, format("Table is missing [%s] property: %s", METADATA_LOCATION_PROP, getSchemaTableName()));
    }
    return metadataLocation;
}
Also used : TableNotFoundException(io.trino.spi.connector.TableNotFoundException) IcebergUtil.isIcebergTable(io.trino.plugin.iceberg.IcebergUtil.isIcebergTable) Table(io.trino.plugin.hive.metastore.Table) TrinoException(io.trino.spi.TrinoException) UnknownTableTypeException(io.trino.plugin.iceberg.UnknownTableTypeException)

Aggregations

UnknownTableTypeException (io.trino.plugin.iceberg.UnknownTableTypeException)2 TrinoException (io.trino.spi.TrinoException)2 TableNotFoundException (io.trino.spi.connector.TableNotFoundException)2 Table (com.amazonaws.services.glue.model.Table)1 Table (io.trino.plugin.hive.metastore.Table)1 HiveUtil.isIcebergTable (io.trino.plugin.hive.util.HiveUtil.isIcebergTable)1 IcebergUtil.isIcebergTable (io.trino.plugin.iceberg.IcebergUtil.isIcebergTable)1