Skip to content

fix compaction intervals construction #7176

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
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 28 additions & 8 deletions ydb/core/formats/arrow/reader/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class TSortableBatchPosition {
class TIntervalPosition {
private:
TSortableBatchPosition Position;
const bool LeftIntervalInclude;
bool LeftIntervalInclude;
public:
const TSortableBatchPosition& GetPosition() const {
return Position;
Expand Down Expand Up @@ -458,21 +458,41 @@ class TIntervalPositions {
return Positions.end();
}

void AddPosition(TSortableBatchPosition&& position, const bool includeLeftInterval) {
TIntervalPosition intervalPosition(std::move(position), includeLeftInterval);
if (Positions.size()) {
AFL_VERIFY(Positions.back() < intervalPosition)("back", Positions.back().DebugJson())("pos", intervalPosition.DebugJson());
}
void InsertPosition(TIntervalPosition&& intervalPosition) {
Positions.emplace_back(std::move(intervalPosition));
ui32 index = Positions.size() - 1;
while (index >= 1 && Positions[index] < Positions[index - 1]) {
std::swap(Positions[index], Positions[index - 1]);
index = index - 1;
}
}

void InsertPosition(TSortableBatchPosition&& position, const bool includePositionToLeftInterval) {
TIntervalPosition intervalPosition(std::move(position), includePositionToLeftInterval);
InsertPosition(std::move(intervalPosition));
}

void AddPosition(const TSortableBatchPosition& position, const bool includeLeftInterval) {
TIntervalPosition intervalPosition(position, includeLeftInterval);
void InsertPosition(const TSortableBatchPosition& position, const bool includePositionToLeftInterval) {
TIntervalPosition intervalPosition(position, includePositionToLeftInterval);
InsertPosition(std::move(intervalPosition));
}

void AddPosition(TIntervalPosition&& intervalPosition) {
if (Positions.size()) {
AFL_VERIFY(Positions.back() < intervalPosition)("back", Positions.back().DebugJson())("pos", intervalPosition.DebugJson());
}
Positions.emplace_back(std::move(intervalPosition));
}

void AddPosition(TSortableBatchPosition&& position, const bool includePositionToLeftInterval) {
TIntervalPosition intervalPosition(std::move(position), includePositionToLeftInterval);
AddPosition(std::move(intervalPosition));
}

void AddPosition(const TSortableBatchPosition& position, const bool includePositionToLeftInterval) {
TIntervalPosition intervalPosition(position, includePositionToLeftInterval);
AddPosition(std::move(intervalPosition));
}
};

class TRWSortableBatchPosition: public TSortableBatchPosition, public TMoveOnly {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ NColumnShard::ECumulativeCounters TGeneralCompactColumnEngineChanges::GetCounter

void TGeneralCompactColumnEngineChanges::AddCheckPoint(
const NArrow::NMerger::TSortableBatchPosition& position, const bool include) {
CheckPoints.AddPosition(position, include);
CheckPoints.InsertPosition(position, include);
}

std::shared_ptr<TGeneralCompactColumnEngineChanges::IMemoryPredictor> TGeneralCompactColumnEngineChanges::BuildMemoryPredictor() {
Expand Down
Loading