Skip to content

BATCH UPDATE/DELETE queries for per row updates with NoTx #13340

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

Merged
merged 35 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7664edf
multitable check for per row
dahbka-lis Jan 9, 2025
0b04ec5
add error for per row with test
dahbka-lis Jan 10, 2025
feefdb2
Test for delete per row multistatement
dahbka-lis Jan 13, 2025
ab11e7a
check multistatement with tests
dahbka-lis Jan 13, 2025
952e534
rename per row -> batch + decompose intersection check
dahbka-lis Jan 15, 2025
53d6b93
add IsBatch to TKqpTableSinkSettings
dahbka-lis Jan 20, 2025
ed43f0d
Merge branch 'ydb-platform:main' into per-row-update-delete
dahbka-lis Jan 20, 2025
481bf48
rm optional=true for IsBatch
dahbka-lis Jan 20, 2025
7aba58f
upsert/delete/tableSinkSettings new parameters cnt
dahbka-lis Jan 20, 2025
c00ab27
add primary key params for batch query filters
dahbka-lis Jan 22, 2025
1676677
Merge branch 'ydb-platform:main' into per-row-update-delete
dahbka-lis Feb 3, 2025
46b4a69
add IsBatch to proto settings
dahbka-lis Jan 28, 2025
a641f52
add bool param for a first query
dahbka-lis Jan 28, 2025
49a87aa
add a new param is_inclusive
dahbka-lis Jan 29, 2025
55914a1
defaut type value for partitioned
dahbka-lis Feb 3, 2025
93adc47
create a new partitioned executer
dahbka-lis Feb 3, 2025
d1d1631
Merge branch 'ydb-platform:main' into per-row-update-delete
dahbka-lis Feb 3, 2025
2b1d814
add includes
dahbka-lis Feb 3, 2025
32cb5c3
new creating
dahbka-lis Feb 4, 2025
f29b4f8
new constants for batch params
dahbka-lis Feb 12, 2025
1ae735f
new handles + move constants
dahbka-lis Feb 12, 2025
dbeac92
add partitions cnt + generic errors
dahbka-lis Feb 12, 2025
94d835d
Merge branch 'main' into per-row-update-delete
dahbka-lis Feb 12, 2025
ca5adf4
lost comma
dahbka-lis Feb 12, 2025
7c32c46
annotate sink setting args
dahbka-lis Feb 12, 2025
306437a
fix unpack sink settings bug
dahbka-lis Feb 12, 2025
3364d13
add aborts
dahbka-lis Feb 13, 2025
e0d25d1
handle messages
dahbka-lis Feb 14, 2025
9dd3fa8
Merge branch 'ydb-platform:main' into per-row-update-delete
dahbka-lis Feb 14, 2025
9f0f5ce
new names for params + enable isBatch
dahbka-lis Feb 17, 2025
e57def7
new features
dahbka-lis Feb 19, 2025
e09a017
Merge branch 'main' into per-row-update-delete
dahbka-lis Feb 19, 2025
8b67a40
add flag for batch updates
dahbka-lis Feb 20, 2025
7903483
fixes after review
dahbka-lis Feb 20, 2025
1e6baa1
Merge branch 'ydb-platform:main' into per-row-update-delete
dahbka-lis Feb 20, 2025
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
15 changes: 15 additions & 0 deletions ydb/core/kqp/common/batch/params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <util/generic/fwd.h>

namespace NKikimr::NKqp::NBatchParams {

const TString Header = "$_kqp_batch_";
const TString IsFirstQuery = Header + "is_first_query";
const TString IsLastQuery = Header + "is_last_query";
const TString IsInclusiveLeft = Header + "is_inclusive_left";
const TString IsInclusiveRight = Header + "is_inclusive_right";
const TString Begin = Header + "begin_"; // begin_N
const TString End = Header + "end_"; // end_N

} // namespace NKikimr::NKqp::NPartitionedExecuter
53 changes: 53 additions & 0 deletions ydb/core/kqp/common/kqp_resolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,59 @@ using namespace NMiniKQL;
using namespace NYql;
using namespace NYql::NNodes;

