com.ibm.streams.operator.window

Enum StreamWindowEvent.Type

  • java.lang.Object
    • Enum Constant Summary

      Enum Constants 
      Enum Constant and Description
      EVICTION
      Eviction of tuples from the window.
      FINAL
      Final punctuation event.
      INITIAL_FULL
      Event that signifies a sliding window has reached its initial window full event.
      INSERTION
      Insertion of tuples into a window.
      PARTITION_EVICTION
      Eviction of a partition and its tuples from a partitioned window.
      TRIGGER
      Trigger of a sliding window.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static StreamWindowEvent.Type valueOf(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static StreamWindowEvent.Type[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • INSERTION

        public static final StreamWindowEvent.Type INSERTION
        Insertion of tuples into a window. Listeners typically perform incremental state maintenance based upon the incoming tuples attribute values.
      • EVICTION

        public static final StreamWindowEvent.Type EVICTION
        Eviction of tuples from the window. Tuples are evicted from the window according to the eviction policy of the window.

        For a tumbling window all tuples are evicted as follows:

        • For a count-based eviction policy all tuples are evicted after the insertion of the N'th tuple where N is the size of the window. The INSERTION event precedes the EVICTION event.
        • For a time-based eviction policy all tuple are evicted every T seconds independent of tuple arrival at the port, where T is the time period. The first eviction will take place T seconds after the SPL runtime has notified the operator of port readiness, that is T seconds after the call to Operator.allPortsReady() is made. Note the timer will start at the time allPortsReady() is called, not at the point the Operator's implementation returns control to the SPL runtime.
        • For an attribute delta based policy, when a new tuple is received, if the delta between its eviction policy attribute value and that of the oldest tuple in the window is larger than the eviction policy size, then all tuples are evicted. The EVICTION event occurs before the INSERTION event.
        • For a punctuation-based eviction policy all tuples are evicted when a WINDOW_MARKER punctuation mark arrives.

        Note that for a tumbling window an EVICTION event will occur even if the window logically contained zero tuples or if the window contained tuples but no Tuple references were maintained due to their removal during event processing.

        For a sliding window tuples are evicted as follows:

        • For a count-based eviction policy, once the window contains N logical tuples the arrival of a tuple on the window's input port will result in the eviction of the oldest logical tuple in the window. The EVICTION event precedes the INSERTION event.
        • For a time-based eviction policy, tuples that have been in the window more than T seconds are evicted. Eviction is independent of insertion.
        • For an attribute delta based policy, the size defines the boundary of the window, as it slides, in the units of the eviction policy attribute. When a new tuple is received, existing tuples in the window for which the delta between the eviction policy attribute value of the new tuple and that of the existing tuple is greater than the eviction policy size, are evicted. The EVICTION event precedes the INSERTION event.

        For a sliding window an EVICTION event that would contain an empty Iterable is not made. This reduces overhead of empty calls for window handers that do not need to be notified of evictions, or where the state of the window did not change.

      • TRIGGER

        public static final StreamWindowEvent.Type TRIGGER
        Trigger of a sliding window. Trigger events occur according to the trigger policy of the sliding window.
        • For a count-based trigger policy of size N the trigger fires after N tuples have been logically inserted since the last trigger was fired, or since the window was created for the first trigger firing. The INSERTION event precedes the TRIGGER event.
        • For a time-based trigger policy the trigger fires every T seconds independent of tuple arrival at the port, where T is the time period of the policy. The first trigger will take place T seconds after the SPL runtime has notified the operator of port readiness, that is T seconds after the call to Operator.allPortsReady() is made. Note the timer will start at the time allPortsReady() is called, not at the point the Operator's implementation returns control to the SPL runtime.
        • For an attribute delta based trigger policy, the size defines the boundary of the sequence of tuples since the last trigger, that trigger the window again. When a new tuple is received, if the value of its trigger attribute is larger than that of the last tuple which triggered the window plus the trigger policy size, the window is triggered again. The TRIGGER event occurs before any EVICTION event when the window has a count or delta based eviction policy, and thus also precedes the INSERTION event.
      • INITIAL_FULL

        public static final StreamWindowEvent.Type INITIAL_FULL
        Event that signifies a sliding window has reached its initial window full event. The initial window full event only occurs for a sliding window, it allows window handlers to delay any actions until the window has been full at least once. The initial window full event timing depends upon the window's eviction policy.
        • For a count-based eviction policy of size N the window is initially full after the insertion of the N'th tuple. The INSERTION event precedes the INITIAL_FULL event, and the INITIAL_FULL precedes any count-based policy TRIGGER event due to the INSERTION. When the window is partitioned each partition will receive a INITIAL_FULL event once it has had N tuples inserted into it.
        • For a time-based eviction policy the INITIAL_FULL event will take place once SPL runtime has notified the operator of port readiness, that is the window starts out as full. When the window is partitioned, partitions created after the all ports ready notification will receive a INITIAL_FULL event when they are created. The INITIAL_FULL event precedes the the INSERTION event that caused the partition to be created.
        • For an attribute delta-based eviction policy, the window is initially full when delta between the first tuple in the window and the tuple being inserted exceeds the policy size for the defined attribute. The INITIAL_FULL event precedes the EVICTION and INSERTION events that triggered the initial full state. When the window is partitioned each partition will receive a INITIAL_FULL event independently driven by deltas between the first tuple in each partition and arriving tuples.

        If a partition is evicted (@link StreamWindow#evictPartition(Object)} then subsequent insertion of tuples with the same partition value act as a new partition, leading to another INITIAL_FULL event according to the eviction policy.

      • FINAL

        public static final StreamWindowEvent.Type FINAL
        Final punctuation event. The final punctuation occurs when the FINAL_MARKER is received by the input port, signifying that no more tuples or punctuation marks will arrive. Handling of the event will typically perform final actions based upon the remaining tuples in the window.
        Note that a FINAL event will be generated for each active window partition when the window is partitioned.
      • PARTITION_EVICTION

        public static final StreamWindowEvent.Type PARTITION_EVICTION
        Eviction of a partition and its tuples from a partitioned window.

        When a partition eviction is defined by the SPL invocation of the operator, partitions will be evicted according to the partition eviction policy. Partitions are always evicted oldest first, with the order defined by StreamWindow.getPartitions(). An empty partition is one that has no tuples according to its window eviction policy, e.g. a TIME policy TUMBLING window that has an EVICTION event, but no subsequent INSERTION event.

        • partitionCount(N) If after an INSERTION event the number of partitions is greater than N then the oldest empty partitions are evicted up to the oldest non-empty partition. The oldest non-empty partition will then be evicted if the partition count is greater than N.
        • tupleCount(N) If after an INSERTION event the total number of tuples in all partitions is greater than N then the oldest partitions (empty and non-empty) are evicted until the tuple count is less than or equal to N.
        • partitionAge(T) Any partitions that have not had a tuple inserted into them in the last T seconds are evicted. Partition eviction is independent of tuple insertion.
        For partitionCount(N) and tupleCount(N) if at least one partition is evicted then additionally all empty old partitions up to (but not including) the first non-empty partition partition are evicted. A partition is empty if it logically has no tuples in it according to its window configuration.

        An implementation of StreamWindowListener may call the StreamWindow.needsPartitionEviction() to determine if partition eviction after an INSERTION event will occur. If the listener evicts sufficient partitions (until needsPartitionEviction() returns false) during handling of the INSERTION event, then no additional partitions will be evicted automatically.
        Since:
        InfoSphere® Streams Version 2.0.0.3
    • Method Detail

      • values

        public static StreamWindowEvent.Type[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (StreamWindowEvent.Type c : StreamWindowEvent.Type.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static StreamWindowEvent.Type valueOf(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null