Merge pull request #54336 from arenadata/ADQM-1157

Used assert_cast instead of dynamic_cast in ExternalDataSourceCache
This commit is contained in:
robot-ch-test-poll1 2023-09-06 08:28:21 +02:00 committed by GitHub
commit d9746b5ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ LocalFileHolder::~LocalFileHolder()
{
if (original_readbuffer)
{
dynamic_cast<SeekableReadBuffer *>(original_readbuffer.get())->seek(0, SEEK_SET);
assert_cast<SeekableReadBuffer *>(original_readbuffer.get())->seek(0, SEEK_SET);
file_cache_controller->value().startBackgroundDownload(std::move(original_readbuffer), *thread_pool);
}
}
@ -122,7 +122,7 @@ off_t RemoteReadBuffer::seek(off_t offset, int whence)
{
if (local_file_holder->original_readbuffer)
{
auto ret = dynamic_cast<SeekableReadBuffer *>(local_file_holder->original_readbuffer.get())->seek(offset, whence);
auto ret = assert_cast<SeekableReadBuffer *>(local_file_holder->original_readbuffer.get())->seek(offset, whence);
BufferBase::set(
local_file_holder->original_readbuffer->buffer().begin(),
local_file_holder->original_readbuffer->buffer().size(),
@ -147,7 +147,7 @@ off_t RemoteReadBuffer::getPosition()
{
if (local_file_holder->original_readbuffer)
{
return dynamic_cast<SeekableReadBuffer *>(local_file_holder->original_readbuffer.get())->getPosition();
return assert_cast<SeekableReadBuffer *>(local_file_holder->original_readbuffer.get())->getPosition();
}
return local_file_holder->file_buffer->getPosition();
}