Package org.apache.flink.table.catalog
Class IntervalFreshness
- java.lang.Object
-
- org.apache.flink.table.catalog.IntervalFreshness
-
@PublicEvolving public class IntervalFreshness extends Object
TheIntervalFreshnessrepresents freshness definition ofCatalogMaterializedTable. It encapsulates the string interval value along with time unit, allowing for flexible representation of different freshness type. Moreover, it can provide detailed raw information for some specific operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIntervalFreshness.TimeUnitAn enumeration of time unit representing the unit of interval freshness.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringconvertFreshnessToCron(IntervalFreshness intervalFreshness)Converts the freshness of materialized table to cron expression in full refresh mode.booleanequals(Object o)static IntervalFreshnessfromDuration(Duration duration)Creates an IntervalFreshness from a Duration, choosing the most appropriate time unit.StringgetInterval()Deprecated.UsegetIntervalInt()instead.intgetIntervalInt()IntervalFreshness.TimeUnitgetTimeUnit()inthashCode()static IntervalFreshnessof(String interval, IntervalFreshness.TimeUnit timeUnit)static IntervalFreshnessofDay(String interval)static IntervalFreshnessofHour(String interval)static IntervalFreshnessofMinute(String interval)static IntervalFreshnessofSecond(String interval)DurationtoDuration()StringtoString()static voidvalidateFreshnessForCron(IntervalFreshness intervalFreshness)Validates that the given freshness can be converted to a cron expression in full refresh mode.
-
-
-
Method Detail
-
of
public static IntervalFreshness of(String interval, IntervalFreshness.TimeUnit timeUnit)
-
ofSecond
public static IntervalFreshness ofSecond(String interval)
-
ofMinute
public static IntervalFreshness ofMinute(String interval)
-
ofHour
public static IntervalFreshness ofHour(String interval)
-
ofDay
public static IntervalFreshness ofDay(String interval)
-
validateFreshnessForCron
public static void validateFreshnessForCron(IntervalFreshness intervalFreshness)
Validates that the given freshness can be converted to a cron expression in full refresh mode. Since freshness and cron expression cannot be converted equivalently, there are currently only a limited patterns of freshness that are supported.- Parameters:
intervalFreshness- the freshness to validate- Throws:
ValidationException- if the freshness cannot be converted to a valid cron expression
-
convertFreshnessToCron
public static String convertFreshnessToCron(IntervalFreshness intervalFreshness)
Converts the freshness of materialized table to cron expression in full refresh mode. The freshness must first pass validation viavalidateFreshnessForCron(org.apache.flink.table.catalog.IntervalFreshness).- Parameters:
intervalFreshness- the freshness to convert- Returns:
- the corresponding cron expression
- Throws:
ValidationException- if the freshness cannot be converted to a valid cron expression
-
fromDuration
public static IntervalFreshness fromDuration(Duration duration)
Creates an IntervalFreshness from a Duration, choosing the most appropriate time unit. Prefers larger units when possible (e.g., 60 seconds → 1 minute).
-
getInterval
@Deprecated public String getInterval()
Deprecated.UsegetIntervalInt()instead.
-
getIntervalInt
public int getIntervalInt()
-
getTimeUnit
public IntervalFreshness.TimeUnit getTimeUnit()
-
toDuration
public Duration toDuration()
-
-