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
4 changes: 2 additions & 2 deletions be/src/olap/rowset/segment_v2/segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,8 @@ Status SegmentWriter::fill_missing_columns(vectorized::MutableColumns& mutable_f
read_index[id_and_pos.pos] = read_idx++;
}
if (has_row_column) {
auto st = tablet->fetch_value_through_row_column(rowset, seg_it.first, rids,
cids_missing, old_value_block);
auto st = tablet->fetch_value_through_row_column(
rowset, *_tablet_schema, seg_it.first, rids, cids_missing, old_value_block);
if (!st.ok()) {
LOG(WARNING) << "failed to fetch value through row column";
return st;
Expand Down
14 changes: 7 additions & 7 deletions be/src/olap/tablet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2742,7 +2742,8 @@ Status Tablet::_get_segment_column_iterator(
}

// fetch value by row column
Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset, uint32_t segid,
Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'fetch_value_through_row_column' can be made static [readability-convert-member-functions-to-static]

Suggested change
Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset,
}static

const TabletSchema& tablet_schema, uint32_t segid,
const std::vector<uint32_t>& rowids,
const std::vector<uint32_t>& cids,
vectorized::Block& block) {
Expand All @@ -2755,13 +2756,12 @@ Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset, uint

BetaRowsetSharedPtr rowset = std::static_pointer_cast<BetaRowset>(input_rowset);
CHECK(rowset);
const TabletSchemaSPtr tablet_schema = rowset->tablet_schema();
CHECK(tablet_schema->store_row_column());
CHECK(tablet_schema.store_row_column());
SegmentCacheHandle segment_cache_handle;
std::unique_ptr<segment_v2::ColumnIterator> column_iterator;
OlapReaderStatistics stats;
RETURN_IF_ERROR(_get_segment_column_iterator(rowset, segid,
tablet_schema->column(BeConsts::ROW_STORE_COL),
tablet_schema.column(BeConsts::ROW_STORE_COL),
&segment_cache_handle, &column_iterator, &stats));
// get and parse tuple row
vectorized::MutableColumnPtr column_ptr = vectorized::ColumnString::create();
Expand All @@ -2774,7 +2774,7 @@ Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset, uint
std::vector<std::string> default_values;
default_values.resize(cids.size());
for (int i = 0; i < cids.size(); ++i) {
const TabletColumn& column = tablet_schema->column(cids[i]);
const TabletColumn& column = tablet_schema.column(cids[i]);
vectorized::DataTypePtr type =
vectorized::DataTypeFactory::instance().create_data_type(column);
col_uid_to_idx[column.unique_id()] = i;
Expand Down Expand Up @@ -3255,8 +3255,8 @@ Status Tablet::read_columns_by_plan(TabletSchemaSPtr tablet_schema,
(*read_index)[id_and_pos.pos] = read_idx++;
}
if (has_row_column) {
auto st = fetch_value_through_row_column(rowset_iter->second, seg_it.first, rids,
cids_to_read, block);
auto st = fetch_value_through_row_column(rowset_iter->second, *tablet_schema,
seg_it.first, rids, cids_to_read, block);
if (!st.ok()) {
LOG(WARNING) << "failed to fetch value through row column";
return st;
Expand Down
6 changes: 5 additions & 1 deletion be/src/olap/tablet.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ class Tablet final : public BaseTablet {
const TabletColumn& tablet_column,
vectorized::MutableColumnPtr& dst);

Status fetch_value_through_row_column(RowsetSharedPtr input_rowset, uint32_t segid,
// We use the TabletSchema from the caller because the TabletSchema in the rowset'meta
// may be outdated due to schema change. Also note that the the cids should indicate the indexes
// of the columns in the TabletSchema passed in.
Status fetch_value_through_row_column(RowsetSharedPtr input_rowset,
const TabletSchema& tablet_schema, uint32_t segid,
const std::vector<uint32_t>& rowids,
const std::vector<uint32_t>& cids,
vectorized::Block& block);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql1 --
1 0 0 0 0 0 0 0 0 0

-- !sql2 --
1 1 1 0 0 0 0 0 0 0 0

-- !sql3 --
1 1 1 0 0 0 0 0 0 0 10

-- !sql4 --
1 0 0 0 0 0 0 0 0 0

-- !sql5 --
1 1 1 0 0 0 0 0 0

-- !sql6 --
1 2 1 0 0 0 0 1 0

-- !sql7 --
1 0 0 0 0 0 0 0 0 0

-- !sql8 --
1 1 1.0 0 0 0 0 0 0 0

-- !sql9 --
1

-- !sql10 --
1 0 0 0 0 0 0 0 0 0

-- !sql11 --
1 1 1 0 0 0 0 0 0 0

-- !sql12 --
1 0 0 0 0 0 0 0 0 0

-- !sql13 --
1 1 1 0 0 0 0 0 0 0

-- !sql14 --
1 0 0 0 0 0 0 0 0 0

-- !sql15 --
1 1 1 0 0 0 0 0 0 0 0

-- !sql16 --
1 1 1 0 0 0 0 0 0 0 10

-- !sql17 --
1 0 0 0 0 0 0 0 0 0

-- !sql18 --
1 1 1 0 0 0 0 0 0

-- !sql19 --
1 0 0 0 0 0 0 0 0 0

-- !sql20 --
1 1 1.0 0 0 0 0 0 0 0

-- !sql21 --
1

-- !sql23 --
1 0 0 0 0 0 0 0 0 0

-- !sql24 --
1 1 1 0 0 0 0 0 0 0

-- !sql25 --
1 0 0 0 0 0 0 0 0 0

-- !sql26 --
1 1 1 0 0 0 0 0 0 0

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
// under the License.

suite("test_partial_update_schema_change", "p0") {
// test add value column

/* ============================================== light schema change cases: ============================================== */

// test add value column
def tableName = "test_partial_update_light_schema_change_add_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
Expand Down Expand Up @@ -618,6 +621,8 @@ suite("test_partial_update_schema_change", "p0") {

sql """ DROP TABLE IF EXISTS ${tableName} """

/* ============================================== schema change cases: ============================================== */

// test add value column
tableName = "test_partial_update_schema_change_add_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
Expand Down
Loading