1919package org .apache .xtable .service ;
2020
2121import static org .apache .xtable .conversion .ConversionUtils .convertToSourceTable ;
22+ import static org .apache .xtable .hudi .HudiSourceConfig .PARTITION_FIELD_SPEC_CONFIG ;
2223import static org .apache .xtable .model .storage .TableFormat .DELTA ;
2324import static org .apache .xtable .model .storage .TableFormat .HUDI ;
2425import static org .apache .xtable .model .storage .TableFormat .ICEBERG ;
2728import java .util .HashMap ;
2829import java .util .List ;
2930import java .util .Map ;
31+ import java .util .Properties ;
3032
3133import lombok .extern .log4j .Log4j2 ;
3234
@@ -186,11 +188,19 @@ public ConversionService(
186188 * @return a ConvertTableResponse containing details of the converted target tables
187189 */
188190 public ConvertTableResponse convertTable (ConvertTableRequest convertTableRequest ) {
191+
192+ Properties sourceProperties = new Properties ();
193+ String partitionSpec = convertTableRequest .getConfigurations ().getOrDefault ("partition-spec" , null );
194+ if (partitionSpec != null ) {
195+ sourceProperties .put (PARTITION_FIELD_SPEC_CONFIG , partitionSpec );
196+ }
197+
189198 SourceTable sourceTable =
190199 SourceTable .builder ()
191200 .name (convertTableRequest .getSourceTableName ())
192201 .basePath (convertTableRequest .getSourceTablePath ())
193202 .formatName (convertTableRequest .getSourceFormat ())
203+ .additionalProperties (sourceProperties )
194204 .build ();
195205
196206 List <TargetTable > targetTables = new ArrayList <>();
@@ -200,6 +210,7 @@ public ConvertTableResponse convertTable(ConvertTableRequest convertTableRequest
200210 .name (convertTableRequest .getSourceTableName ())
201211 .basePath (convertTableRequest .getSourceTablePath ())
202212 .formatName (targetFormat )
213+ .additionalProperties (sourceProperties )
203214 .build ();
204215 targetTables .add (targetTable );
205216 }
0 commit comments