in xtable-utilities/src/main/java/org/apache/xtable/utilities/RunCatalogSync.java [211:245]
static SourceTable getSourceTable(
DatasetConfig.SourceTableIdentifier sourceTableIdentifier,
Optional<CatalogConversionSource> catalogConversionSource) {
SourceTable sourceTable = null;
if (sourceTableIdentifier.getStorageIdentifier() != null) {
StorageIdentifier storageIdentifier = sourceTableIdentifier.getStorageIdentifier();
Properties sourceProperties = new Properties();
if (storageIdentifier.getPartitionSpec() != null) {
sourceProperties.put(
HudiSourceConfig.PARTITION_FIELD_SPEC_CONFIG, storageIdentifier.getPartitionSpec());
}
sourceTable =
SourceTable.builder()
.name(storageIdentifier.getTableName())
.basePath(storageIdentifier.getTableBasePath())
.namespace(
storageIdentifier.getNamespace() == null
? null
: storageIdentifier.getNamespace().split("\\."))
.dataPath(storageIdentifier.getTableDataPath())
.formatName(storageIdentifier.getTableFormat())
.additionalProperties(sourceProperties)
.build();
} else if (catalogConversionSource.isPresent()) {
TableIdentifier tableIdentifier = sourceTableIdentifier.getTableIdentifier();
sourceTable =
catalogConversionSource.get().getSourceTable(getCatalogTableIdentifier(tableIdentifier));
if (tableIdentifier.getPartitionSpec() != null) {
sourceTable
.getAdditionalProperties()
.put(HudiSourceConfig.PARTITION_FIELD_SPEC_CONFIG, tableIdentifier.getPartitionSpec());
}
}
return sourceTable;
}