vaibhavk1992 commented on code in PR #659: URL: https://github.com/apache/incubator-xtable/pull/659#discussion_r1996952301
########## xtable-utilities/src/main/java/org/apache/xtable/utilities/RunSync.java: ########## @@ -98,37 +99,116 @@ public class RunSync { + "used for any Iceberg source or target.") .addOption(HELP_OPTION, "help", false, "Displays help information to run this utility"); - public static void main(String[] args) throws IOException { - CommandLineParser parser = new DefaultParser(); + static SourceTable sourceTableBuilder( + DatasetConfig.Table table, + IcebergCatalogConfig icebergCatalogConfig, + DatasetConfig datasetConfig, + Properties sourceProperties) { + Objects.requireNonNull(table, "Table cannot be null"); + Objects.requireNonNull(datasetConfig, "datasetConfig cannot be null"); Review Comment: Actually @rangareddy suggested to use Objects.requireNonNull. So Please let me know if need to change. @vinishjail97 ########## xtable-utilities/src/main/java/org/apache/xtable/utilities/RunSync.java: ########## @@ -98,37 +99,116 @@ public class RunSync { + "used for any Iceberg source or target.") .addOption(HELP_OPTION, "help", false, "Displays help information to run this utility"); - public static void main(String[] args) throws IOException { - CommandLineParser parser = new DefaultParser(); + static SourceTable sourceTableBuilder( + DatasetConfig.Table table, + IcebergCatalogConfig icebergCatalogConfig, + DatasetConfig datasetConfig, + Properties sourceProperties) { + Objects.requireNonNull(table, "Table cannot be null"); + Objects.requireNonNull(datasetConfig, "datasetConfig cannot be null"); + SourceTable sourceTable = + SourceTable.builder() + .name(table.getTableName()) + .basePath(table.getTableBasePath()) + .namespace(table.getNamespace() == null ? null : table.getNamespace().split("\\.")) + .dataPath(table.getTableDataPath()) + .catalogConfig(icebergCatalogConfig) + .additionalProperties(sourceProperties) + .formatName(datasetConfig.sourceFormat) + .build(); + return sourceTable; + } - CommandLine cmd; - try { - cmd = parser.parse(OPTIONS, args); - } catch (ParseException e) { - new HelpFormatter().printHelp("xtable.jar", OPTIONS, true); - return; - } + static List<TargetTable> targetTableBuilder( + DatasetConfig.Table table, + IcebergCatalogConfig icebergCatalogConfig, + List<String> tableFormatList) { + Objects.requireNonNull(table, "Table cannot be null"); + Objects.requireNonNull(tableFormatList, "tableFormatList cannot be null"); Review Comment: Same comment as above. @vinishjail97 -- 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: commits-unsubscr...@xtable.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org