pvary commented on code in PR #14964:
URL: https://github.com/apache/iceberg/pull/14964#discussion_r2664456646
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/procedures/RewriteDataFilesProcedure.java:
##########
@@ -109,17 +113,30 @@ public InternalRow[] call(InternalRow args) {
String sortOrderString = input.asString(SORT_ORDER_PARAM, null);
Map<String, String> options = input.asStringMap(OPTIONS_PARAM,
ImmutableMap.of());
String where = input.asString(WHERE_PARAM, null);
+ String explicitBranch = input.asString(BRANCH_PARAM, null);
+
+ // Load SparkTable to extract branch from identifier
+ SparkTable sparkTable = loadSparkTable(tableIdent);
+ String branchFromTable = sparkTable.branch();
+ String branch = explicitBranch != null ? explicitBranch : branchFromTable;
return modifyIcebergTable(
tableIdent,
table -> {
- RewriteDataFiles action =
actions().rewriteDataFiles(table).options(options);
+ RewriteDataFilesSparkAction action =
+ (RewriteDataFilesSparkAction)
actions().rewriteDataFiles(table).options(options);
+
+ if (branch != null) {
+ action = action.toBranch(branch);
+ }
if (strategy != null || sortOrderString != null) {
- action = checkAndApplyStrategy(action, strategy, sortOrderString,
table.schema());
+ action =
+ (RewriteDataFilesSparkAction)
Review Comment:
Instead of these casts. Could we just change the input/return type of the
`checkAndApplyFilter` and `checkAndApplyStrategy` methods?
--
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]