NUdf::TUnboxedValue MakeDefaultValueByType(const NKikimr::NMiniKQL::TType* type) {
auto dataType = static_cast<const NKikimr::NMiniKQL::TDataType*>(type);
switch (dataType->GetSchemeType()) {
case NUdf::TDataType<bool>::Id:
return NUdf::TUnboxedValuePod(false);
case NUdf::TDataType<ui8>::Id:
case NUdf::TDataType<i8>::Id:
case NUdf::TDataType<ui16>::Id:
case NUdf::TDataType<i16>::Id:
case NUdf::TDataType<i32>::Id:
case NUdf::TDataType<NUdf::TDate32>::Id:
case NUdf::TDataType<ui32>::Id:
case NUdf::TDataType<i64>::Id:
case NUdf::TDataType<NUdf::TDatetime64>::Id:
case NUdf::TDataType<NUdf::TTimestamp64>::Id:
case NUdf::TDataType<NUdf::TInterval64>::Id:
case NUdf::TDataType<ui64>::Id:
case NUdf::TDataType<float>::Id:
case NUdf::TDataType<double>::Id:
case NUdf::TDataType<NUdf::TDate>::Id:
case NUdf::TDataType<NUdf::TDatetime>::Id:
case NUdf::TDataType<NUdf::TTimestamp>::Id:
case NUdf::TDataType<NUdf::TInterval>::Id:
return NUdf::TUnboxedValuePod(0);
case NUdf::TDataType<NUdf::TJson>::Id:
case NUdf::TDataType<NUdf::TUtf8>::Id:
case NUdf::TDataType<NUdf::TJsonDocument>::Id:
case NUdf::TDataType<NUdf::TDyNumber>::Id:
return NKikimr::NMiniKQL::MakeString("");
case NUdf::TDataType<NUdf::TTzDate>::Id:
case NUdf::TDataType<NUdf::TTzDatetime>::Id:
case NUdf::TDataType<NUdf::TTzTimestamp>::Id:
case NUdf::TDataType<NUdf::TTzDate32>::Id:
case NUdf::TDataType<NUdf::TTzDatetime64>::Id:
case NUdf::TDataType<NUdf::TTzTimestamp64>::Id: {
return NUdf::TUnboxedValuePod(ValueFromString(NUdf::GetDataSlot(dataType->GetSchemeType()), ""));
}
case NUdf::TDataType<NUdf::TDecimal>::Id:
return NUdf::TUnboxedValuePod(NYql::NDecimal::FromHalfs(0, 0));
case NUdf::TDataType<NUdf::TUuid>::Id: {
union {
ui64 half[2];
char bytes[16];
} buf;
buf.half[0] = 0;
buf.half[1] = 0;
return NKikimr::NMiniKQL::MakeString(NUdf::TStringRef(buf.bytes, 16));
}
default:
return NKikimr::NMiniKQL::MakeString("");
}
}

TVector<TCell> MakeKeyCells(const NKikimr::NUdf::TUnboxedValue& value, const TVector<NScheme::TTypeInfo>& keyColumnTypes,
const TVector<ui32>& keyColumnIndices, const NMiniKQL::TTypeEnvironment& typeEnv, bool copyValues)
{
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/kqp/common/kqp_resolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <ydb/core/tx/scheme_cache/scheme_cache.h>

#include <yql/essentials/minikql/mkql_node.h>
#include <yql/essentials/minikql/mkql_string_util.h>

#include <util/generic/map.h>

Expand Down Expand Up @@ -232,6 +233,8 @@ class TKqpTableKeys {
THashMap<TTableId, TTable> TablesById;
};

NUdf::TUnboxedValue MakeDefaultValueByType(const NKikimr::NMiniKQL::TType* type);

TVector<TCell> MakeKeyCells(const NKikimr::NUdf::TUnboxedValue& value, const TVector<NScheme::TTypeInfo>& keyColumnTypes,
const TVector<ui32>& keyColumnIndices, const NMiniKQL::TTypeEnvironment& typeEnv, bool copyValues);

Expand Down
Loading
Loading