@@ -1187,7 +1187,7 @@ static AccessPath *NewWeedoutAccessPathForTables(
1187
1187
// the previous (now wrong) decision there.
1188
1188
filesort->clear_addon_fields ();
1189
1189
}
1190
- filesort->m_force_sort_positions = true ;
1190
+ filesort->m_force_sort_rowids = true ;
1191
1191
}
1192
1192
}
1193
1193
}
@@ -3029,7 +3029,7 @@ AccessPath *JOIN::create_root_access_path_for_join() {
3029
3029
// Only const fields.
3030
3030
limit_1_for_dup_filesort = true ;
3031
3031
} else {
3032
- bool force_sort_positions = false ;
3032
+ bool force_sort_rowids = false ;
3033
3033
if (all_order_fields_used) {
3034
3034
// The ordering for DISTINCT already gave us the right sort order,
3035
3035
// so no need to sort again.
@@ -3043,27 +3043,27 @@ AccessPath *JOIN::create_root_access_path_for_join() {
3043
3043
} else if (filesort != nullptr && !filesort->using_addon_fields ()) {
3044
3044
// We have the rather unusual situation here that we have two sorts
3045
3045
// directly after each other, with no temporary table in-between,
3046
- // and filesort expects to be able to refer to rows by their position .
3046
+ // and filesort expects to be able to refer to rows by their row ID .
3047
3047
// Usually, the sort for DISTINCT would be a superset of the sort for
3048
3048
// ORDER BY, but not always (e.g. when sorting by some expression),
3049
3049
// so we could end up in a situation where the first sort is by addon
3050
3050
// fields and the second one is by positions.
3051
3051
//
3052
- // Thus, in this case, we force the first sort to be by positions ,
3052
+ // Thus, in this case, we force the first sort to use row IDs ,
3053
3053
// so that the result comes from SortFileIndirectIterator or
3054
3054
// SortBufferIndirectIterator. These will both position the cursor
3055
3055
// on the underlying temporary table correctly before returning it,
3056
- // so that the successive filesort will save the right position
3056
+ // so that the successive filesort will save the right row ID
3057
3057
// for the row.
3058
- force_sort_positions = true ;
3058
+ force_sort_rowids = true ;
3059
3059
}
3060
3060
3061
3061
// Switch to the right slice if applicable, so that we fetch out the
3062
3062
// correct items from order_arg.
3063
3063
Switch_ref_item_slice slice_switch (this , qep_tab->ref_item_slice );
3064
3064
dup_filesort = new (thd->mem_root ) Filesort (
3065
3065
thd, {qep_tab->table ()}, /* keep_buffers=*/ false , order,
3066
- HA_POS_ERROR, /* remove_duplicates=*/ true , force_sort_positions ,
3066
+ HA_POS_ERROR, /* remove_duplicates=*/ true , force_sort_rowids ,
3067
3067
/* unwrap_rollup=*/ false );
3068
3068
3069
3069
if (desired_order != nullptr && filesort == nullptr ) {
@@ -3072,7 +3072,7 @@ AccessPath *JOIN::create_root_access_path_for_join() {
3072
3072
// potentially addon fields. Create a new one.
3073
3073
filesort = new (thd->mem_root ) Filesort (
3074
3074
thd, {qep_tab->table ()}, /* keep_buffers=*/ false , desired_order,
3075
- HA_POS_ERROR, /* remove_duplicates=*/ false , force_sort_positions ,
3075
+ HA_POS_ERROR, /* remove_duplicates=*/ false , force_sort_rowids ,
3076
3076
/* unwrap_rollup=*/ false );
3077
3077
}
3078
3078
}
0 commit comments