Update the Avro scanner bad version header error message to include the file.

This makes cases like IMPALA-2402 much easier to diagnose, since this
message will mostly occur if Impala tries to read a file that's not an
Avro data file.

Change-Id: I6504e668905ecc6964b77a6fe0cfc9c7511fd5c0
Reviewed-on: http://gerrit.cloudera.org:8080/1202
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: Internal Jenkins
This commit is contained in:
Skye Wanderman-Milne
2015-10-07 15:00:32 -07:00
committed by Harrison Sheinblatt
parent c0c4f0f36f
commit e4d12931dd
2 changed files with 5 additions and 4 deletions

View File

@@ -79,10 +79,8 @@ Status HdfsAvroScanner::ReadFileHeader() {
RETURN_IF_FALSE(stream_->ReadBytes(
sizeof(AVRO_VERSION_HEADER), &header, &parse_status_));
if (memcmp(header, AVRO_VERSION_HEADER, sizeof(AVRO_VERSION_HEADER))) {
stringstream ss;
ss << "Invalid AVRO_VERSION_HEADER: '"
<< ReadWriteUtil::HexDump(header, sizeof(AVRO_VERSION_HEADER)) << "'";
return Status(ss.str());
return Status(TErrorCode::AVRO_BAD_VERSION_HEADER,
stream_->filename(), ReadWriteUtil::HexDump(header, sizeof(AVRO_VERSION_HEADER)));
}
// Decode relevant metadata (encoded as Avro map)

View File

@@ -197,6 +197,9 @@ error_codes = (
("SCANNER_INVALID_READ", 63, "Invalid read of $0 bytes. This may indicate data file "
"corruption. (file $1, byte offset: $2)"),
("AVRO_BAD_VERSION_HEADER", 64, "File '$0' has an invalid version header: $1\\n"
"Make sure the file is an Avro data file."),
)
import sys