Skip to content

Commit 6ce6393

Browse files
committed
fix
1 parent 8d1822b commit 6ce6393

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

ydb/core/scheme/scheme_ranges_ut.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,24 @@ Y_UNIT_TEST_SUITE(SchemeRanges) {
115115
}
116116

117117
UNIT_ASSERT_EQUAL((CompareBorders<true, true>(b10, b10, true, true, types)), 0);
118-
UNIT_ASSERT_EQUAL((CompareBorders<true, true>(b10, b10, false, true, types)), 1);
119-
UNIT_ASSERT_EQUAL((CompareBorders<true, true>(b10, b10, true, false, types)), -1);
118+
UNIT_ASSERT_EQUAL((CompareBorders<true, true>(b10, b10, false, true, types)), -1);
119+
UNIT_ASSERT_EQUAL((CompareBorders<true, true>(b10, b10, true, false, types)), 1);
120120
UNIT_ASSERT_EQUAL((CompareBorders<true, true>(b10, b10, false, false, types)), 0);
121121

122122
UNIT_ASSERT_EQUAL((CompareBorders<false, false>(b10, b10, true, true, types)), 0);
123-
UNIT_ASSERT_EQUAL((CompareBorders<false, false>(b10, b10, false, true, types)), -1);
124-
UNIT_ASSERT_EQUAL((CompareBorders<false, false>(b10, b10, true, false, types)), 1);
123+
UNIT_ASSERT_EQUAL((CompareBorders<false, false>(b10, b10, false, true, types)), 1);
124+
UNIT_ASSERT_EQUAL((CompareBorders<false, false>(b10, b10, true, false, types)), -1);
125125
UNIT_ASSERT_EQUAL((CompareBorders<false, false>(b10, b10, false, false, types)), 0);
126126

127127
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, true, true, types)), 0);
128-
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, false, true, types)), 1);
129-
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, true, false, types)), 1);
130-
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, false, false, types)), 1);
128+
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, false, true, types)), -1);
129+
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, true, false, types)), -1);
130+
UNIT_ASSERT_EQUAL((CompareBorders<true, false>(b10, b10, false, false, types)), -1);
131131

132132
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, true, true, types)), 0);
133-
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, false, true, types)), -1);
134-
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, true, false, types)), -1);
135-
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, false, false, types)), -1);
133+
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, false, true, types)), 1);
134+
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, true, false, types)), 1);
135+
UNIT_ASSERT_EQUAL((CompareBorders<false, true>(b10, b10, false, false, types)), 1);
136136
}
137137
}
138138

ydb/core/scheme/scheme_tabledefs.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,19 +333,19 @@ int CompareBorders(TConstArrayRef<TCell> first, TConstArrayRef<TCell> second, bo
333333
if (FirstLeft && SecondLeft) {
334334
if (inclusiveFirst == inclusiveSecond)
335335
return 0;
336-
return (inclusiveFirst ? -1 : 1);
336+
return (inclusiveFirst ? 1 : -1);
337337
} else if (FirstLeft && !SecondLeft) {
338338
if (inclusiveFirst && inclusiveSecond)
339339
return 0;
340-
return 1;
340+
return -1;
341341
} else if (!FirstLeft && SecondLeft) {
342342
if (inclusiveFirst && inclusiveSecond)
343343
return 0;
344-
return -1;
344+
return 1;
345345
} else { // !FirstLeft && !SecondLeft
346346
if (inclusiveFirst == inclusiveSecond)
347347
return 0;
348-
return (inclusiveFirst ? 1 : -1);
348+
return (inclusiveFirst ? -1 : 1);
349349
}
350350
}
351351

@@ -356,12 +356,12 @@ inline int CompareRanges(const TTableRange& rangeX, const TTableRange& rangeY,
356356
Y_ABORT_UNLESS(!rangeX.Point);
357357
Y_ABORT_UNLESS(!rangeY.Point);
358358

359-
int xStart_yEnd = CompareBorders<true, false>(
359+
int xStart_yEnd = CompareBorders<false, true>(
360360
rangeX.From, rangeY.To, rangeX.InclusiveFrom, rangeY.InclusiveTo, types);
361361
if (xStart_yEnd > 0)
362362
return 1;
363363

364-
int xEnd_yStart = CompareBorders<false, true>(
364+
int xEnd_yStart = CompareBorders<true, false>(
365365
rangeX.To, rangeY.From, rangeX.InclusiveTo, rangeY.InclusiveFrom, types);
366366
if (xEnd_yStart < 0)
367367
return -1;

0 commit comments

Comments
 (0)