-
Notifications
You must be signed in to change notification settings - Fork 610
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
Allow UPDATE ON, UPSERT with partial set of input... #894
Allow UPDATE ON, UPSERT with partial set of input... #894
Conversation
columns in case of unique index. Example: table: pk, fk1, fk2. Uniq index: fk1, fk2. To perform UPSERT INTO table (pk, fk1) we need to read missed value fk2 from main table to create lookup uniq index key. Right now we have two lookups in to main table - first one has been described above - second we need to make to remove old value from index. It will be fixed in a next step.
Note This is an automated comment that will be appended during run. 🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit a882c95.
🔴 linux-x86_64-release-asan: some tests FAILED for commit a882c95.
|
@@ -77,7 +77,6 @@ TMaybe<TCondenseInputResult> CondenseInput(const TExprBase& input, TExprContext& | |||
TVector<TCoArgument> stageArguments; | |||
|
|||
if (IsDqPureExpr(input)) { | |||
YQL_ENSURE(input.Ref().GetTypeAnn()->GetKind() == ETypeAnnotationKind::List, "" << input.Ref().Dump()); |
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.
А что там если не List?
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.
Там про использовании CondenseInput из сложных оптимайзеров, еще type анотация не прошла. Оно просто тут сегфолтится
.Done(); | ||
|
||
TExprNode::TPtr keys; | ||
|
||
if (fixLookupKeys) { |
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.
Добавь плз комментарий, что значит fixLookupKeys, но очевидно.
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.
ага. Продублирую тут
// we need to left only table key columns to perform lookup
// unfortunately we can't do it inside lookup stage
usedIndexes.insert(indexDesc->Name); | ||
break; | ||
if (inputColumns.contains(indexKeyCol)) { | ||
if (!usedIndexes.contains(indexDesc->Name) && |
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.
we can omit !usedIndexes.contains(indexDesc->Name)
check, the code will work the same
Build<TCoNameValueTuple>(ctx, pos) | ||
.Name().Build(x) | ||
.Value<TCoNothing>() | ||
.OptionalType(NCommon::BuildTypeExpr(pos, *columnType, ctx)) |
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.
I guess this does not work for Pg types, we'll need to somehow construct a pg null here (it corresponds to an empty TUnboxedValuePod
with correct type)
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.
Oh... And make sure we just return correct error in case of not null... Next pr?
columns in case of unique index.
Example:
table: pk, fk1, fk2. Uniq index: fk1, fk2.
To perform UPSERT INTO table (pk, fk1) we
need to read missed value fk2 from main table to
create lookup uniq index key.
Right now we have two lookups in to main table