File tree 4 files changed +25
-2
lines changed
ydb/core/tx/columnshard/engines/storage/optimizer/lcbuckets/constructor
4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ bool TOptimizerPlannerConstructor::DoApplyToCurrentObject(IOptimizerPlanner& cur
18
18
bool TOptimizerPlannerConstructor::DoIsEqualTo (const IOptimizerPlannerConstructor& item) const {
19
19
const auto * itemClass = dynamic_cast <const TOptimizerPlannerConstructor*>(&item);
20
20
AFL_VERIFY (itemClass);
21
+ if (Levels.size () != itemClass->Levels .size ()) {
22
+ return false ;
23
+ }
24
+ for (ui32 i = 0 ; i < Levels.size (); ++i) {
25
+ if (!Levels[i]->IsEqualTo (*itemClass->Levels [i].GetObjectPtrVerified ())) {
26
+ return false ;
27
+ }
28
+ }
21
29
return true ;
22
30
}
23
31
@@ -61,8 +69,8 @@ NKikimr::TConclusionStatus TOptimizerPlannerConstructor::DoDeserializeFromJson(c
61
69
if (!level) {
62
70
return TConclusionStatus::Fail (" incorrect level class_name: " + className);
63
71
}
64
- if (!level->DeserializeFromJson (i[ " description " ] )) {
65
- return TConclusionStatus::Fail (" cannot parse level: " + className + " : " + i[ " description " ] .GetStringRobust ());
72
+ if (!level->DeserializeFromJson (i)) {
73
+ return TConclusionStatus::Fail (" cannot parse level: " + i .GetStringRobust ());
66
74
}
67
75
Levels.emplace_back (TLevelConstructorContainer (std::shared_ptr<ILevelConstructor>(level.Release ())));
68
76
}
Original file line number Diff line number Diff line change @@ -12,13 +12,21 @@ class ILevelConstructor {
12
12
virtual TConclusionStatus DoDeserializeFromJson (const NJson::TJsonValue& json) = 0;
13
13
virtual bool DoDeserializeFromProto (const NKikimrSchemeOp::TCompactionLevelConstructorContainer& proto) = 0;
14
14
virtual void DoSerializeToProto (NKikimrSchemeOp::TCompactionLevelConstructorContainer& proto) const = 0;
15
+ virtual bool IsEqualToSameClass (const ILevelConstructor& item) const = 0;
15
16
16
17
public:
17
18
using TFactory = NObjectFactory::TObjectFactory<ILevelConstructor, TString>;
18
19
using TProto = NKikimrSchemeOp::TCompactionLevelConstructorContainer;
19
20
20
21
virtual ~ILevelConstructor () = default ;
21
22
23
+ bool IsEqualTo (const ILevelConstructor& item) const {
24
+ if (GetClassName () != item.GetClassName ()) {
25
+ return false ;
26
+ }
27
+ return IsEqualToSameClass (item);
28
+ }
29
+
22
30
std::shared_ptr<IPortionsLevel> BuildLevel (
23
31
const std::shared_ptr<IPortionsLevel>& nextLevel, const ui32 indexLevel, const TLevelCounters& counters) const {
24
32
return DoBuildLevel (nextLevel, indexLevel, counters);
Original file line number Diff line number Diff line change 5
5
namespace NKikimr ::NOlap::NStorageOptimizer::NLCBuckets {
6
6
7
7
TConclusionStatus TZeroLevelConstructor::DoDeserializeFromJson (const NJson::TJsonValue& json) {
8
+ if (!json.IsMap ()) {
9
+ return TConclusionStatus::Fail (" incorrect level description" );
10
+ }
8
11
if (json.Has (" portions_live_duration" )) {
9
12
const auto & jsonValue = json[" portions_live_duration" ];
10
13
if (!jsonValue.IsString ()) {
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ class TZeroLevelConstructor: public ILevelConstructor {
18
18
virtual TConclusionStatus DoDeserializeFromJson (const NJson::TJsonValue& json) override ;
19
19
virtual bool DoDeserializeFromProto (const NKikimrSchemeOp::TCompactionLevelConstructorContainer& proto) override ;
20
20
virtual void DoSerializeToProto (NKikimrSchemeOp::TCompactionLevelConstructorContainer& proto) const override ;
21
+ virtual bool IsEqualToSameClass (const ILevelConstructor& item) const override {
22
+ const auto & itemCast = dynamic_cast <const TZeroLevelConstructor&>(item);
23
+ return PortionsLiveDuration == itemCast.PortionsLiveDuration && ExpectedBlobsSize == itemCast.ExpectedBlobsSize ;
24
+ }
21
25
22
26
static const inline TFactory::TRegistrator<TZeroLevelConstructor> Registrator = TFactory::TRegistrator<TZeroLevelConstructor>(GetClassNameStatic());
23
27
You can’t perform that action at this time.
0 commit comments