nastra commented on code in PR #6920:
URL: https://github.com/apache/iceberg/pull/6920#discussion_r1116071642


##########
api/src/test/java/org/apache/iceberg/expressions/TestExpressionUtil.java:
##########
@@ -596,6 +597,22 @@ public void testSanitizeDateNextWeek() {
         ExpressionUtil.toSanitizedString(Expressions.equal("test", nextWeek)));
   }
 
+  @Test
+  public void testSanitizeStringFallback() {
+    Pattern filterPattern = Pattern.compile("^test = 
\\(hash-[0-9a-fA-F]{8}\\)$");
+    for (String filter :
+        Lists.newArrayList(
+            "2022-20-29",
+            "2022-04-29T40:49:51.123456",
+            "2022-04-29T23:70:51-07:00",
+            "2022-04-29T23:49:51.123456+100:00")) {
+      String sanitizedFilter = 
ExpressionUtil.toSanitizedString(Expressions.equal("test", filter));
+      Assert.assertTrue(

Review Comment:
   rather than using `assertTrue` I think 
`Assertions.assertThat(filterPattern.matcher(sanitizedFilter)).matches();` 
would be better, because it will provide additional details when that assertion 
ever fails: `Expecting java.util.regex.Matcher[pattern=^test = 
\(hash-[0-9a-fA-F]{8}\)$ region=0,22 lastmatch=] to match.`



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to