diff --git a/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.cpp b/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.cpp index b475ac3cb24..3514c1d006d 100644 --- a/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.cpp +++ b/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.cpp @@ -31,7 +31,6 @@ DAGBlockOutputStream::DAGBlockOutputStream(tipb::SelectResponse & dag_response_, } current_chunk = nullptr; current_records_num = 0; - total_rows = 0; } @@ -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); } } @@ -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++) { @@ -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++; } } diff --git a/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.h b/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.h index 7f9b09dd0f3..9ac6c5495fa 100644 --- a/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.h +++ b/dbms/src/Flash/Coprocessor/DAGBlockOutputStream.h @@ -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 result_field_types; @@ -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