use of org.apache.iceberg.exceptions.NotFoundException in project metacat by Netflix.
the class IcebergTableHandler method getIcebergTable.
/**
* get iceberg table.
*
* @param tableName table name
* @param tableMetadataLocation table metadata location
* @param includeInfoDetails if true, will include more details like the manifest file content
* @return iceberg table
*/
public IcebergTableWrapper getIcebergTable(final QualifiedName tableName, final String tableMetadataLocation, final boolean includeInfoDetails) {
final long start = this.registry.clock().wallTime();
try {
this.icebergTableCriteria.checkCriteria(tableName, tableMetadataLocation);
log.debug("Loading icebergTable {} from {}", tableName, tableMetadataLocation);
final IcebergMetastoreTables icebergMetastoreTables = new IcebergMetastoreTables(new IcebergTableOps(conf, tableMetadataLocation, connectorContext.getConfig(), icebergTableOpsProxy));
final Table table = icebergMetastoreTables.loadTable(HiveTableUtil.qualifiedNameToTableIdentifier(tableName));
final Map<String, String> extraProperties = Maps.newHashMap();
if (includeInfoDetails) {
extraProperties.put(DirectSqlTable.PARAM_METADATA_CONTENT, TableMetadataParser.toJson(icebergMetastoreTables.getTableOps().current()));
}
return new IcebergTableWrapper(table, extraProperties);
} catch (NotFoundException | NoSuchTableException e) {
throw new InvalidMetaException(tableName, e);
} finally {
final long duration = registry.clock().wallTime() - start;
log.info("Time taken to getIcebergTable {} is {} ms", tableName, duration);
this.recordTimer(IcebergRequestMetrics.TagLoadTable.getMetricName(), duration);
this.increaseCounter(IcebergRequestMetrics.TagLoadTable.getMetricName(), tableName);
}
}
Aggregations