luoyuxia commented on code in PR #159:
URL: https://github.com/apache/fluss-rust/pull/159#discussion_r2695040987


##########
crates/fluss/src/client/table/mod.rs:
##########
@@ -85,6 +86,88 @@ impl<'a> FlussTable<'a> {
     pub fn has_primary_key(&self) -> bool {
         self.has_primary_key
     }
+
+    /// Lookup values by primary key in a key-value table.
+    ///
+    /// This method performs a direct lookup to retrieve the value associated 
with the given key
+    /// in the specified bucket. The table must have a primary key (be a 
primary key table).
+    ///
+    /// # Arguments
+    /// * `bucket_id` - The bucket ID to look up the key in
+    /// * `key` - The encoded primary key bytes to look up
+    ///
+    /// # Returns
+    /// * `Ok(Some(Vec<u8>))` - The value bytes if the key exists
+    /// * `Ok(None)` - If the key does not exist
+    /// * `Err(Error)` - If the lookup fails or the table doesn't have a 
primary key
+    ///
+    /// # Example
+    /// ```ignore
+    /// let table = conn.get_table(&table_path).await?;
+    /// let key = /* encoded key bytes */;
+    /// if let Some(value) = table.lookup(0, key).await? {
+    ///     println!("Found value: {:?}", value);
+    /// }
+    /// ```
+    pub async fn lookup(&self, bucket_id: i32, key: Vec<u8>) -> 
Result<Option<Vec<u8>>> {

Review Comment:
   +1



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to