Package org.apache.calcite.rel.type
Class TimeFrameSet
java.lang.Object
org.apache.calcite.rel.type.TimeFrameSet
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Builds a collection of time frames. -
Method Summary
Modifier and TypeMethodDescriptionint
long
addTimestamp
(long timestamp, long interval, TimeFrame frame) static TimeFrameSet.Builder
builder()
Creates a Builder.int
Computes "FLOOR(date TO frame)", wheredate
is the number of days since UNIX Epoch.long
ceilTimestamp
(long ts, TimeFrame frame) Computes "CEIL(timestamp TO frame)", wherets
is the number of milliseconds since UNIX Epoch.int
long
diffTimestamp
(long timestamp, long timestamp2, TimeFrame frame) int
Computes "FLOOR(date TO frame)", wheredate
is the number of days since UNIX Epoch.long
floorTimestamp
(long ts, TimeFrame frame) Computes "FLOOR(timestamp TO frame)", wherets
is the number of milliseconds since UNIX Epoch.Returns the time frame with the given name, or throwsIllegalArgumentException
if not found.get
(org.apache.calcite.avatica.util.TimeUnit timeUnit) Returns the time frame with the given name, or throwsIllegalArgumentException
.@Nullable TimeFrame
Returns the time frame with the given name (case-insensitive), or returns null.@Nullable org.apache.calcite.avatica.util.TimeUnit
Returns the time unit that this time frame is based upon, or null.
-
Method Details
-
builder
Creates a Builder. -
getOpt
Returns the time frame with the given name (case-insensitive), or returns null. -
get
Returns the time frame with the given name, or throwsIllegalArgumentException
if not found. Ifname
is an alias, resolves to the underlying frame. -
get
Returns the time frame with the given name, or throwsIllegalArgumentException
. -
floorDate
Computes "FLOOR(date TO frame)", wheredate
is the number of days since UNIX Epoch. -
ceilDate
Computes "FLOOR(date TO frame)", wheredate
is the number of days since UNIX Epoch. -
floorTimestamp
Computes "FLOOR(timestamp TO frame)", wherets
is the number of milliseconds since UNIX Epoch. -
ceilTimestamp
Computes "CEIL(timestamp TO frame)", wherets
is the number of milliseconds since UNIX Epoch. -
getUnit
Returns the time unit that this time frame is based upon, or null. -
addDate
-
addTimestamp
-
diffDate
-
diffTimestamp
-