Skip to content

Commit 72eefaa

Browse files
aavdonkinzverevgeny
authored andcommitted
Write last record with the same key from batch (ydb-platform#12048)
1 parent db710b8 commit 72eefaa

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ydb/core/formats/arrow/permutations.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ std::shared_ptr<arrow::UInt64Array> MakeSortPermutation(const std::vector<std::s
4141
}
4242

4343
if (haveNulls) {
44-
std::sort(points.begin(), points.end());
44+
std::sort(points.begin(), points.end(), [](const TRawReplaceKey& a, const TRawReplaceKey& b) {
45+
auto cmp = a <=> b;
46+
return cmp == std::partial_ordering::equivalent ? a.GetPosition() > b.GetPosition() : cmp == std::partial_ordering::less;
47+
});
4548
} else {
4649
std::sort(points.begin(), points.end(), [](const TRawReplaceKey& a, const TRawReplaceKey& b) {
47-
return a.CompareNotNull(b) == std::partial_ordering::less;
50+
auto cmp = a.CompareNotNull(b);
51+
return cmp == std::partial_ordering::equivalent ? a.GetPosition() > b.GetPosition() : cmp == std::partial_ordering::less;
4852
});
4953
}
5054

ydb/core/kqp/ut/olap/kqp_olap_ut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2447,7 +2447,7 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
24472447
// Cout << "Wait indexation..." << Endl;
24482448
// Sleep(TDuration::Seconds(2));
24492449
// }
2450-
testHelper.ReadData("SELECT * FROM `/Root/ColumnTableTest` WHERE id=2", "[[2;\"test_res_2\";#;[\"val1\"]]]");
2450+
testHelper.ReadData("SELECT * FROM `/Root/ColumnTableTest` WHERE id=2", "[[2;\"test_res_2\";#;[\"val2\"]]]");
24512451
}
24522452

24532453
Y_UNIT_TEST(BulkUpsertUpdate) {

0 commit comments

Comments
 (0)