use of com.netflix.metacat.common.server.connectors.exception.InvalidMetadataException in project metacat by Netflix.
the class DruidConnectorTableService method get.
/**
* {@inheritDoc}
*/
@Override
public TableInfo get(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name) {
log.debug("Get table metadata for qualified name {} for request {}", name, context);
try {
final ObjectNode node = this.druidClient.getLatestDataByName(name.getTableName());
final DataSource dataSource = DruidConverterUtil.getDatasourceFromLatestSegmentJsonObject(node);
return this.druidConnectorInfoConverter.getTableInfoFromDatasource(dataSource);
} catch (MetacatException e) {
log.error(String.format("Table %s not found.", name), e);
throw new TableNotFoundException(name);
} catch (HttpClientErrorException e) {
log.error(String.format("Failed getting table %s.", name), e);
if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) {
throw new TableNotFoundException(name);
} else {
throw new InvalidMetadataException(String.format("Invalid table %s. %s", name, e.getMessage()));
}
}
}
Aggregations