[bugfix](tvf)catch exception for fetching SchemaTableData #34856

This commit is contained in:
wuwenchi
2024-05-14 23:40:13 +08:00
committed by yiguolei
parent 0b4d814598
commit bd41341a97
2 changed files with 17 additions and 9 deletions

View File

@ -72,6 +72,9 @@ public class IcebergMetadataCache {
public List<Snapshot> getSnapshotList(TIcebergMetadataParams params) throws UserException {
CatalogIf catalog = Env.getCurrentEnv().getCatalogMgr().getCatalog(params.getCatalog());
if (catalog == null) {
throw new UserException("The specified catalog does not exist:" + params.getCatalog());
}
IcebergMetadataCacheKey key =
IcebergMetadataCacheKey.of(catalog, params.getDatabase(), params.getTable());
return snapshotListCache.get(key);

View File

@ -2303,15 +2303,20 @@ public class FrontendServiceImpl implements FrontendService.Iface {
@Override
public TFetchSchemaTableDataResult fetchSchemaTableData(TFetchSchemaTableDataRequest request) throws TException {
if (!request.isSetSchemaTableName()) {
return MetadataGenerator.errorResult("Fetch schema table name is not set");
}
// tvf queries
if (request.getSchemaTableName() == TSchemaTableName.METADATA_TABLE) {
return MetadataGenerator.getMetadataTable(request);
} else {
// database information_schema's tables
return MetadataGenerator.getSchemaTableData(request);
try {
if (!request.isSetSchemaTableName()) {
return MetadataGenerator.errorResult("Fetch schema table name is not set");
}
// tvf queries
if (request.getSchemaTableName() == TSchemaTableName.METADATA_TABLE) {
return MetadataGenerator.getMetadataTable(request);
} else {
// database information_schema's tables
return MetadataGenerator.getSchemaTableData(request);
}
} catch (Exception e) {
LOG.warn("Failed to fetchSchemaTableData", e);
return MetadataGenerator.errorResult(e.getMessage());
}
}