Class WindowMapState<W,​UV>

  • All Implemented Interfaces:
    WindowState<W>

    public final class WindowMapState<W,​UV>
    extends Object
    implements WindowState<W>
    A wrapper of MapState which is easier to update based on window namespace.
    • Constructor Summary

      Constructors 
      Constructor Description
      WindowMapState​(org.apache.flink.runtime.state.internal.InternalMapState<org.apache.flink.table.data.RowData,​W,​org.apache.flink.table.data.RowData,​UV> windowState)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear​(W window)
      Removes the value mapped under current key and the given window.
      boolean contains​(W window, org.apache.flink.table.data.RowData key)
      Returns whether there exists the given mapping.
      Iterable<Map.Entry<org.apache.flink.table.data.RowData,​UV>> entries​(W window)
      Returns all the mappings in the state.
      UV get​(W window, org.apache.flink.table.data.RowData key)
      Returns the current value associated with the given key.
      boolean isEmpty​(W window)
      Returns true if this state contains no key-value mappings, otherwise false.
      Iterator<Map.Entry<org.apache.flink.table.data.RowData,​UV>> iterator​(W window)
      Iterates over all the mappings in the state.
      Iterable<org.apache.flink.table.data.RowData> keys​(W window)
      Returns all the keys in the state.
      void put​(W window, org.apache.flink.table.data.RowData key, UV value)
      Associates a new value with the given key.
      void putAll​(W window, Map<org.apache.flink.table.data.RowData,​UV> map)
      Copies all of the mappings from the given map into the state.
      void remove​(W window, org.apache.flink.table.data.RowData key)
      Deletes the mapping of the given key.
      Iterable<UV> values​(W window)
      Returns all the values in the state.
    • Constructor Detail

      • WindowMapState

        public WindowMapState​(org.apache.flink.runtime.state.internal.InternalMapState<org.apache.flink.table.data.RowData,​W,​org.apache.flink.table.data.RowData,​UV> windowState)
    • Method Detail

      • clear

        public void clear​(W window)
        Description copied from interface: WindowState
        Removes the value mapped under current key and the given window.
        Specified by:
        clear in interface WindowState<W>
      • get

        public UV get​(W window,
                      org.apache.flink.table.data.RowData key)
               throws Exception
        Returns the current value associated with the given key.
        Parameters:
        key - The key of the mapping
        Returns:
        The value of the mapping with the given key
        Throws:
        Exception - Thrown if the system cannot access the state.
      • put

        public void put​(W window,
                        org.apache.flink.table.data.RowData key,
                        UV value)
                 throws Exception
        Associates a new value with the given key.
        Parameters:
        key - The key of the mapping
        value - The new value of the mapping
        Throws:
        Exception - Thrown if the system cannot access the state.
      • putAll

        public void putAll​(W window,
                           Map<org.apache.flink.table.data.RowData,​UV> map)
                    throws Exception
        Copies all of the mappings from the given map into the state.
        Parameters:
        map - The mappings to be stored in this state
        Throws:
        Exception - Thrown if the system cannot access the state.
      • remove

        public void remove​(W window,
                           org.apache.flink.table.data.RowData key)
                    throws Exception
        Deletes the mapping of the given key.
        Parameters:
        key - The key of the mapping
        Throws:
        Exception - Thrown if the system cannot access the state.
      • contains

        public boolean contains​(W window,
                                org.apache.flink.table.data.RowData key)
                         throws Exception
        Returns whether there exists the given mapping.
        Parameters:
        key - The key of the mapping
        Returns:
        True if there exists a mapping whose key equals to the given key
        Throws:
        Exception - Thrown if the system cannot access the state.
      • entries

        public Iterable<Map.Entry<org.apache.flink.table.data.RowData,​UV>> entries​(W window)
                                                                                  throws Exception
        Returns all the mappings in the state.
        Returns:
        An iterable view of all the key-value pairs in the state.
        Throws:
        Exception - Thrown if the system cannot access the state.
      • keys

        public Iterable<org.apache.flink.table.data.RowData> keys​(W window)
                                                           throws Exception
        Returns all the keys in the state.
        Returns:
        An iterable view of all the keys in the state.
        Throws:
        Exception - Thrown if the system cannot access the state.
      • values

        public Iterable<UV> values​(W window)
                            throws Exception
        Returns all the values in the state.
        Returns:
        An iterable view of all the values in the state.
        Throws:
        Exception - Thrown if the system cannot access the state.
      • iterator

        public Iterator<Map.Entry<org.apache.flink.table.data.RowData,​UV>> iterator​(W window)
                                                                                   throws Exception
        Iterates over all the mappings in the state.
        Returns:
        An iterator over all the mappings in the state
        Throws:
        Exception - Thrown if the system cannot access the state.
      • isEmpty

        public boolean isEmpty​(W window)
                        throws Exception
        Returns true if this state contains no key-value mappings, otherwise false.
        Returns:
        True if this state contains no key-value mappings, otherwise false.
        Throws:
        Exception - Thrown if the system cannot access the state.