Commit ebafe5a2 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Avoid repeated calls to dict_col_t::is_virtual()

parent 4a165f37
...@@ -5775,14 +5775,13 @@ innobase_vcol_build_templ( ...@@ -5775,14 +5775,13 @@ innobase_vcol_build_templ(
mysql_row_templ_t* templ, mysql_row_templ_t* templ,
ulint col_no) ulint col_no)
{ {
if (dict_col_is_virtual(col)) {
templ->is_virtual = true;
templ->col_no = col_no; templ->col_no = col_no;
templ->is_virtual = col->is_virtual();
if (templ->is_virtual) {
templ->clust_rec_field_no = ULINT_UNDEFINED; templ->clust_rec_field_no = ULINT_UNDEFINED;
templ->rec_field_no = col->ind; templ->rec_field_no = col->ind;
} else { } else {
templ->is_virtual = false;
templ->col_no = col_no;
templ->clust_rec_field_no = dict_col_get_clust_pos( templ->clust_rec_field_no = dict_col_get_clust_pos(
col, clust_index); col, clust_index);
ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED); ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED);
......
...@@ -554,23 +554,16 @@ row_merge_buf_add( ...@@ -554,23 +554,16 @@ row_merge_buf_add(
for (i = 0; i < n_fields; i++, field++, ifield++) { for (i = 0; i < n_fields; i++, field++, ifield++) {
ulint len; ulint len;
const dict_col_t* col;
ulint col_no;
ulint fixed_len; ulint fixed_len;
const dfield_t* row_field; const dfield_t* row_field;
const dict_col_t* const col = ifield->col;
col = ifield->col; const dict_v_col_t* const v_col = col->is_virtual()
const dict_v_col_t* v_col = NULL; ? reinterpret_cast<const dict_v_col_t*>(col)
if (dict_col_is_virtual(col)) { : NULL;
v_col = reinterpret_cast<const dict_v_col_t*>(col);
}
col_no = dict_col_get_no(col);
/* Process the Doc ID column */ /* Process the Doc ID column */
if (*doc_id > 0 if (!v_col && *doc_id
&& col_no == index->table->fts->doc_col && col->ind == index->table->fts->doc_col) {
&& !dict_col_is_virtual(col)) {
fts_write_doc_id((byte*) &write_doc_id, *doc_id); fts_write_doc_id((byte*) &write_doc_id, *doc_id);
/* Note: field->data now points to a value on the /* Note: field->data now points to a value on the
...@@ -589,7 +582,7 @@ row_merge_buf_add( ...@@ -589,7 +582,7 @@ row_merge_buf_add(
field->type.len = ifield->col->len; field->type.len = ifield->col->len;
} else { } else {
/* Use callback to get the virtual column value */ /* Use callback to get the virtual column value */
if (dict_col_is_virtual(col)) { if (v_col) {
dict_index_t* clust_index dict_index_t* clust_index
= dict_table_get_first_index(new_table); = dict_table_get_first_index(new_table);
...@@ -614,7 +607,8 @@ row_merge_buf_add( ...@@ -614,7 +607,8 @@ row_merge_buf_add(
} }
dfield_copy(field, row_field); dfield_copy(field, row_field);
} else { } else {
row_field = dtuple_get_nth_field(row, col_no); row_field = dtuple_get_nth_field(row,
col->ind);
dfield_copy(field, row_field); dfield_copy(field, row_field);
} }
...@@ -720,7 +714,7 @@ row_merge_buf_add( ...@@ -720,7 +714,7 @@ row_merge_buf_add(
} else if (!ext) { } else if (!ext) {
} else if (dict_index_is_clust(index)) { } else if (dict_index_is_clust(index)) {
/* Flag externally stored fields. */ /* Flag externally stored fields. */
const byte* buf = row_ext_lookup(ext, col_no, const byte* buf = row_ext_lookup(ext, col->ind,
&len); &len);
if (UNIV_LIKELY_NULL(buf)) { if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero); ut_a(buf != field_ref_zero);
...@@ -731,9 +725,9 @@ row_merge_buf_add( ...@@ -731,9 +725,9 @@ row_merge_buf_add(
len = dfield_get_len(field); len = dfield_get_len(field);
} }
} }
} else if (!dict_col_is_virtual(col)) { } else if (!v_col) {
/* Only non-virtual column are stored externally */ /* Only non-virtual column are stored externally */
const byte* buf = row_ext_lookup(ext, col_no, const byte* buf = row_ext_lookup(ext, col->ind,
&len); &len);
if (UNIV_LIKELY_NULL(buf)) { if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero); ut_a(buf != field_ref_zero);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment