forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean useless case for evwrite (ydb-platform#9716)
- Loading branch information
1 parent
0aabe75
commit 7a3a76f
Showing
13 changed files
with
529 additions
and
573 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#include "shard_reader.h" | ||
|
||
namespace NKikimr::NTxUT { | ||
|
||
std::unique_ptr<NKikimr::TEvDataShard::TEvKqpScan> TShardReader::BuildStartEvent() const { | ||
auto ev = std::make_unique<TEvDataShard::TEvKqpScan>(); | ||
ev->Record.SetLocalPathId(PathId); | ||
ev->Record.MutableSnapshot()->SetStep(Snapshot.GetPlanStep()); | ||
ev->Record.MutableSnapshot()->SetTxId(Snapshot.GetTxId()); | ||
|
||
ev->Record.SetStatsMode(NYql::NDqProto::DQ_STATS_MODE_FULL); | ||
ev->Record.SetTxId(Snapshot.GetTxId()); | ||
|
||
ev->Record.SetReverse(Reverse); | ||
ev->Record.SetItemsLimit(Limit); | ||
|
||
ev->Record.SetDataFormat(NKikimrDataEvents::FORMAT_ARROW); | ||
|
||
auto protoRanges = ev->Record.MutableRanges(); | ||
protoRanges->Reserve(Ranges.size()); | ||
for (auto& range : Ranges) { | ||
auto newRange = protoRanges->Add(); | ||
range.Serialize(*newRange); | ||
} | ||
|
||
if (ProgramProto) { | ||
NKikimrSSA::TOlapProgram olapProgram; | ||
{ | ||
TString programBytes; | ||
TStringOutput stream(programBytes); | ||
ProgramProto->SerializeToArcadiaStream(&stream); | ||
olapProgram.SetProgram(programBytes); | ||
} | ||
{ | ||
TString programBytes; | ||
TStringOutput stream(programBytes); | ||
olapProgram.SerializeToArcadiaStream(&stream); | ||
ev->Record.SetOlapProgram(programBytes); | ||
} | ||
ev->Record.SetOlapProgramType(NKikimrSchemeOp::EOlapProgramType::OLAP_PROGRAM_SSA_PROGRAM_WITH_PARAMETERS); | ||
} else if (SerializedProgram) { | ||
ev->Record.SetOlapProgram(*SerializedProgram); | ||
ev->Record.SetOlapProgramType(NKikimrSchemeOp::EOlapProgramType::OLAP_PROGRAM_SSA_PROGRAM_WITH_PARAMETERS); | ||
} | ||
|
||
return ev; | ||
} | ||
|
||
NKikimr::NTxUT::TShardReader& TShardReader::SetReplyColumns(const std::vector<TString>& replyColumns) { | ||
AFL_VERIFY(!SerializedProgram); | ||
if (!ProgramProto) { | ||
ProgramProto = NKikimrSSA::TProgram(); | ||
} | ||
for (auto&& command : *ProgramProto->MutableCommand()) { | ||
if (command.HasProjection()) { | ||
NKikimrSSA::TProgram::TProjection proj; | ||
for (auto&& i : replyColumns) { | ||
proj.AddColumns()->SetName(i); | ||
} | ||
*command.MutableProjection() = proj; | ||
return *this; | ||
} | ||
} | ||
{ | ||
auto* command = ProgramProto->AddCommand(); | ||
NKikimrSSA::TProgram::TProjection proj; | ||
for (auto&& i : replyColumns) { | ||
proj.AddColumns()->SetName(i); | ||
} | ||
*command->MutableProjection() = proj; | ||
} | ||
return *this; | ||
} | ||
|
||
NKikimr::NTxUT::TShardReader& TShardReader::SetReplyColumnIds(const std::vector<ui32>& replyColumnIds) { | ||
AFL_VERIFY(!SerializedProgram); | ||
if (!ProgramProto) { | ||
ProgramProto = NKikimrSSA::TProgram(); | ||
} | ||
for (auto&& command : *ProgramProto->MutableCommand()) { | ||
if (command.HasProjection()) { | ||
NKikimrSSA::TProgram::TProjection proj; | ||
for (auto&& i : replyColumnIds) { | ||
proj.AddColumns()->SetId(i); | ||
} | ||
*command.MutableProjection() = proj; | ||
return *this; | ||
} | ||
} | ||
{ | ||
auto* command = ProgramProto->AddCommand(); | ||
NKikimrSSA::TProgram::TProjection proj; | ||
for (auto&& i : replyColumnIds) { | ||
proj.AddColumns()->SetId(i); | ||
} | ||
*command->MutableProjection() = proj; | ||
} | ||
return *this; | ||
} | ||
|
||
} |
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.