aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2022-12-13 17:53:08 +0300
committerilnaz <ilnaz@ydb.tech>2022-12-13 17:53:08 +0300
commit5b7e7374e148b47a23d8b4b4cb8fa08887d10a9b (patch)
treeb4fafaea38793d313ca69c90bfa436d3981afaa5
parentf8bff6b810082c1df1db8097f2d0b3a709eec8e2 (diff)
downloadydb-5b7e7374e148b47a23d8b4b4cb8fa08887d10a9b.tar.gz
Deduplicate tags of indexed & data columns
-rw-r--r--ydb/core/tx/datashard/change_collector_async_index.cpp4
-rw-r--r--ydb/core/tx/datashard/datashard_ut_change_collector.cpp25
2 files changed, 28 insertions, 1 deletions
diff --git a/ydb/core/tx/datashard/change_collector_async_index.cpp b/ydb/core/tx/datashard/change_collector_async_index.cpp
index a5828f9852e..5fb94c3830a 100644
--- a/ydb/core/tx/datashard/change_collector_async_index.cpp
+++ b/ydb/core/tx/datashard/change_collector_async_index.cpp
@@ -30,7 +30,9 @@ public:
}
for (const auto tag : DataTags) {
- tags.push_back(tag);
+ if (!IndexTags.contains(tag)) {
+ tags.push_back(tag);
+ }
}
Y_VERIFY(!tags.empty());
diff --git a/ydb/core/tx/datashard/datashard_ut_change_collector.cpp b/ydb/core/tx/datashard/datashard_ut_change_collector.cpp
index 841d377b402..b6a70d3c3aa 100644
--- a/ydb/core/tx/datashard/datashard_ut_change_collector.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_change_collector.cpp
@@ -554,6 +554,31 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeCollector) {
});
}
+ Y_UNIT_TEST(CoverIndexedColumn) {
+ const auto schema = TShardedTableOptions()
+ .Columns({
+ {"a", "Uint32", true, false},
+ {"b", "Uint32", false, false},
+ {"c", "Uint32", false, false},
+ {"d", "Uint32", false, false},
+ })
+ .Indexes({
+ {"by_bc", {"b", "c"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_d", {"d"}, {"c"}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ });
+
+ Run("/Root/path", schema, TVector<TString>{
+ "UPSERT INTO `/Root/path` (a, b, c, d) VALUES (1, 10, 100, 1000);",
+ }, {
+ {"by_bc", {
+ TStructRecord(NTable::ERowOp::Upsert, {{"b", 10}, {"c", 100}, {"a", 1}}),
+ }},
+ {"by_d", {
+ TStructRecord(NTable::ERowOp::Upsert, {{"d", 1000}, {"a", 1}}, {{"c", 100}}),
+ }},
+ });
+ }
+
} // AsyncIndexChangeCollector
Y_UNIT_TEST_SUITE(CdcStreamChangeCollector) {