Use the out of the compute_primary_key_pair function

This commit is contained in:
Kerollmops 2021-06-09 10:57:32 +02:00
parent 0542e2179f
commit ff9414a6ba
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -246,7 +246,7 @@ impl Transform<'_, '_> {
// Returns the field id in the fields ids map, create an "id" field // Returns the field id in the fields ids map, create an "id" field
// in case it is not in the current headers. // in case it is not in the current headers.
let alternative_name = primary_key_pos.map(|pos| headers[pos].to_string()); let alternative_name = primary_key_pos.map(|pos| headers[pos].to_string());
let (primary_key_id, _) = compute_primary_key_pair( let (primary_key_id, primary_key_name) = compute_primary_key_pair(
self.index.primary_key(self.rtxn)?, self.index.primary_key(self.rtxn)?,
&mut fields_ids_map, &mut fields_ids_map,
alternative_name, alternative_name,
@ -330,10 +330,6 @@ impl Transform<'_, '_> {
// Now that we have a valid sorter that contains the user id and the obkv we // Now that we have a valid sorter that contains the user id and the obkv we
// give it to the last transforming function which returns the TransformOutput. // give it to the last transforming function which returns the TransformOutput.
let primary_key_name = fields_ids_map
.name(primary_key_id)
.map(String::from)
.expect("Primary key must be present in fields id map");
self.output_from_sorter( self.output_from_sorter(
sorter, sorter,
primary_key_name, primary_key_name,