summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Uzhakov <[email protected]>2022-05-11 19:43:53 +0300
committerSergey Uzhakov <[email protected]>2022-05-11 19:43:53 +0300
commit271c9e869b66ba94ad0f51197f3d54a56bcdc0d7 (patch)
treec24ce207d3304da125d84511aeea994030106a33
parente29cb39f3c27852ff1fc4dfc6dfc30f09e2d9b79 (diff)
DQ-28: remove dependency on ydb/core/tablet_flat
ref:276d9118eaf400deb4d60d31fc78663328ccba9c
-rw-r--r--ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp28
-rw-r--r--ydb/library/yql/dq/actors/compute/CMakeLists.txt2
-rw-r--r--ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h8
3 files changed, 16 insertions, 22 deletions
diff --git a/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp b/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp
index 7395b148c37..249a9e3d184 100644
--- a/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp
+++ b/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp
@@ -953,32 +953,28 @@ private:
}
private:
- struct TScanFreeSpace : public IDestructable {
- ui64 FreeSpace = 0;
- };
-
- THolder<IDestructable> GetSourcesState() override {
- if (ScanData) {
- auto state = MakeHolder<TScanFreeSpace>();
- state->FreeSpace = GetMemoryLimits().ScanBufferSize > ScanData->GetStoredBytes()
+ ui64 CalculateFreeSpace() const {
+ return GetMemoryLimits().ScanBufferSize > ScanData->GetStoredBytes()
? GetMemoryLimits().ScanBufferSize - ScanData->GetStoredBytes()
: 0ul;
- return state;
+ }
+
+ std::any GetSourcesState() override {
+ if (ScanData) {
+ return CalculateFreeSpace();
}
- return nullptr;
+ return {};
}
- void PollSources(THolder<IDestructable> prev) override {
- if (!prev || !ScanData || Shards.empty()) {
+ void PollSources(std::any prev) override {
+ if (!prev.has_value() || !ScanData || Shards.empty()) {
return;
}
auto& state = Shards.front();
- ui64 freeSpace = GetMemoryLimits().ScanBufferSize > ScanData->GetStoredBytes()
- ? GetMemoryLimits().ScanBufferSize - ScanData->GetStoredBytes()
- : 0ul;
- ui64 prevFreeSpace = static_cast<TScanFreeSpace*>(prev.Get())->FreeSpace;
+ const ui64 freeSpace = CalculateFreeSpace();
+ const ui64 prevFreeSpace = std::any_cast<ui64>(prev);
CA_LOG_T("Scan over tablet " << state.TabletId << " finished: " << ScanData->IsFinished()
<< ", prevFreeSpace: " << prevFreeSpace << ", freeSpace: " << freeSpace << ", peer: " << state.ActorId);
diff --git a/ydb/library/yql/dq/actors/compute/CMakeLists.txt b/ydb/library/yql/dq/actors/compute/CMakeLists.txt
index 43d32f8394d..32461c2c33e 100644
--- a/ydb/library/yql/dq/actors/compute/CMakeLists.txt
+++ b/ydb/library/yql/dq/actors/compute/CMakeLists.txt
@@ -17,8 +17,6 @@ target_link_libraries(dq-actors-compute PUBLIC
cpp-actors-core
ydb-core-base
ydb-core-protos
- ydb-core-scheme
- ydb-core-tablet_flat
yql-dq-common
yql-dq-proto
yql-dq-runtime
diff --git a/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h b/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h
index fe03f32735a..983922b3aa7 100644
--- a/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h
+++ b/ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h
@@ -8,9 +8,7 @@
#include "dq_compute_issues_buffer.h"
#include "dq_compute_memory_quota.h"
-#include <ydb/core/scheme/scheme_tabledefs.h> // TODO: TTableId
#include <ydb/core/base/kikimr_issue.h>
-#include <ydb/core/tablet_flat/util_basics.h> // TODO: IDestructable
#include <ydb/core/protos/services.pb.h>
#include <ydb/library/yql/dq/actors/protos/dq_events.pb.h>
@@ -27,6 +25,8 @@
#include <util/string/join.h>
#include <util/system/hostname.h>
+#include <any>
+
#if defined CA_LOG_D || defined CA_LOG_I || defined CA_LOG_E || defined CA_LOG_C
# error log macro definition clash
#endif
@@ -758,11 +758,11 @@ protected:
protected:
// virtual methods (TODO: replace with static_cast<TDerived*>(this)->Foo()
- virtual THolder<NKikimr::IDestructable> GetSourcesState() {
+ virtual std::any GetSourcesState() {
return nullptr;
}
- virtual void PollSources(THolder<NKikimr::IDestructable> /* state */) {
+ virtual void PollSources(std::any /* state */) {
}
virtual void TerminateSources(const TIssues& /* issues */, bool /* success */) {