Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *    http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 package org.apache.spark.sql.streaming;
0019 
0020 import org.apache.spark.annotation.Evolving;
0021 import org.apache.spark.annotation.Experimental;
0022 import org.apache.spark.sql.catalyst.plans.logical.*;
0023 
0024 /**
0025  * Represents the type of timeouts possible for the Dataset operations
0026  * `mapGroupsWithState` and `flatMapGroupsWithState`. See documentation on
0027  * `GroupState` for more details.
0028  *
0029  * @since 2.2.0
0030  */
0031 @Experimental
0032 @Evolving
0033 public class GroupStateTimeout {
0034 
0035   /**
0036    * Timeout based on processing time. The duration of timeout can be set for each group in
0037    * `map/flatMapGroupsWithState` by calling `GroupState.setTimeoutDuration()`. See documentation
0038    * on `GroupState` for more details.
0039    */
0040   public static GroupStateTimeout ProcessingTimeTimeout() {
0041     return ProcessingTimeTimeout$.MODULE$;
0042   }
0043 
0044   /**
0045    * Timeout based on event-time. The event-time timestamp for timeout can be set for each
0046    * group in `map/flatMapGroupsWithState` by calling `GroupState.setTimeoutTimestamp()`.
0047    * In addition, you have to define the watermark in the query using `Dataset.withWatermark`.
0048    * When the watermark advances beyond the set timestamp of a group and the group has not
0049    * received any data, then the group times out. See documentation on
0050    * `GroupState` for more details.
0051    */
0052   public static GroupStateTimeout EventTimeTimeout() { return EventTimeTimeout$.MODULE$; }
0053 
0054   /** No timeout. */
0055   public static GroupStateTimeout NoTimeout() { return NoTimeout$.MODULE$; }
0056 
0057 }