Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class TInputTransformStreamLookupBase
auto [lookupSource, lookupSourceActor] = Factory->CreateDqLookupSource(Settings.GetRightSource().GetProviderName(), std::move(lookupSourceArgs));
MaxKeysInRequest = lookupSource->GetMaxSupportedKeysInRequest();
LookupSourceId = RegisterWithSameMailbox(lookupSourceActor);
KeysForLookup = std::make_shared<IDqAsyncLookupSource::TUnboxedValueMap>(MaxKeysInRequest, KeyTypeHelper->GetValueHash(), KeyTypeHelper->GetValueEqual());
}
protected:
virtual NUdf::EFetchStatus FetchWideInputValue(NUdf::TUnboxedValue* inputRowItems) = 0;
Expand Down Expand Up @@ -132,6 +133,8 @@ class TInputTransformStreamLookupBase
}

void Handle(IDqAsyncLookupSource::TEvLookupResult::TPtr ev) {
if (!KeysForLookup)
return;
auto guard = BindAllocator();
const auto now = std::chrono::steady_clock::now();
auto lookupResult = ev->Get()->Result.lock();
Expand All @@ -147,7 +150,7 @@ class TInputTransformStreamLookupBase
for (auto&& [k, v]: *lookupResult) {
LruCache->Update(NUdf::TUnboxedValue(const_cast<NUdf::TUnboxedValue&&>(k)), std::move(v), now + CacheTtl);
}
KeysForLookup.reset();
KeysForLookup->clear();
Send(ComputeActorId, new TEvNewAsyncInputDataArrived{InputIndex});
}

Expand Down Expand Up @@ -190,11 +193,10 @@ class TInputTransformStreamLookupBase

DrainReadyQueue(batch);

if (InputFlowFetchStatus != NUdf::EFetchStatus::Finish && !KeysForLookup) {
if (InputFlowFetchStatus != NUdf::EFetchStatus::Finish && KeysForLookup->empty()) {
NUdf::TUnboxedValue* inputRowItems;
NUdf::TUnboxedValue inputRow = HolderFactory.CreateDirectArrayHolder(InputRowType->GetElementsCount(), inputRowItems);
const auto now = std::chrono::steady_clock::now();
KeysForLookup = std::make_shared<IDqAsyncLookupSource::TUnboxedValueMap>(MaxKeysInRequest, KeyTypeHelper->GetValueHash(), KeyTypeHelper->GetValueEqual());
LruCache->Prune(now);
while (
(KeysForLookup->size() < MaxKeysInRequest) &&
Expand All @@ -218,8 +220,6 @@ class TInputTransformStreamLookupBase
}
if (!KeysForLookup->empty()) {
Send(LookupSourceId, new IDqAsyncLookupSource::TEvLookupRequest(KeysForLookup));
} else {
KeysForLookup.reset();
}
DrainReadyQueue(batch);
}
Expand Down
Loading