diff --git a/api/src/main/java/org/apache/iceberg/expressions/ExpressionUtil.java b/api/src/main/java/org/apache/iceberg/expressions/ExpressionUtil.java index 68b9e9447926..028b07827b54 100644 --- a/api/src/main/java/org/apache/iceberg/expressions/ExpressionUtil.java +++ b/api/src/main/java/org/apache/iceberg/expressions/ExpressionUtil.java @@ -511,6 +511,10 @@ private static List abbreviateValues(List sanitizedValues) { return sanitizedValues; } + private static String sanitize(Type type, Literal lit, long now, int today) { + return sanitize(type, lit.value(), now, today); + } + private static String sanitize(Type type, Object value, long now, int today) { switch (type.typeId()) { case INTEGER: diff --git a/api/src/test/java/org/apache/iceberg/expressions/TestExpressionUtil.java b/api/src/test/java/org/apache/iceberg/expressions/TestExpressionUtil.java index 10d3b6d0adfa..902c0260d63a 100644 --- a/api/src/test/java/org/apache/iceberg/expressions/TestExpressionUtil.java +++ b/api/src/test/java/org/apache/iceberg/expressions/TestExpressionUtil.java @@ -417,6 +417,10 @@ public void testSanitizeDate() { Expressions.equal("test", "(date)"), ExpressionUtil.sanitize(Expressions.equal("test", "2022-04-29"))); + assertEquals( + Expressions.equal("date", "(date)"), + ExpressionUtil.sanitize(Expressions.equal("date", "2022-04-29").bind(STRUCT, true))); + assertEquals( Expressions.equal("date", "(date)"), ExpressionUtil.sanitize(STRUCT, Expressions.equal("date", "2022-04-29"), true));