Class CalendarWindows.YearsWindows
- java.lang.Object
-
- org.apache.beam.sdk.transforms.windowing.WindowFn<T,W>
-
- org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn<T,W>
-
- org.apache.beam.sdk.transforms.windowing.PartitioningWindowFn<java.lang.Object,IntervalWindow>
-
- org.apache.beam.sdk.transforms.windowing.CalendarWindows.YearsWindows
-
- All Implemented Interfaces:
java.io.Serializable
,HasDisplayData
- Enclosing class:
- CalendarWindows
public static class CalendarWindows.YearsWindows extends PartitioningWindowFn<java.lang.Object,IntervalWindow>
AWindowFn
that windows elements into periods measured by years.By default, periods of multiple years are measured starting at the epoch. This can be overridden with
withStartingYear(int)
.Years start on the first day of each calendar year, unless overridden by
beginningOnDay(int, int)
.The time zone used to determine calendar boundaries is UTC, unless this is overridden with the
withTimeZone(org.joda.time.DateTimeZone)
method.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.beam.sdk.transforms.windowing.WindowFn
WindowFn.AssignContext, WindowFn.MergeContext
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntervalWindow
assignWindow(org.joda.time.Instant timestamp)
Returns the single window to which elements with this timestamp belong.CalendarWindows.YearsWindows
beginningOnDay(int monthOfYear, int dayOfMonth)
int
getDayOfMonth()
int
getMonthOfYear()
int
getNumber()
org.joda.time.DateTime
getStartDate()
org.joda.time.DateTimeZone
getTimeZone()
boolean
isCompatible(WindowFn<?,?> other)
Returns whether this performs the same merging as the givenWindowFn
.void
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.void
verifyCompatibility(WindowFn<?,?> other)
ThrowIncompatibleWindowException
if this WindowFn does not perform the same merging as the given $WindowFn
.Coder<IntervalWindow>
windowCoder()
Returns theCoder
used for serializing the windows used by this windowFn.CalendarWindows.YearsWindows
withStartingYear(int year)
CalendarWindows.YearsWindows
withTimeZone(org.joda.time.DateTimeZone timeZone)
-
Methods inherited from class org.apache.beam.sdk.transforms.windowing.PartitioningWindowFn
assignsToOneWindow, assignWindows, getDefaultWindowMappingFn
-
Methods inherited from class org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn
isNonMerging, mergeWindows
-
Methods inherited from class org.apache.beam.sdk.transforms.windowing.WindowFn
getWindowTypeDescriptor
-
-
-
-
Method Detail
-
beginningOnDay
public CalendarWindows.YearsWindows beginningOnDay(int monthOfYear, int dayOfMonth)
-
withStartingYear
public CalendarWindows.YearsWindows withStartingYear(int year)
-
withTimeZone
public CalendarWindows.YearsWindows withTimeZone(org.joda.time.DateTimeZone timeZone)
-
assignWindow
public IntervalWindow assignWindow(org.joda.time.Instant timestamp)
Description copied from class:PartitioningWindowFn
Returns the single window to which elements with this timestamp belong.- Specified by:
assignWindow
in classPartitioningWindowFn<java.lang.Object,IntervalWindow>
-
windowCoder
public Coder<IntervalWindow> windowCoder()
Description copied from class:WindowFn
Returns theCoder
used for serializing the windows used by this windowFn.- Specified by:
windowCoder
in classWindowFn<java.lang.Object,IntervalWindow>
-
isCompatible
public boolean isCompatible(WindowFn<?,?> other)
Description copied from class:WindowFn
Returns whether this performs the same merging as the givenWindowFn
.- Specified by:
isCompatible
in classWindowFn<java.lang.Object,IntervalWindow>
-
verifyCompatibility
public void verifyCompatibility(WindowFn<?,?> other) throws IncompatibleWindowException
Description copied from class:WindowFn
ThrowIncompatibleWindowException
if this WindowFn does not perform the same merging as the given $WindowFn
.- Overrides:
verifyCompatibility
in classWindowFn<java.lang.Object,IntervalWindow>
- Throws:
IncompatibleWindowException
- if compared WindowFns are not compatible.
-
populateDisplayData
public void populateDisplayData(DisplayData.Builder builder)
Description copied from class:WindowFn
Register display data for the given transform or component.populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData)
. Implementations may callsuper.populateDisplayData(builder)
in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)
to use the namespace of the subcomponent.By default, does not register any display data. Implementors may override this method to provide their own display data.
- Specified by:
populateDisplayData
in interfaceHasDisplayData
- Overrides:
populateDisplayData
in classWindowFn<java.lang.Object,IntervalWindow>
- Parameters:
builder
- The builder to populate with display data.- See Also:
HasDisplayData
-
getTimeZone
public org.joda.time.DateTimeZone getTimeZone()
-
getStartDate
public org.joda.time.DateTime getStartDate()
-
getDayOfMonth
public int getDayOfMonth()
-
getMonthOfYear
public int getMonthOfYear()
-
getNumber
public int getNumber()
-
-