mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 03:25:15 +00:00
Properly handle empty parts list
This commit is contained in:
parent
594195451e
commit
be64b45583
@ -9,11 +9,17 @@
|
||||
#include <Processors/QueryPlan/BuildQueryPipelineSettings.h>
|
||||
#include <QueryPipeline/QueryPipelineBuilder.h>
|
||||
#include <Core/Defines.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
/// A Storage that allows reading from a single MergeTree data part.
|
||||
class StorageFromMergeTreeDataPart final : public IStorage
|
||||
{
|
||||
@ -103,19 +109,21 @@ public:
|
||||
|
||||
bool materializeTTLRecalculateOnly() const
|
||||
{
|
||||
if (parts.empty())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "parts must not be empty for materializeTTLRecalculateOnly");
|
||||
return parts.front()->storage.getSettings()->materialize_ttl_recalculate_only;
|
||||
}
|
||||
|
||||
bool hasLightweightDeletedMask() const override
|
||||
{
|
||||
return parts.front()->hasLightweightDelete();
|
||||
return !parts.empty() && parts.front()->hasLightweightDelete();
|
||||
}
|
||||
|
||||
private:
|
||||
MergeTreeData::DataPartsVector parts;
|
||||
const MergeTreeData::DataPartsVector parts;
|
||||
const MergeTreeData & storage;
|
||||
String partition_id;
|
||||
MergeTreeDataSelectAnalysisResultPtr analysis_result_ptr;
|
||||
const String partition_id;
|
||||
const MergeTreeDataSelectAnalysisResultPtr analysis_result_ptr;
|
||||
|
||||
static StorageID getIDFromPart(const MergeTreeData::DataPartPtr & part_)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user