the-other-tim-brown commented on code in PR #518:
URL: https://github.com/apache/incubator-xtable/pull/518#discussion_r1767828234
##########
xtable-core/src/test/java/org/apache/xtable/ITConversionController.java:
##########
@@ -100,6 +108,8 @@ public class ITConversionController {
@TempDir public static Path tempDir;
private static final DateTimeFormatter DATE_FORMAT =
DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ss.SSS").withZone(ZoneId.of("UTC"));
+ // Compile the Base64 regex pattern once for reuse
+ private static final Pattern BASE64_PATTERN =
Pattern.compile("^[A-Za-z0-9+/]+={0,2}$");
Review Comment:
Can you add `UUID` to the name so it's clear what it is the base 64 version
of?
##########
xtable-core/src/test/java/org/apache/xtable/ITConversionController.java:
##########
@@ -797,15 +868,55 @@ private void checkDatasetEquivalence(
// if count is not known ahead of time, ensure datasets are
non-empty
assertFalse(dataset1Rows.isEmpty());
}
+ // Process UUID for the diff in Iceberg and Delta to make test smooth
+ // Iceberg supports UUIDs directly, while Delta represents them as
binary
+ List<String> processedDataset1Rows = processUUID(dataset1Rows);
+ List<String> processedDataset2Rows = processUUID(dataset2Rows);
assertEquals(
- dataset1Rows,
- dataset2Rows,
+ processedDataset1Rows,
+ processedDataset2Rows,
String.format(
"Datasets are not equivalent when reading from Spark.
Source: %s, Target: %s",
sourceFormat, format));
});
}
+ // converting Base64-encoded UUID fields from Delta to their UUID string
representations for
+ // testing
+ private List<String> processUUID(List<String> rows) {
+ ObjectMapper objectMapper = new ObjectMapper();
Review Comment:
The instance is thread safe so you can define a static constant for this in
the test class
--
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]