Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhan1 committed Oct 8, 2023
1 parent d517d7a commit 2839278
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
10 changes: 7 additions & 3 deletions be/src/olap/rowset_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,13 @@ void RowsetBuilder::_build_current_tablet_schema(int64_t index_id,

_tablet_schema->set_table_id(table_schema_param->table_id());
// set partial update columns info
_tablet_schema->set_partial_update_info(table_schema_param->is_partial_update(),
table_schema_param->partial_update_input_columns());
_tablet_schema->set_is_strict_mode(table_schema_param->is_strict_mode());
// _tablet_schema->set_partial_update_info(table_schema_param->is_partial_update(),
// table_schema_param->partial_update_input_columns());
// _tablet_schema->set_is_strict_mode(table_schema_param->is_strict_mode());

_partial_update_info.init(*_tablet_schema, table_schema_param->is_partial_update(),
table_schema_param->partial_update_input_columns(),
table_schema_param->is_strict_mode());
}

} // namespace doris
2 changes: 2 additions & 0 deletions be/src/olap/rowset_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class RowsetBuilder {
// current rowset_ids, used to do diff in publish_version
RowsetIdUnorderedSet _rowset_ids;

PartialUpdateInfo _partial_update_info;

RuntimeProfile* _profile = nullptr;
RuntimeProfile::Counter* _build_rowset_timer = nullptr;
RuntimeProfile::Counter* _submit_delete_bitmap_timer = nullptr;
Expand Down
31 changes: 31 additions & 0 deletions be/src/olap/tablet_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,35 @@ bool operator!=(const TabletSchema& a, const TabletSchema& b);

using TabletSchemaSPtr = std::shared_ptr<TabletSchema>;

struct PartialUpdateInfo {
void init(const TabletSchema& tablet_schema, bool is_partial_update,
const std::set<string>& partial_update_input_columns, bool is_strict_mode) {
_is_partial_update = is_partial_update;
_partial_update_input_columns = partial_update_input_columns;
_missing_cids.clear();
_update_cids.clear();
for (auto i = 0; i < tablet_schema.num_columns(); ++i) {
auto tablet_column = tablet_schema.column(i);
if (_partial_update_input_columns.count(tablet_column.name()) == 0) {
_missing_cids.emplace_back(i);
if (!tablet_column.has_default_value() && !tablet_column.is_nullable()) {
_can_insert_new_rows_in_partial_update = false;
}
} else {
_update_cids.emplace_back(i);
}
}
_is_strict_mode = is_strict_mode;
}

bool _is_partial_update {false};
std::set<std::string> _partial_update_input_columns;
std::vector<uint32_t> _missing_cids;
std::vector<uint32_t> _update_cids;
// if key not exist in old rowset, use default value or null value for the unmentioned cols
// to generate a new row, only available in non-strict mode
bool _can_insert_new_rows_in_partial_update {true};
bool _is_strict_mode {false};
};

} // namespace doris

0 comments on commit 2839278

Please sign in to comment.