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
1 change: 1 addition & 0 deletions ydb/core/kqp/executer_actor/kqp_literal_executer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class TKqpLiteralExecuter {
NDqProto::TDqTask protoTask;
protoTask.SetId(task.Id);
protoTask.SetStageId(task.StageId.StageId);
protoTask.SetEnableSpilling(false); // TODO: enable spilling
protoTask.MutableProgram()->CopyFrom(stage.GetProgram()); // it's not good...

TaskId2StageId[task.Id] = task.StageId.StageId;
Expand Down
1 change: 1 addition & 0 deletions ydb/core/kqp/executer_actor/kqp_tasks_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ void SerializeTaskToProto(const TKqpTasksGraph& tasksGraph, const TTask& task, N
result->SetId(task.Id);
result->SetStageId(stageInfo.Id.StageId);
result->SetUseLlvm(task.GetUseLlvm());
result->SetEnableSpilling(false); // TODO: enable spilling
if (task.HasMetaId()) {
result->SetMetaId(task.GetMetaIdUnsafe());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TLocalTaskRunnerActor
, TaskId(taskId)
, InputChannelsWithDisabledCheckpoints(std::move(inputChannelsWithDisabledCheckpoints))
, MemoryQuota(std::move(memoryQuota))
{
{
}

~TLocalTaskRunnerActor()
Expand Down Expand Up @@ -427,16 +427,18 @@ class TLocalTaskRunnerActor
}

TaskRunner->Prepare(settings, ev->Get()->MemoryLimits, *ev->Get()->ExecCtx);

THashMap<ui64, std::pair<NUdf::TUnboxedValue, IDqAsyncInputBuffer::TPtr>> inputTransforms;
for (auto i = 0; i != inputs.size(); ++i) {
if (auto t = TaskRunner->GetInputTransform(i)) {
inputTransforms[i] = *t;
}
}

auto wakeUpCallback = ev->Get()->ExecCtx->GetWakeupCallback();
TaskRunner->SetSpillerFactory(std::make_shared<TDqSpillerFactory>(TxId, NActors::TActivationContext::ActorSystem(), wakeUpCallback));
if (settings.GetEnableSpilling()) {
auto wakeUpCallback = ev->Get()->ExecCtx->GetWakeupCallback();
TaskRunner->SetSpillerFactory(std::make_shared<TDqSpillerFactory>(TxId, NActors::TActivationContext::ActorSystem(), wakeUpCallback));
}

auto event = MakeHolder<TEvTaskRunnerCreateFinished>(
TaskRunner->GetSecureParams(),
Expand Down
1 change: 1 addition & 0 deletions ydb/library/yql/dq/proto/dq_tasks.proto
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,5 @@ message TDqTask {
optional bool UseLlvm = 16;
repeated bytes ReadRanges = 17;
map<string, string> RequestContext = 18;
optional bool EnableSpilling = 19;
}
8 changes: 6 additions & 2 deletions ydb/library/yql/dq/runtime/dq_tasks_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ class TDqTaskSettings {
return Task_->GetRequestContext();
}

bool GetEnableSpilling() const {
return Task_->HasEnableSpilling() && Task_->GetEnableSpilling();
}

private:

// external callback to retrieve parameter value.
Expand Down Expand Up @@ -405,8 +409,8 @@ class IDqTaskRunner : public TSimpleRefCount<IDqTaskRunner>, private TNonCopyabl
};

TIntrusivePtr<IDqTaskRunner> MakeDqTaskRunner(
NKikimr::NMiniKQL::TScopedAlloc& alloc,
const TDqTaskRunnerContext& ctx,
NKikimr::NMiniKQL::TScopedAlloc& alloc,
const TDqTaskRunnerContext& ctx,
const TDqTaskRunnerSettings& settings,
const TLogFunc& logFunc
);
Expand Down
6 changes: 2 additions & 4 deletions ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ using TBase = TComputationValue<TSpillingSupportState<Sort, HasCount>>;
switch (InputStatus = Flow->FetchValues(ctx, GetFields())) {
case EFetchResult::One:
if (Put()) {
if (!HasMemoryForProcessing()) {
if (ctx.SpillerFactory && !HasMemoryForProcessing()) {
SwitchMode(EOperatingMode::Spilling, ctx);
return EFetchResult::Yield;
}
Expand Down Expand Up @@ -562,9 +562,7 @@ using TBase = TComputationValue<TSpillingSupportState<Sort, HasCount>>;
EOperatingMode GetMode() const { return Mode; }

bool HasMemoryForProcessing() const {
// TODO: Change to enable spilling
// return !TlsAllocState->IsMemoryYellowZoneEnabled();
return true;
return !TlsAllocState->IsMemoryYellowZoneEnabled();
}

bool IsReadFromChannelFinished() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ namespace NYql::NDqs {
taskMeta.SetStageId(publicId);
taskDesc.MutableMeta()->PackFrom(taskMeta);
taskDesc.SetStageId(stageId);
taskDesc.SetEnableSpilling(Settings->IsSpillingEnabled());

if (Settings->DisableLLVMForBlockStages.Get().GetOrElse(true)) {
auto& stage = TasksGraph.GetStageInfo(task.StageId).Meta.Stage;
Expand Down