Fix error categorization for Hive split loader
@@ -65,9 +65,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.IntPredicate;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_BAD_DATA;
+import static com.facebook.presto.hive.HiveErrorCode.HIVE_FILESYSTEM_ERROR;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_INVALID_BUCKET_FILES;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_INVALID_METADATA;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_INVALID_PARTITION_VALUE;
+import static com.facebook.presto.hive.HiveErrorCode.HIVE_UNKNOWN_ERROR;
import static com.facebook.presto.hive.HiveSessionProperties.isForceLocalScheduling;
import static com.facebook.presto.hive.HiveUtil.checkCondition;
import static com.facebook.presto.hive.HiveUtil.getFooterCount;
@@ -183,6 +185,12 @@ public class BackgroundHiveSplitLoader
future = loadSplits();
}
catch (Exception e) {
+ if (e instanceof IOException) {
+ e = new PrestoException(HIVE_FILESYSTEM_ERROR, e);
+ }
+ else if (!(e instanceof PrestoException)) {
+ e = new PrestoException(HIVE_UNKNOWN_ERROR, e);
+ }
// Fail the split source before releasing the execution lock
// Otherwise, a race could occur where the split source is completed before we fail it.
hiveSplitSource.fail(e);
