Skip to content

Commit

Permalink
Refine usage of HIVE_FILESYSTEM_ERROR
Browse files Browse the repository at this point in the history
Be consistent about using HIVE_FILESYSTEM_ERROR to denote errors
accessing the filesystem, rather than reading from datanodes.
  • Loading branch information
cberner committed Jan 29, 2016
1 parent a9af194 commit c2f2e18
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -20,7 +20,8 @@

import java.io.IOException;

import static com.facebook.presto.hive.HiveErrorCode.HIVE_FILESYSTEM_ERROR;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_MISSING_DATA;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_UNKNOWN_ERROR;
import static java.lang.String.format;

public class HdfsOrcDataSource
Expand Down Expand Up @@ -53,7 +54,11 @@ protected void readInternal(long position, byte[] buffer, int bufferOffset, int
throw e;
}
catch (Exception e) {
throw new PrestoException(HIVE_FILESYSTEM_ERROR, format("HDFS error reading from %s at position %s", this, position), e);
String message = format("HDFS error reading from %s at position %s", this, position);
if (e.getClass().getSimpleName().equals("BlockMissingException")) {
throw new PrestoException(HIVE_MISSING_DATA, message, e);
}
throw new PrestoException(HIVE_UNKNOWN_ERROR, message, e);
}
}
}

0 comments on commit c2f2e18

Please sign in to comment.