Skip to content

Commit

Permalink
[Refactor] Remove _source_filename from Chunk (StarRocks#45369)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueeyu authored May 9, 2024
1 parent e02e9d9 commit 0c8b94d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
5 changes: 0 additions & 5 deletions be/src/column/chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ class Chunk {

void set_columns(const Columns& columns) { _columns = columns; }

void set_source_filename(const std::string& source_filename) { _source_filename = source_filename; }

const std::string& source_filename() const { return _source_filename; }

// Create an empty chunk with the same meta and reserve it of size chunk _num_rows
ChunkUniquePtr clone_empty() const;
ChunkUniquePtr clone_empty_with_slot() const;
Expand Down Expand Up @@ -298,7 +294,6 @@ class Chunk {
DelCondSatisfied _delete_state = DEL_NOT_SATISFIED;
query_cache::owner_info _owner_info;
ChunkExtraDataPtr _extra_data;
std::string _source_filename;
};

inline const ColumnPtr& Chunk::get_column_by_name(const std::string& column_name) const {
Expand Down
3 changes: 1 addition & 2 deletions be/src/exec/file_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ StatusOr<ChunkPtr> FileScanner::materialize(const starrocks::ChunkPtr& src, star
error_msg << "Value '" << src_col->debug_item(i) << "' is out of range. "
<< "The type of '" << slot->col_name() << "' is " << slot->type().debug_string();
// TODO(meegoo): support other file format
_state->append_rejected_record_to_file(src->rebuild_csv_row(i, ","), error_msg.str(),
src->source_filename());
_state->append_rejected_record_to_file(src->rebuild_csv_row(i, ","), error_msg.str(), "");
}

// avoid print too many debug log
Expand Down
18 changes: 6 additions & 12 deletions be/src/exec/tablet_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,7 @@ Status OlapTableSink::send_chunk(RuntimeState* state, Chunk* chunk) {
}
for (auto i : invalid_row_indexs) {
if (state->enable_log_rejected_record()) {
state->append_rejected_record_to_file(chunk->rebuild_csv_row(i, ","), ss.str(),
chunk->source_filename());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(i, ","), ss.str(), "");
} else {
break;
}
Expand Down Expand Up @@ -913,8 +912,7 @@ void OlapTableSink::_validate_decimal(RuntimeState* state, Chunk* chunk, Column*
std::string error_msg =
strings::Substitute("Decimal '$0' is out of range. The type of '$1' is $2'", decimal_str,
desc->col_name(), desc->type().debug_string());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(i, ","), error_msg,
chunk->source_filename());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(i, ","), error_msg, "");
}
}
}
Expand Down Expand Up @@ -950,8 +948,7 @@ void OlapTableSink::_validate_data(RuntimeState* state, Chunk* chunk) {
_validate_selection[j] = VALID_SEL_FAILED;
// If enable_log_rejected_record is true, we need to log the rejected record.
if (nullable->is_null(j) && state->enable_log_rejected_record()) {
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), ss.str(),
chunk->source_filename());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), ss.str(), "");
}
}
#if BE_TEST
Expand Down Expand Up @@ -991,8 +988,7 @@ void OlapTableSink::_validate_data(RuntimeState* state, Chunk* chunk) {
}
#endif
if (state->enable_log_rejected_record()) {
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), ss.str(),
chunk->source_filename());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), ss.str(), "");
}
}
}
Expand Down Expand Up @@ -1031,8 +1027,7 @@ void OlapTableSink::_validate_data(RuntimeState* state, Chunk* chunk) {
std::string error_msg =
strings::Substitute("String (length=$0) is too long. The max length of '$1' is $2",
binary->get_slice(j).size, desc->col_name(), desc->type().len);
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), error_msg,
chunk->source_filename());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), error_msg, "");
}
}
}
Expand All @@ -1057,8 +1052,7 @@ void OlapTableSink::_validate_data(RuntimeState* state, Chunk* chunk) {
std::string error_msg = strings::Substitute(
"Decimal '$0' is out of range. The type of '$1' is $2'", datas[j].to_string(),
desc->col_name(), desc->type().debug_string());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), error_msg,
chunk->source_filename());
state->append_rejected_record_to_file(chunk->rebuild_csv_row(j, ","), error_msg, "");
}
}
}
Expand Down

0 comments on commit 0c8b94d

Please sign in to comment.