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.sql.catalyst.streaming.InternalOutputModes;
0022 
0023 /**
0024  * OutputMode describes what data will be written to a streaming sink when there is
0025  * new data available in a streaming DataFrame/Dataset.
0026  *
0027  * @since 2.0.0
0028  */
0029 @Evolving
0030 public class OutputMode {
0031 
0032   /**
0033    * OutputMode in which only the new rows in the streaming DataFrame/Dataset will be
0034    * written to the sink. This output mode can be only be used in queries that do not
0035    * contain any aggregation.
0036    *
0037    * @since 2.0.0
0038    */
0039   public static OutputMode Append() {
0040     return InternalOutputModes.Append$.MODULE$;
0041   }
0042 
0043   /**
0044    * OutputMode in which all the rows in the streaming DataFrame/Dataset will be written
0045    * to the sink every time there are some updates. This output mode can only be used in queries
0046    * that contain aggregations.
0047    *
0048    * @since 2.0.0
0049    */
0050   public static OutputMode Complete() {
0051     return InternalOutputModes.Complete$.MODULE$;
0052   }
0053 
0054   /**
0055    * OutputMode in which only the rows that were updated in the streaming DataFrame/Dataset will
0056    * be written to the sink every time there are some updates. If the query doesn't contain
0057    * aggregations, it will be equivalent to `Append` mode.
0058    *
0059    * @since 2.1.1
0060    */
0061   public static OutputMode Update() {
0062     return InternalOutputModes.Update$.MODULE$;
0063   }
0064 }