Skip to content

Commit

Permalink
fix bug in DAGBlockOutputStream (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
windtalker authored and zanmato1984 committed Sep 10, 2019
1 parent 548e519 commit fce3676
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
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

0 comments on commit fce3676

Please sign in to comment.