Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/Storages/Hive/StorageHiveCluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <Parsers/ASTCreateQuery.h>
#include <Parsers/queryToString.h>
#include <Processors/Sources/RemoteSource.h>
#include <Processors/QueryPlan/QueryPlan.h>
#include <QueryPipeline/RemoteQueryExecutor.h>
#include <Storages/AlterCommands.h>
#include <Storages/Hive/HiveSettings.h>
Expand All @@ -25,6 +26,7 @@ namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int BAD_ARGUMENTS;
extern const int NOT_IMPLEMENTED;
}

StorageHiveCluster::StorageHiveCluster(
Expand Down Expand Up @@ -55,7 +57,8 @@ StorageHiveCluster::StorageHiveCluster(
setInMemoryMetadata(storage_metadata);
}

Pipe StorageHiveCluster::read(
void StorageHiveCluster::read(
QueryPlan & query_plan_,
const Names & column_names_,
const StorageSnapshotPtr & metadata_snapshot_,
SelectQueryInfo & query_info_,
Expand Down Expand Up @@ -128,7 +131,8 @@ Pipe StorageHiveCluster::read(
}
}
metadata_snapshot_->check(column_names_);
return Pipe::unitePipes(std::move(pipes));
readFromPipe(query_plan_, Pipe::unitePipes(std::move(pipes)), column_names_, metadata_snapshot_, query_info_, context_, getName());
return;
}

auto files_collector_ref = HiveSourceCollectorFactory::instance().getCollector(policy_name);
Expand All @@ -154,7 +158,7 @@ Pipe StorageHiveCluster::read(
auto local_storage_settings = std::make_unique<HiveSettings>();
local_storage_settings->applyChanges(*storage_settings);
auto metadata_snapshot = getInMemoryMetadataPtr();
local_hive_storage = std::make_shared<StorageHive>(
auto local_hive_storage = std::make_shared<StorageHive>(
hive_metastore_url,
hive_database,
hive_table,
Expand All @@ -167,8 +171,9 @@ Pipe StorageHiveCluster::read(
context_,
std::make_shared<HiveSourceFilesCollectorBuilder>(files_collector_builder),
true);

return local_hive_storage->read(column_names_, metadata_snapshot_, query_info_, context_, processed_stage_, max_block_size_, num_streams_);
query_plan_.addStorageHolder(local_hive_storage);
auto pipe = local_hive_storage->read(column_names_, metadata_snapshot_, query_info_, context_, processed_stage_, max_block_size_, num_streams_);
readFromPipe(query_plan_, std::move(pipe), column_names_, metadata_snapshot_, query_info_, context_, getName());
}

QueryProcessingStage::Enum StorageHiveCluster::getQueryProcessingStage(
Expand Down
4 changes: 2 additions & 2 deletions src/Storages/Hive/StorageHiveCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class StorageHiveCluster : public IStorage, WithContext

bool isRemote() const override { return true; }

Pipe read(
void read(
QueryPlan & query_plan_,
const Names & column_names_,
const StorageSnapshotPtr & metadata_snapshot_,
SelectQueryInfo & query_info_,
Expand All @@ -69,7 +70,6 @@ class StorageHiveCluster : public IStorage, WithContext
String hive_metastore_url;
String hive_database;
String hive_table;
std::shared_ptr<StorageHive> local_hive_storage;

const ASTPtr partition_by_ast;

Expand Down