flyrain commented on code in PR #7326:
URL: https://github.com/apache/iceberg/pull/7326#discussion_r1246990582


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/ComputeUpdateIterator.java:
##########
@@ -81,15 +81,13 @@ public Row next() {
     // either a cached record which is not an UPDATE or the next record in the 
iterator.
     Row currentRow = currentRow();
 
-    if (currentRow.getString(changeTypeIndex()).equals(DELETE) && 
rowIterator().hasNext()) {
+    if (changeType(currentRow).equals(DELETE) && rowIterator().hasNext()) {

Review Comment:
   That makes sense, but it sacrifice the readability. I will add a null check 
here. We are going to fail it if it is null.
   ```
     protected String changeType(Row row) {
       String changeType = row.getString(changeTypeIndex());
       Preconditions.checkNotNull(changeType, "Change type should not be null");
       return changeType;
     }
   ```



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