eric-maynard commented on code in PR #10: URL: https://github.com/apache/polaris-tools/pull/10#discussion_r2056860082
########## polaris-synchronizer/cli/src/main/java/org/apache/polaris/tools/sync/polaris/SyncPolarisCommand.java: ########## @@ -120,11 +121,23 @@ public class SyncPolarisCommand implements Callable<Integer> { ) private boolean haltOnFailure; + @CommandLine.Option( + names = {"--catalog-name-regex"}, + description = "If specified, only catalogs with names that match the provided RegEx will be staged for " + + "synchronization. This applies to catalogs on both the source and target." + ) + private String catalogNameRegex; + @Override public Integer call() throws Exception { - SynchronizationPlanner sourceParityPlanner = new SourceParitySynchronizationPlanner(); - SynchronizationPlanner modificationAwareSourceParityPlanner = new ModificationAwarePlanner(sourceParityPlanner); - SynchronizationPlanner accessControlAwarePlanner = new AccessControlAwarePlanner(modificationAwareSourceParityPlanner); + SynchronizationPlanner planner = new SourceParitySynchronizationPlanner(); + planner = new ModificationAwarePlanner(planner); + + if (catalogNameRegex != null) { + planner = new CatalogNameFilterPlanner(catalogNameRegex, planner); + } + + planner = new AccessControlAwarePlanner(planner); Review Comment: nit: This stateful code is kind of scary and bug-prone. Is there a way we can chain these calls? e.g. ``` SynchronizationPlanner planner = new WrappedPlanner(List.of( new ModificationAwarePlanner(), new AccessControlAwarePlanner(), new CatalogNameFilterPlanner(), ... )); ``` or... ``` SynchronizationPlanner planner = SynchronizationPlanner.build() .withModificationAware() .withCatalogFilter(catalogNameRegex) .withAccessControlAware() ... .build() ``` -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org