Skip to content

Commit

Permalink
[fix](OrcWriter) fix be core when upgrading BE without upgrading FE (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
BePPPower authored Sep 4, 2024
1 parent db06c67 commit b4beec8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions be/src/vec/sink/vresult_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct ResultFileOptions {
std::string file_suffix;
//Bring BOM when exporting to CSV format
bool with_bom = false;
int64_t orc_writer_version = 0;

ResultFileOptions(const TResultFileSinkOptions& t_opt) {
file_path = t_opt.file_path;
Expand Down Expand Up @@ -123,6 +124,9 @@ struct ResultFileOptions {
if (t_opt.__isset.orc_compression_type) {
orc_compression_type = t_opt.orc_compression_type;
}
if (t_opt.__isset.orc_writer_version) {
orc_writer_version = t_opt.orc_writer_version;
}
}
};

Expand Down
5 changes: 5 additions & 0 deletions be/src/vec/sink/writer/vfile_result_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ VFileResultWriter::VFileResultWriter(const ResultFileOptions* file_opts,
Status VFileResultWriter::open(RuntimeState* state, RuntimeProfile* profile) {
_state = state;
_init_profile(profile);
// check orc writer version
if (_file_opts->file_format == TFileFormatType::FORMAT_ORC &&
_file_opts->orc_writer_version < 1) {
return Status::InternalError("orc writer version is less than 1.");
}
// Delete existing files
if (_file_opts->delete_existing_files) {
RETURN_IF_ERROR(_delete_dir());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ public TResultFileSinkOptions toSinkOptions() {
if (isOrcFormat()) {
sinkOptions.setOrcSchema(serializeOrcSchema());
sinkOptions.setOrcCompressionType(orcCompressionType);
sinkOptions.setOrcWriterVersion(1);
}
return sinkOptions;
}
Expand Down
7 changes: 7 additions & 0 deletions gensrc/thrift/DataSinks.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ struct TResultFileSinkOptions {
18: optional bool with_bom;

19: optional PlanNodes.TFileCompressType orc_compression_type;

// Since we have changed the type mapping from Doris to Orc type,
// using the Outfile to export Date/Datetime types will cause BE core dump
// when only upgrading BE without upgrading FE.
// orc_writer_version = 1 means doris FE is higher than version 2.1.5
// orc_writer_version = 0 means doris FE is less than or equal to version 2.1.5
20: optional i64 orc_writer_version;
}

struct TMemoryScratchSink {
Expand Down

0 comments on commit b4beec8

Please sign in to comment.