dentiny commented on code in PR #1578:
URL: https://github.com/apache/iceberg-rust/pull/1578#discussion_r2257913995


##########
crates/iceberg/src/delete_vector.rs:
##########
@@ -43,6 +43,18 @@ impl DeleteVector {
         self.inner.insert(pos)
     }
 
+    /// Mark the given [`positions`] as deleted, and return the number of 
elements appended to the set.
+    ///
+    /// Precondition: The values of the iterator must be ordered and strictly 
greater than the greatest value in the set.
+    /// If a value in the iterator doesn’t satisfy this requirement, it is not 
added and the append operation is stopped.
+    #[allow(dead_code)]
+    pub fn insert_positions(&mut self, positions: &[u64]) -> u64 {

Review Comment:
   > If the inner append fail, we should also return this error.
   
   I considered it:
   - I met some problems to wrap it inside of iceberg error, for example, I 
don't want to add another error category for this particular error type and may 
lose information (successfully inserted rows)
   - Returning the number of successfully inserted rows is a well-defined 
behavior, and it's always caller's responsibility to check whether row 
insertion works
   
   Another consideration here is whether we want users to keep insertion upon 
failure:
   - Returning an error, without inserted rows being specified, means deletion 
vector could be at a broken state, and users are not supposed to keep insertion;
   - Returning the number of rows inserted indicates clearly which part gets 
inserted and which parts not, so it's actually legal to keep insertion after 
updating the input arguments.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to