[improvement](multi-catalog) return root cause of exception (#14708)
This commit is contained in:
@ -556,4 +556,14 @@ public class Util {
|
||||
logger.warn(msg, e);
|
||||
throw new RuntimeException(msg, e);
|
||||
}
|
||||
|
||||
public static String getRootCauseMessage(Throwable t) {
|
||||
String rootCause = "unknown";
|
||||
Throwable p = t;
|
||||
while (p != null) {
|
||||
rootCause = p.getClass().getName() + ": " + p.getMessage();
|
||||
p = p.getCause();
|
||||
}
|
||||
return rootCause;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ package org.apache.doris.datasource;
|
||||
|
||||
import org.apache.doris.catalog.Column;
|
||||
import org.apache.doris.common.Config;
|
||||
import org.apache.doris.common.util.Util;
|
||||
import org.apache.doris.metric.GaugeMetric;
|
||||
import org.apache.doris.metric.Metric;
|
||||
import org.apache.doris.metric.MetricLabel;
|
||||
@ -89,7 +90,8 @@ public class ExternalSchemaCache {
|
||||
try {
|
||||
return schemaCache.get(key);
|
||||
} catch (ExecutionException e) {
|
||||
throw new CacheException("failed to get schema for %s in catalog %s", e, key, catalog.getName());
|
||||
throw new CacheException("failed to get schema for %s in catalog %s. err: %s",
|
||||
e, key, catalog.getName(), Util.getRootCauseMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ import org.apache.doris.common.DdlException;
|
||||
import org.apache.doris.common.FeConstants;
|
||||
import org.apache.doris.common.MetaNotFoundException;
|
||||
import org.apache.doris.common.UserException;
|
||||
import org.apache.doris.common.util.Util;
|
||||
import org.apache.doris.datasource.HMSExternalCatalog;
|
||||
import org.apache.doris.datasource.hive.HiveMetaStoreCache;
|
||||
import org.apache.doris.datasource.hive.HiveMetaStoreCache.HivePartitionValues;
|
||||
@ -188,7 +189,9 @@ public class HiveScanProvider extends HMSTableScanProvider {
|
||||
return allFiles;
|
||||
} catch (Throwable t) {
|
||||
LOG.warn("get file split failed for table: {}", hmsTable.getName(), t);
|
||||
throw new UserException("get file split failed for table: " + hmsTable.getName(), t);
|
||||
throw new UserException(
|
||||
"get file split failed for table: " + hmsTable.getName() + ", err: " + Util.getRootCauseMessage(t),
|
||||
t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user