-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate merger logic for make new one (#6931)
- Loading branch information
1 parent
c921a59
commit 0662944
Showing
26 changed files
with
233 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ines/changes/compaction/merge_context.cpp → ...es/changes/compaction/abstract/merger.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "merge_context.h" | ||
#include "merger.h" | ||
|
||
namespace NKikimr::NOlap::NCompaction { | ||
|
||
|
48 changes: 48 additions & 0 deletions
48
ydb/core/tx/columnshard/engines/changes/compaction/abstract/merger.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
#include <ydb/core/tx/columnshard/engines/changes/compaction/common/result.h> | ||
#include <ydb/core/tx/columnshard/engines/changes/compaction/common/context.h> | ||
|
||
namespace NKikimr::NOlap::NCompaction { | ||
class IColumnMerger { | ||
private: | ||
bool Started = false; | ||
|
||
virtual std::vector<TColumnPortionResult> DoExecute( | ||
const NCompaction::TColumnMergeContext& context, const arrow::UInt16Array& pIdxArray, const arrow::UInt32Array& pRecordIdxArray) = 0; | ||
virtual void DoStart(const std::vector<std::shared_ptr<NArrow::NAccessor::IChunkedArray>>& input) = 0; | ||
|
||
public: | ||
static inline const TString PortionIdFieldName = "$$__portion_id"; | ||
static inline const TString PortionRecordIndexFieldName = "$$__portion_record_idx"; | ||
static inline const std::shared_ptr<arrow::Field> PortionIdField = | ||
std::make_shared<arrow::Field>(PortionIdFieldName, std::make_shared<arrow::UInt16Type>()); | ||
static inline const std::shared_ptr<arrow::Field> PortionRecordIndexField = | ||
std::make_shared<arrow::Field>(PortionRecordIndexFieldName, std::make_shared<arrow::UInt32Type>()); | ||
|
||
virtual ~IColumnMerger() = default; | ||
|
||
void Start(const std::vector<std::shared_ptr<NArrow::NAccessor::IChunkedArray>>& input) { | ||
AFL_VERIFY(!Started); | ||
Started = true; | ||
return DoStart(input); | ||
} | ||
|
||
std::vector<TColumnPortionResult> Execute( | ||
const NCompaction::TColumnMergeContext& context, const std::shared_ptr<arrow::RecordBatch>& remap) { | ||
|
||
auto columnPortionIdx = remap->GetColumnByName(IColumnMerger::PortionIdFieldName); | ||
auto columnPortionRecordIdx = remap->GetColumnByName(IColumnMerger::PortionRecordIndexFieldName); | ||
Y_ABORT_UNLESS(columnPortionIdx && columnPortionRecordIdx); | ||
Y_ABORT_UNLESS(columnPortionIdx->type_id() == arrow::UInt16Type::type_id); | ||
Y_ABORT_UNLESS(columnPortionRecordIdx->type_id() == arrow::UInt32Type::type_id); | ||
const arrow::UInt16Array& pIdxArray = static_cast<const arrow::UInt16Array&>(*columnPortionIdx); | ||
const arrow::UInt32Array& pRecordIdxArray = static_cast<const arrow::UInt32Array&>(*columnPortionRecordIdx); | ||
|
||
AFL_VERIFY(remap->num_rows() == pIdxArray.length()); | ||
AFL_VERIFY(remap->num_rows() == pRecordIdxArray.length()); | ||
|
||
return DoExecute(context, pIdxArray, pRecordIdxArray); | ||
} | ||
}; | ||
|
||
} // namespace NKikimr::NOlap::NCompaction |
11 changes: 11 additions & 0 deletions
11
ydb/core/tx/columnshard/engines/changes/compaction/abstract/ya.make
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
LIBRARY() | ||
|
||
SRCS( | ||
merger.cpp | ||
) | ||
|
||
PEERDIR( | ||
ydb/core/tx/columnshard/engines/changes/compaction/common | ||
) | ||
|
||
END() |
5 changes: 5 additions & 0 deletions
5
ydb/core/tx/columnshard/engines/changes/compaction/common/context.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "context.h" | ||
|
||
namespace NKikimr::NOlap::NCompaction { | ||
|
||
} |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
ydb/core/tx/columnshard/engines/changes/compaction/common/result.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "result.h" | ||
#include <util/string/builder.h> | ||
|
||
namespace NKikimr::NOlap::NCompaction { | ||
|
||
TString TColumnPortionResult::DebugString() const { | ||
return TStringBuilder() << "chunks=" << Chunks.size() << ";"; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
ydb/core/tx/columnshard/engines/changes/compaction/common/result.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include <ydb/core/tx/columnshard/splitter/abstract/chunks.h> | ||
|
||
namespace NKikimr::NOlap::NCompaction { | ||
|
||
class TColumnPortionResult { | ||
protected: | ||
std::vector<std::shared_ptr<IPortionDataChunk>> Chunks; | ||
const ui32 ColumnId; | ||
public: | ||
|
||
TColumnPortionResult(const ui32 columnId) | ||
: ColumnId(columnId) { | ||
|
||
} | ||
|
||
const std::vector<std::shared_ptr<IPortionDataChunk>>& GetChunks() const { | ||
return Chunks; | ||
} | ||
|
||
TString DebugString() const; | ||
|
||
}; | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
ydb/core/tx/columnshard/engines/changes/compaction/common/ya.make
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
LIBRARY() | ||
|
||
SRCS( | ||
context.cpp | ||
result.cpp | ||
) | ||
|
||
PEERDIR( | ||
ydb/core/tx/columnshard/engines/scheme | ||
) | ||
|
||
END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.