Skip to content
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
2 changes: 1 addition & 1 deletion be/src/vec/runtime/vfile_result_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,12 @@ Status VFileResultWriter::_create_new_file_if_exceed_size() {

Status VFileResultWriter::_close_file_writer(bool done, bool only_close) {
if (_vfile_writer) {
_vfile_writer->close();
// we can not use _current_written_bytes to COUNTER_UPDATE(_written_data_bytes, _current_written_bytes)
// because it will call `write()` function of orc/parquet function in `_vfile_writer->close()`
// and the real written_len will increase
// and _current_written_bytes will less than _vfile_writer->written_len()
COUNTER_UPDATE(_written_data_bytes, _vfile_writer->written_len());
_vfile_writer->close();
_vfile_writer.reset(nullptr);
} else if (_file_writer_impl) {
_file_writer_impl->close();
Expand Down
11 changes: 10 additions & 1 deletion be/src/vec/runtime/vorc_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,22 @@ std::unique_ptr<orc::ColumnVectorBatch> VOrcWriterWrapper::_create_row_batch(siz
}

int64_t VOrcWriterWrapper::written_len() {
return _output_stream->getLength();
// written_len() will be called in VFileResultWriter::_close_file_writer
// but _output_stream may be nullptr
// because the failure built by _schema in open()
if (_output_stream) {
return _output_stream->getLength();
}
return 0;
}

void VOrcWriterWrapper::close() {
if (_writer != nullptr) {
_writer->close();
}
if (_output_stream) {
_output_stream->close();
}
}

#define RETURN_WRONG_TYPE \
Expand Down