[enhance](mtmv)mtmv date trunc support hour (#37678) (#38422)

pick: https://github.com/apache/doris/pull/37678
This commit is contained in:
zhangdong
2024-07-31 10:46:08 +08:00
committed by GitHub
parent c78e04ac31
commit 319933d0a6
2 changed files with 32 additions and 12 deletions

View File

@ -47,7 +47,7 @@ import java.util.Optional;
import java.util.Set;
public class MTMVPartitionExprDateTrunc implements MTMVPartitionExprService {
private static Set<String> timeUnits = ImmutableSet.of("year", "month", "day");
private static Set<String> timeUnits = ImmutableSet.of("year", "month", "day", "hour");
private String timeUnit;
public MTMVPartitionExprDateTrunc(FunctionCallExpr functionCallExpr) throws AnalysisException {
@ -202,6 +202,9 @@ public class MTMVPartitionExprDateTrunc implements MTMVPartitionExprService {
case "day":
result = value.plusDays(1L);
break;
case "hour":
result = value.plusHours(1L);
break;
default:
throw new AnalysisException(
"async materialized view partition roll up not support timeUnit: " + timeUnit);