Skip to content

Commit

Permalink
remove space
Browse files Browse the repository at this point in the history
  • Loading branch information
feiniaofeiafei committed Dec 25, 2024
1 parent 9ada9e4 commit b6dedaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public class DateFormat extends ScalarFunction
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateType.INSTANCE, VarcharType.SYSTEM_DEFAULT)
);

private static final Set<String> monoFormat = ImmutableSet.of("yyyyMMdd", "yyyy-MM-dd", "yyyy-MM-ddHH:mm:ss",
"%Y", "%Y-%m", "%Y-%m-%d", "%Y-%m-%d%H", "%Y-%m-%d%H:%i", "%Y-%m-%d%H:%i:%s", "%Y-%m-%d%H:%i:%S",
"%Y-%m-%d%T", "%Y%m%d", "%Y%m");
private static final Set<String> monoFormat = ImmutableSet.of("yyyyMMdd", "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss",
"%Y", "%Y-%m", "%Y-%m-%d", "%Y-%m-%d %H", "%Y-%m-%d %H:%i", "%Y-%m-%d %H:%i:%s", "%Y-%m-%d %H:%i:%S",
"%Y-%m-%d %T", "%Y%m%d", "%Y%m");

/**
* constructor with 2 arguments.
Expand Down Expand Up @@ -90,8 +90,7 @@ public boolean isMonotonic(Literal lower, Literal upper) {
if (!(format instanceof VarcharLiteral)) {
return false;
}
VarcharLiteral varcharLiteral = (VarcharLiteral) format;
String str = varcharLiteral.getValue().replace(" ", "");
String str = ((VarcharLiteral) format).getValue();
return monoFormat.contains(str);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ suite("always_mono_func") {
}
explain {
sql """select * from always_mono_func where date_format(dt, "%Y %m") > "2019 01" """
contains("partitions=2/5 (p4,p5)")
contains("partitions=5/5 (p1,p2,p3,p4,p5)")
}

explain {
Expand Down

0 comments on commit b6dedaf

Please sign in to comment.