public class OverlappingTimeWindowFunction extends java.lang.Object implements WindowFunction
Example with a window size of 12 hours, with the window separation of 1 hour, we end up with windows as follows:
(0:00 to 12:00), (1:00 to 13:00), (2:00 to 14:00) and so on.
If the offset was set to 15 minutes, windows would instead be at (0:15 to 12:15), (1:15 to 13:15), (2:15 to 14:15) and so on.
Note that the windows generated by this window function need not contain any data - i.e., it can generate empty an empty window if no data occurs in the specified time period.
| Modifier and Type | Class and Description |
|---|---|
static class |
OverlappingTimeWindowFunction.Builder |
| Constructor and Description |
|---|
OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit)
Constructor with zero offset
|
OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit,
boolean addWindowStartTimeColumn,
boolean addWindowEndTimeColumn)
Constructor with zero offset, ability to add window start/end time columns
|
OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit,
long offset,
java.util.concurrent.TimeUnit offsetUnit)
Constructor with optional offset
|
OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit,
long offset,
java.util.concurrent.TimeUnit offsetUnit,
boolean addWindowStartTimeColumn,
boolean addWindowEndTimeColumn,
boolean excludeEmptyWindows)
Constructor with optional offset, ability to add window start/end time columns
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.util.List<java.util.List<Writable>>> |
applyToSequence(java.util.List<java.util.List<Writable>> sequence)
Apply the windowing function to the given sequence
|
Schema |
getInputSchema() |
void |
setInputSchema(Schema schema) |
java.lang.String |
toString() |
Schema |
transform(Schema inputSchema)
Get the output schema, given the input schema.
|
public OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit)
timeColumn - Name of the column that contains the time values (must be a time column)windowSize - Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit - Unit of the time windowwindowSeparation - The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit - Unit for the separation between windowspublic OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit,
boolean addWindowStartTimeColumn,
boolean addWindowEndTimeColumn)
timeColumn - Name of the column that contains the time values (must be a time column)windowSize - Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit - Unit of the time windowwindowSeparation - The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit - Unit for the separation between windowspublic OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit,
long offset,
java.util.concurrent.TimeUnit offsetUnit)
timeColumn - Name of the column that contains the time values (must be a time column)windowSize - Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit - Unit of the time windowwindowSeparation - The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit - Unit for the separation between windowsoffset - Optional offset amount, to shift start/end of the time window forward or backoffsetUnit - Optional offset unit for the offset amount.public OverlappingTimeWindowFunction(java.lang.String timeColumn,
long windowSize,
java.util.concurrent.TimeUnit windowSizeUnit,
long windowSeparation,
java.util.concurrent.TimeUnit windowSeparationUnit,
long offset,
java.util.concurrent.TimeUnit offsetUnit,
boolean addWindowStartTimeColumn,
boolean addWindowEndTimeColumn,
boolean excludeEmptyWindows)
timeColumn - Name of the column that contains the time values (must be a time column)windowSize - Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit - Unit of the time windowwindowSeparation - The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit - Unit for the separation between windowsoffset - Optional offset amount, to shift start/end of the time window forward or backoffsetUnit - Optional offset unit for the offset amount.addWindowStartTimeColumn - If true: add a time column (name: "windowStartTime") that contains the start time
of the windowaddWindowEndTimeColumn - If true: add a time column (name: "windowEndTime") that contains the end time
of the windowexcludeEmptyWindows - If true: exclude any windows that don't have any values in thempublic void setInputSchema(Schema schema)
setInputSchema in interface WindowFunctionpublic Schema getInputSchema()
getInputSchema in interface WindowFunctionpublic Schema transform(Schema inputSchema)
WindowFunctiontransform in interface WindowFunctioninputSchema - Schema of the input datapublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<java.util.List<java.util.List<Writable>>> applyToSequence(java.util.List<java.util.List<Writable>> sequence)
WindowFunctionapplyToSequence in interface WindowFunctionsequence - the input sequence