-
Notifications
You must be signed in to change notification settings - Fork 737
YQ-2068 use HashMap for lookup request and result #5594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YQ-2068 use HashMap for lookup request and result #5594
Conversation
|
⚪ |
|
⚪ |
|
⚪ |
| ~TEvLookupRequest() { | ||
| auto guard = Guard(*Alloc); | ||
| Keys = NKikimr::NMiniKQL::TUnboxedValueVector{}; | ||
| Request = TUnboxedValueMap{0, {{}, false, nullptr}, {{}, false, nullptr}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в чем ценность такой сложной конструкции? почему нельзя написать Request = {} ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Упростил. Request = {} писать нельзя, т.к. не дефолтных конструкторов у TValueHasher и TValueEqual
ydb/library/yql/providers/generic/actors/ut/yql_generic_lookup_actor_ut.cpp
Outdated
Show resolved
Hide resolved
| auto& [k, v] = lookupResult[1]; | ||
| UNIT_ASSERT_EQUAL(1, k.GetElement(0).Get<ui64>()); | ||
| UNIT_ASSERT_EQUAL(101, k.GetElement(1).Get<ui64>()); | ||
| } else UNIT_ASSERT(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давай избавимся от этих UNIT_ASSERT(false) и излишних ветвлений. мне такой стиль тяжело читать
вот так легче:
auto v = lookupResult->FindPtr(....);
UNIT_ASSERT(v);
NYql::NUdf::TUnboxedValue val = v->GetElement(0);
UNIT_ASSERT(val.AsStringRef() == TStringBuf("a"));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
переписал
| UNIT_ASSERT_EQUAL(0, k.GetElement(0).Get<ui64>()); | ||
| UNIT_ASSERT_EQUAL(100, k.GetElement(1).Get<ui64>()); | ||
| if (const auto* v = lookupResult->FindPtr(CreateStructValue(holderFactory, {0, 100}))) { | ||
| NYql::NUdf::TUnboxedValue val = v.GetElement(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v - это же указатель вроде. почему тут v., а не v-> ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
переписал это место
ydb/library/yql/providers/generic/actors/yql_generic_lookup_actor.cpp
Outdated
Show resolved
Hide resolved
| } | ||
| void AsyncLookup(const NKikimr::NMiniKQL::TUnboxedValueVector& keys) override { | ||
| void AsyncLookup(IDqAsyncLookupSource::TUnboxedValueMap&& request) override { | ||
| auto guard = Guard(*Alloc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guard выглядит бесполезным тут
| auto ev = new NDq::IDqAsyncLookupSource::TEvLookupRequest(Alloc, std::move(KeysToLookUp)); | ||
| auto ev = new NDq::IDqAsyncLookupSource::TEvLookupRequest(Alloc, std::move(Request)); | ||
| TActivationContext::ActorSystem()->Send(new NActors::IEventHandle(LookupActor, SelfId(), ev)); | ||
| auto guard = Guard(*Alloc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guard выглядит бесполезным
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
удалил
| YQL_CLOG(DEBUG, ProviderYt) << "ActorId=" << SelfId() << " Got LookupRequest for " << request.size() << " keys"; | ||
| Y_ABORT_IF(InProgress); | ||
| Y_ABORT_IF(keys.size() > MaxKeysInRequest); | ||
| Y_ABORT_IF(request.size() > MaxKeysInRequest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давай тут не падать, лучше исключение бросить
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это контракт, выраженный в коде. Трансформер сначала должен запросить у lookup актора максимально поддерживаемое кол-во ключей, а потом запрашивать не больше этого значения
33f69f5 to
e32188e
Compare
|
⚪
|
|
⚪
|
|
⚪
|
|
⚪
|
No description provided.