Skip to content

Commit

Permalink
API: Support sanitizing a Literal<?> (#11943)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgkeke authored Jan 16, 2025
1 parent d96901b commit 167d450
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ private static List<String> abbreviateValues(List<String> 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 167d450

Please sign in to comment.