Skip to content
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

fix bug in DAGBlockOutputStream #230

Merged
merged 1 commit into from
Sep 10, 2019
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
10 changes: 4 additions & 6 deletions dbms/src/Flash/Coprocessor/DAGBlockOutputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ DAGBlockOutputStream::DAGBlockOutputStream(tipb::SelectResponse & dag_response_,
}
current_chunk = nullptr;
current_records_num = 0;
total_rows = 0;
}


Expand All @@ -43,10 +42,10 @@ void DAGBlockOutputStream::writePrefix()
void DAGBlockOutputStream::writeSuffix()
{
// error handle,
if (current_chunk != nullptr && records_per_chunk > 0)
if (current_chunk != nullptr && current_records_num > 0)
{
current_chunk->set_rows_data(current_ss.str());
dag_response.add_output_counts(records_per_chunk);
dag_response.add_output_counts(current_records_num);
}
}

Expand All @@ -71,7 +70,7 @@ void DAGBlockOutputStream::write(const Block & block)
}
current_chunk = dag_response.add_chunks();
current_ss.str("");
records_per_chunk = 0;
current_records_num = 0;
}
for (size_t j = 0; j < block.columns(); j++)
{
Expand All @@ -80,8 +79,7 @@ void DAGBlockOutputStream::write(const Block & block)
EncodeDatum(datum.field(), getCodecFlagByFieldType(result_field_types[j]), current_ss);
}
// Encode current row
records_per_chunk++;
total_rows++;
current_records_num++;
}
}

Expand Down
3 changes: 1 addition & 2 deletions dbms/src/Flash/Coprocessor/DAGBlockOutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DAGBlockOutputStream : public IBlockOutputStream
private:
tipb::SelectResponse & dag_response;

Int64 records_per_chunk;
const Int64 records_per_chunk;
tipb::EncodeType encodeType;
std::vector<tipb::FieldType> result_field_types;

Expand All @@ -38,7 +38,6 @@ class DAGBlockOutputStream : public IBlockOutputStream
tipb::Chunk * current_chunk;
Int64 current_records_num;
std::stringstream current_ss;
Int64 total_rows;
};

} // namespace DB