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


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/procedures/CreateChangelogViewProcedure.java:
##########
@@ -179,13 +187,24 @@ private boolean shouldRemoveCarryoverRows(ProcedureInput 
input) {
     return input.asBoolean(REMOVE_CARRYOVERS_PARAM, true);
   }
 
-  private Dataset<Row> removeCarryoverRows(Dataset<Row> df) {
+  private Dataset<Row> removeCarryoverRows(Dataset<Row> df, boolean 
netChanges) {
+    Predicate<String> columnsToRemove;
+    if (netChanges) {
+      columnsToRemove =
+          column ->
+              column.equals(MetadataColumns.CHANGE_TYPE.name())
+                  || column.equals(MetadataColumns.CHANGE_ORDINAL.name())
+                  || column.equals(MetadataColumns.COMMIT_SNAPSHOT_ID.name());
+    } else {
+      columnsToRemove = column -> 
column.equals(MetadataColumns.CHANGE_TYPE.name());
+    }
+
     Column[] repartitionSpec =
         Arrays.stream(df.columns())
-            .filter(c -> !c.equals(MetadataColumns.CHANGE_TYPE.name()))
+            .filter(columnsToRemove.negate())

Review Comment:
   I argued with myself since we either use the negative world in the variable 
name like `columnsNotToRemove` or use `columnsToRemove.negate()`. I don't have 
any preference to be honest. WDYT?



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