Skip to content

Commit 4da9280

Browse files
authored
Write last record with the same key from batch (#12048)
1 parent 31e0e46 commit 4da9280

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ydb/core/formats/arrow/permutations.cpp

+6-2
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,7 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
24432443
// Cout << "Wait indexation..." << Endl;
24442444
// Sleep(TDuration::Seconds(2));
24452445
// }
2446-
testHelper.ReadData("SELECT * FROM `/Root/ColumnTableTest` WHERE id=2", "[[2;\"test_res_2\";#;[\"val1\"]]]");
2446+
testHelper.ReadData("SELECT * FROM `/Root/ColumnTableTest` WHERE id=2", "[[2;\"test_res_2\";#;[\"val2\"]]]");
24472447
}
24482448

24492449
Y_UNIT_TEST(BulkUpsertUpdate) {

0 commit comments

Comments
 (0)