@@ -554,23 +554,16 @@ row_merge_buf_add(
554554
555555for (i = 0 ; i < n_fields; i++, field++, ifield++) {
556556ulint len;
557- const dict_col_t * col;
558- ulint col_no;
559557ulint fixed_len;
560558const dfield_t * row_field;
561-
562- col = ifield->col ;
563- const dict_v_col_t * v_col = NULL ;
564- if (dict_col_is_virtual (col)) {
565- v_col = reinterpret_cast <const dict_v_col_t *>(col);
566- }
567-
568- col_no = dict_col_get_no (col);
559+ const dict_col_t * const col = ifield->col ;
560+ const dict_v_col_t * const v_col = col->is_virtual ()
561+ ? reinterpret_cast <const dict_v_col_t *>(col)
562+ : NULL ;
569563
570564/* Process the Doc ID column */
571- if (*doc_id > 0
572- && col_no == index->table ->fts ->doc_col
573- && !dict_col_is_virtual (col)) {
565+ if (!v_col && *doc_id
566+ && col->ind == index->table ->fts ->doc_col ) {
574567fts_write_doc_id ((byte*) &write_doc_id, *doc_id);
575568
576569/* Note: field->data now points to a value on the
@@ -589,7 +582,7 @@ row_merge_buf_add(
589582field->type .len = ifield->col ->len ;
590583} else {
591584/* Use callback to get the virtual column value */
592- if (dict_col_is_virtual (col) ) {
585+ if (v_col ) {
593586dict_index_t * clust_index
594587= dict_table_get_first_index (new_table);
595588
@@ -614,7 +607,8 @@ row_merge_buf_add(
614607}
615608dfield_copy (field, row_field);
616609} else {
617- row_field = dtuple_get_nth_field (row, col_no);
610+ row_field = dtuple_get_nth_field (row,
611+ col->ind );
618612dfield_copy (field, row_field);
619613}
620614
@@ -720,7 +714,7 @@ row_merge_buf_add(
720714} else if (!ext) {
721715} else if (dict_index_is_clust (index)) {
722716/* Flag externally stored fields. */
723- const byte* buf = row_ext_lookup (ext, col_no ,
717+ const byte* buf = row_ext_lookup (ext, col-> ind ,
724718 &len);
725719if (UNIV_LIKELY_NULL (buf)) {
726720ut_a (buf != field_ref_zero);
@@ -731,9 +725,9 @@ row_merge_buf_add(
731725len = dfield_get_len (field);
732726}
733727}
734- } else if (!dict_col_is_virtual (col) ) {
728+ } else if (!v_col ) {
735729/* Only non-virtual column are stored externally */
736- const byte* buf = row_ext_lookup (ext, col_no ,
730+ const byte* buf = row_ext_lookup (ext, col-> ind ,
737731 &len);
738732if (UNIV_LIKELY_NULL (buf)) {
739733ut_a (buf != field_ref_zero);
0 commit comments