From ba2c1bae6d9e516935cf7d0038d093456a75cd94 Mon Sep 17 00:00:00 2001 From: Yuriy Dupyn <2153100+omedusyo@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:20:22 +0100 Subject: [PATCH] Add a comment about potentiall returning reference to id hash-set in fetch_ids_from_index. --- minisql/src/internals/table.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/minisql/src/internals/table.rs b/minisql/src/internals/table.rs index d4210b8..e5506e0 100644 --- a/minisql/src/internals/table.rs +++ b/minisql/src/internals/table.rs @@ -218,6 +218,9 @@ impl Table { } else { match self.indexes.get(&column_position) { Some(index) => { + // Note that we are cloning the ids here! This can be very wasteful in some cases. + // It would be possible to just return a reference, + // but this seems fairly non-trivial. let ids = index.get(value).cloned(); Ok(ids) }