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


##########
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:
   Let's use the same pattern as other methods such as `new_scan` and 
`new_append` where `TableScan` and `TableAppend` objects are returned. These 
are the main contracts by which users will use the fluss-client. If we move to 
1.0 as-is, it will be tricking to re-adopt the pattern as it will be breaking 
change for users.
   
   
   
   Ref: 
https://github.com/apache/fluss/blob/main/fluss-client/src/main/java/org/apache/fluss/client/lookup/TableLookup.java
   
   
   
   The `Lookuper` returned by `TableLookup` would be the main abstraction fluss 
client users use to perform lookup. I believe Yuxia was referring to the 
async/complex handling within `LookupClient`/`LookupQueue` when he mentioned 
that batching / queuing / draining are not needed currently. The `LookupClient` 
and `LookupQueue` are both internal classes so contract changes should not 
impact users.



-- 
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