Skip to content

Commit

Permalink
[native] Fix crash in PrestoTask::updateExecutionInfoLocked
Browse files Browse the repository at this point in the history
  • Loading branch information
arhimondr committed Jan 16, 2025
1 parent fa090fc commit bb7426b
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions presto-native-execution/presto_cpp/main/PrestoTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,20 +795,26 @@ void PrestoTask::updateExecutionInfoLocked(
}
for (int i = 0; i < veloxTaskStats.pipelineStats.size(); ++i) {
auto& veloxPipeline = veloxTaskStats.pipelineStats[i];
if (veloxPipeline.inputPipeline) {
const auto& firstVeloxOpStats = veloxPipeline.operatorStats[0];
prestoTaskStats.rawInputPositions += firstVeloxOpStats.rawInputPositions;
prestoTaskStats.rawInputDataSizeInBytes +=
firstVeloxOpStats.rawInputBytes;
prestoTaskStats.processedInputPositions +=
firstVeloxOpStats.inputPositions;
prestoTaskStats.processedInputDataSizeInBytes +=
firstVeloxOpStats.inputBytes;
}
if (veloxPipeline.outputPipeline) {
const auto& lastVeloxOpStats = veloxPipeline.operatorStats.back();
prestoTaskStats.outputPositions += lastVeloxOpStats.outputPositions;
prestoTaskStats.outputDataSizeInBytes += lastVeloxOpStats.outputBytes;

// tasks may fail before any operators are created;
// collect stats only when we have operators
if (!veloxPipeline.operatorStats.empty()) {
if (veloxPipeline.inputPipeline) {
const auto& firstVeloxOpStats = veloxPipeline.operatorStats[0];
prestoTaskStats.rawInputPositions +=
firstVeloxOpStats.rawInputPositions;
prestoTaskStats.rawInputDataSizeInBytes +=
firstVeloxOpStats.rawInputBytes;
prestoTaskStats.processedInputPositions +=
firstVeloxOpStats.inputPositions;
prestoTaskStats.processedInputDataSizeInBytes +=
firstVeloxOpStats.inputBytes;
}
if (veloxPipeline.outputPipeline) {
const auto& lastVeloxOpStats = veloxPipeline.operatorStats.back();
prestoTaskStats.outputPositions += lastVeloxOpStats.outputPositions;
prestoTaskStats.outputDataSizeInBytes += lastVeloxOpStats.outputBytes;
}
}

for (auto j = 0; j < veloxPipeline.operatorStats.size(); ++j) {
Expand Down

0 comments on commit bb7426b

Please sign in to comment.