the-other-tim-brown commented on code in PR #806:
URL: https://github.com/apache/incubator-xtable/pull/806#discussion_r2842612003
##########
xtable-core/src/test/java/org/apache/xtable/parquet/ITParquetConversionSource.java:
##########
@@ -319,43 +268,62 @@ public void
testFilePartitionedData(TableFormatPartitionDataHolder tableFormatPa
new Timestamp(System.currentTimeMillis() + 1500)));
Dataset<Row> dfAppend = sparkSession.createDataFrame(dataToAppend,
schema);
- dfAppend
- .withColumn(
- "year",
functions.year(functions.col("timestamp").cast(DataTypes.TimestampType)))
- .withColumn(
- "month",
-
functions.date_format(functions.col("timestamp").cast(DataTypes.TimestampType),
"MM"))
- .write()
- .mode(SaveMode.Append)
- .partitionBy("year", "month")
- .parquet(dataPathPart);
- GenericTable tableAppend;
- tableAppend =
- GenericTable.getInstance(
- tableName, Paths.get(dataPathPart), sparkSession, jsc,
sourceTableFormat, true);
- try (GenericTable tableToCloseAppended = tableAppend) {
- ConversionConfig conversionConfigAppended =
- getTableSyncConfig(
- sourceTableFormat,
- SyncMode.FULL,
- tableName,
- tableAppend,
- targetTableFormats,
- xTablePartitionConfig,
- null);
- ConversionController conversionControllerAppended =
- new ConversionController(jsc.hadoopConfiguration());
- conversionControllerAppended.sync(conversionConfigAppended,
conversionSourceProvider);
+ writeData(dfAppend, dataPath, xTablePartitionConfig);
+ ConversionConfig conversionConfigAppended =
+ getTableSyncConfig(
+ sourceTableFormat,
+ tableFormatPartitionDataHolder.getSyncMode(),
+ tableName,
+ table,
+ targetTableFormats,
+ xTablePartitionConfig,
+ null);
+ ConversionController conversionControllerAppended =
+ new ConversionController(jsc.hadoopConfiguration());
+ conversionControllerAppended.sync(conversionConfigAppended,
conversionSourceProvider);
+ checkDatasetEquivalenceWithFilter(
+ sourceTableFormat, table, targetTableFormats, isPartitioned);
+ }
+ }
+
+ private void writeData(Dataset<Row> df, String dataPath, String
partitionConfig) {
+ if (partitionConfig != null) {
+ // extract partition columns from config
+ String[] partitionCols =
+ Arrays.stream(partitionConfig.split(":")[2].split("/"))
+ .map(s -> s.split("=")[0])
+ .toArray(String[]::new);
+ // add partition columns to dataframe
+ for (String partitionCol : partitionCols) {
+ if (partitionCol.equals("year")) {
Review Comment:
Addressed in the latest commit
--
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]