aboutsummaryrefslogtreecommitdiffstats
path: root/yt/yql/plugin/native/progress_merger.h
blob: 3bb5f101d0f70d5cfada0c3424ab8f7b7a3c1b93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include <ydb/library/yql/core/yql_execution.h>
#include <ydb/library/yql/core/progress_merger/progress_merger.h>

#include <library/cpp/yson/writer.h>

namespace NYT::NYqlPlugin {

using namespace NYql::NProgressMerger;
using namespace NYson;

//////////////////////////////////////////////////////////////////////////////

class TNodeProgress : public TNodeProgressBase {
public:
    TNodeProgress(const NYql::TOperationProgress& p);
    void Serialize(::NYson::TYsonWriter& yson) const;
};

//////////////////////////////////////////////////////////////////////////////

class TProgressMerger : public ITaskProgressMerger {
public:
    void MergeWith(const NYql::TOperationProgress& progress) override;
    void AbortAllUnfinishedNodes() override;

    bool HasChangesSinceLastFlush() const;
    TString ToYsonString();

private:
    bool HasChanges_ = false;
    THashMap<ui32, TNodeProgress> NodesMap_;
};

//////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NYqlPlugin