Copilot commented on code in PR #150:
URL: https://github.com/apache/fluss-rust/pull/150#discussion_r2694731234


##########
bindings/python/src/admin.rs:
##########
@@ -96,6 +96,104 @@ impl FlussAdmin {
         })
     }
 
+    /// Drop a table
+    #[pyo3(signature = (table_path, ignore_if_not_exists=false))]
+    pub fn drop_table<'py>(
+        &self,
+        py: Python<'py>,
+        table_path: &TablePath,
+        ignore_if_not_exists: bool,
+    ) -> PyResult<Bound<'py, PyAny>> {
+        let core_table_path = table_path.to_core();
+        let admin = self.__admin.clone();
+
+        future_into_py(py, async move {
+            admin
+                .drop_table(&core_table_path, ignore_if_not_exists)
+                .await
+                .map_err(|e| FlussError::new_err(format!("Failed to drop 
table: {e}")))?;
+
+            Python::attach(|py| Ok(py.None()))
+        })
+    }
+
+    /// List offsets for buckets.
+    ///
+    /// Args:
+    ///     table_path: Path to the table
+    ///     bucket_ids: List of bucket IDs to query
+    ///     offset_type: Type of offset to retrieve:
+    ///         - "earliest" or OffsetType.EARLIEST: Start of the log
+    ///         - "latest" or OffsetType.LATEST: End of the log
+    ///         - "timestamp" or OffsetType.TIMESTAMP: Offset at given 
timestamp (requires timestamp arg)
+    ///     timestamp: Required when offset_type is "timestamp", ignored 
otherwise
+    ///
+    /// Returns:
+    ///     dict[int, int]: Mapping of bucket_id -> offset
+    ///
+    /// Example:
+    ///     >>> offsets = await admin.list_offsets(table_path, [0, 1], 
"latest")
+    ///     >>> print(offsets)  # {0: 100, 1: 150}
+    #[pyo3(signature = (table_path, bucket_ids, offset_type, timestamp=None))]
+    pub fn list_offsets<'py>(
+        &self,
+        py: Python<'py>,
+        table_path: &TablePath,
+        bucket_ids: Vec<i32>,
+        offset_type: &str,
+        timestamp: Option<i64>,
+    ) -> PyResult<Bound<'py, PyAny>> {
+        use fcore::rpc::message::OffsetSpec;
+
+        // Validate bucket IDs
+        for &bucket_id in &bucket_ids {
+            if bucket_id < 0 {
+                return Err(FlussError::new_err(format!(
+                    "Invalid bucket_id: {}. Bucket IDs must be non-negative",
+                    bucket_id
+                )));
+            }
+        }
+
+        let core_table_path = table_path.to_core();

Review Comment:
   Inconsistent pattern: `to_core()` is called without `.clone()`, while other 
methods in this file call `.clone()` after `to_core()`. For consistency with 
the pattern in `create_table()` (line 41) and `get_table()` (line 61), this 
should be `table_path.to_core().clone()`.
   ```suggestion
           let core_table_path = table_path.to_core().clone();
   ```



##########
bindings/python/src/admin.rs:
##########
@@ -96,6 +96,104 @@ impl FlussAdmin {
         })
     }
 
+    /// Drop a table
+    #[pyo3(signature = (table_path, ignore_if_not_exists=false))]
+    pub fn drop_table<'py>(
+        &self,
+        py: Python<'py>,
+        table_path: &TablePath,
+        ignore_if_not_exists: bool,
+    ) -> PyResult<Bound<'py, PyAny>> {
+        let core_table_path = table_path.to_core();

Review Comment:
   Inconsistent pattern: `to_core()` is called without `.clone()`, while other 
methods in this file call `.clone()` after `to_core()`. For consistency with 
the pattern in `create_table()` (line 41) and `get_table()` (line 61), this 
should be `table_path.to_core().clone()` or the variable should be cloned after 
assignment.
   ```suggestion
           let core_table_path = table_path.to_core().clone();
   ```



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