Class TimeFrameSet

java.lang.Object
org.apache.calcite.rel.type.TimeFrameSet

public class TimeFrameSet extends Object
Set of TimeFrame definitions.

Every SQL statement has a time frame set, and is accessed via RelDataTypeSystem.deriveTimeFrameSet(TimeFrameSet). If you want to use a custom set of time frames, you should override that method.

  • Method Details

    • builder

      public static TimeFrameSet.Builder builder()
      Creates a Builder.
    • getOpt

      public @Nullable TimeFrame getOpt(String name)
      Returns the time frame with the given name (case-insensitive), or returns null.
    • get

      public TimeFrame get(String name)
      Returns the time frame with the given name, or throws IllegalArgumentException if not found. If name is an alias, resolves to the underlying frame.
    • get

      public TimeFrame get(org.apache.calcite.avatica.util.TimeUnit timeUnit)
      Returns the time frame with the given name, or throws IllegalArgumentException.
    • floorDate

      public int floorDate(int date, TimeFrame frame)
      Computes "FLOOR(date TO frame)", where date is the number of days since UNIX Epoch.
    • ceilDate

      public int ceilDate(int date, TimeFrame frame)
      Computes "FLOOR(date TO frame)", where date is the number of days since UNIX Epoch.
    • floorTimestamp

      public long floorTimestamp(long ts, TimeFrame frame)
      Computes "FLOOR(timestamp TO frame)", where ts is the number of milliseconds since UNIX Epoch.
    • ceilTimestamp

      public long ceilTimestamp(long ts, TimeFrame frame)
      Computes "CEIL(timestamp TO frame)", where ts is the number of milliseconds since UNIX Epoch.
    • getUnit

      public @Nullable org.apache.calcite.avatica.util.TimeUnit getUnit(TimeFrame timeFrame)
      Returns the time unit that this time frame is based upon, or null.
    • addDate

      public int addDate(int date, int interval, TimeFrame frame)
    • addTimestamp

      public long addTimestamp(long timestamp, long interval, TimeFrame frame)
    • diffDate

      public int diffDate(int date, int date2, TimeFrame frame)
    • diffTimestamp

      public long diffTimestamp(long timestamp, long timestamp2, TimeFrame frame)