diff --git a/src/lib.rs b/src/lib.rs index c598360..8e89cc7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -598,9 +598,6 @@ where projection: Projection, parquet_lru: ParquetLru, ) -> Result>, DbError> { - if let Some(entry) = self.mutable.get(key, ts) { - return Ok(Some(Entry::Mutable(entry))); - } let primary_key_index = self.record_instance.primary_key_index::(); let projection = match projection { @@ -619,6 +616,13 @@ where } }; + if let Some(entry) = self.mutable.get(key, ts) { + return Ok(Some(Entry::Projection(( + Box::new(Entry::Mutable(entry)), + Arc::new(projection), + )))); + } + for (_, immutable) in self.immutables.iter().rev() { if let Some(entry) = immutable.get(key, ts, projection.clone()) { return Ok(Some(Entry::RecordBatch(entry))); diff --git a/src/transaction.rs b/src/transaction.rs index 88d8bdf..0293d76 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -440,6 +440,16 @@ mod tests { drop(entry); txn1.commit().await.unwrap(); + + let txn2 = db.transaction().await; + let entry = txn2 + .get(&key, Projection::Parts(vec![0, 1])) + .await + .unwrap() + .unwrap(); + assert_eq!(entry.get().vstring, 0.to_string()); + assert_eq!(entry.get().vu32, Some(0)); + assert_eq!(entry.get().vbool, None); } #[tokio::test]