mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Better
This commit is contained in:
parent
111fb4b8a9
commit
1be9371fb5
@ -91,9 +91,8 @@ inline HadoopSnappyDecoder::Status HadoopSnappyDecoder::readCompressedLength(siz
|
||||
{
|
||||
auto status = readLength(avail_in, next_in, &compressed_length);
|
||||
if (unlikely(compressed_length > 0 && static_cast<size_t>(compressed_length) > sizeof(buffer)))
|
||||
throw Exception(ErrorCodes::SNAPPY_UNCOMPRESS_FAILED,
|
||||
"Too large snappy compressed block. buffer size: {}, compressed block size: {}",
|
||||
sizeof(buffer), compressed_length);
|
||||
return Status::TOO_LARGE_COMPRESSED_BLOCK;
|
||||
|
||||
return status;
|
||||
}
|
||||
return Status::OK;
|
||||
@ -225,7 +224,7 @@ bool HadoopSnappyReadBuffer::nextImpl()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (decoder->result == Status::INVALID_INPUT || decoder->result == Status::BUFFER_TOO_SMALL)
|
||||
else if (decoder->result != Status::NEEDS_MORE_INPUT)
|
||||
{
|
||||
throw Exception(
|
||||
ErrorCodes::SNAPPY_UNCOMPRESS_FAILED,
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
INVALID_INPUT = 1,
|
||||
BUFFER_TOO_SMALL = 2,
|
||||
NEEDS_MORE_INPUT = 3,
|
||||
TOO_LARGE_COMPRESSED_BLOCK = 4,
|
||||
};
|
||||
|
||||
HadoopSnappyDecoder() = default;
|
||||
@ -84,6 +85,8 @@ public:
|
||||
return "BUFFER_TOO_SMALL";
|
||||
case Status::NEEDS_MORE_INPUT:
|
||||
return "NEEDS_MORE_INPUT";
|
||||
case Status::TOO_LARGE_COMPRESSED_BLOCK:
|
||||
return "TOO_LARGE_COMPRESSED_BLOCK";
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ String getExceptionEntryWithFileName(const ReadBuffer & in)
|
||||
if (filename.empty())
|
||||
return "";
|
||||
|
||||
return "; While reading from: " + filename;
|
||||
return fmt::format("; While reading from: {}", filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user