Skip to content

Commit

Permalink
Merge pull request ClickHouse#58537 from sunny19930321/fix/hive-threa…
Browse files Browse the repository at this point in the history
…dpool-query

Fix hive threadpool read ORC/Parquet/... Failed
  • Loading branch information
Avogar authored Jan 16, 2024
2 parents 7d03ccd + 8c8f7c8 commit 74973c1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Storages/Hive/StorageHive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,27 @@ class StorageHiveSource : public ISource, WithContext
{
auto get_raw_read_buf = [&]() -> std::unique_ptr<ReadBuffer>
{
auto buf = std::make_unique<ReadBufferFromHDFS>(
hdfs_namenode_url,
current_path,
getContext()->getGlobalContext()->getConfigRef(),
getContext()->getReadSettings());

bool thread_pool_read = read_settings.remote_fs_method == RemoteFSReadMethod::threadpool;
if (thread_pool_read)
{
auto buf = std::make_unique<ReadBufferFromHDFS>(
hdfs_namenode_url,
current_path,
getContext()->getGlobalContext()->getConfigRef(),
getContext()->getReadSettings(),
/* read_until_position */0,
/* use_external_buffer */true);

return std::make_unique<AsynchronousReadBufferFromHDFS>(
getThreadPoolReader(FilesystemReaderType::ASYNCHRONOUS_REMOTE_FS_READER), read_settings, std::move(buf));
}
else
{
return buf;
return std::make_unique<ReadBufferFromHDFS>(
hdfs_namenode_url,
current_path,
getContext()->getGlobalContext()->getConfigRef(),
getContext()->getReadSettings());
}
};

Expand Down

0 comments on commit 74973c1

Please sign in to comment.