Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
@PublicEvolving
public class GlobalWindows extends WindowAssigner<Object, GlobalWindow> {
   ··· 

   public static GlobalWindows create() {
/**
     * Creates a new {@link returnWindowAssigner} new GlobalWindows(new NeverTrigger());
    }
with {@link NeverTrigger} that assigns all elements to
    public static* GlobalWindowsthe createWithEndOfStreamTrigger()same {@link GlobalWindow}.
     *
   return new GlobalWindows(new EndOfStreamTrigger());
    }
}

...

 * @return The global window policy with {@link NeverTrigger} as default trigger.
     */
     public static GlobalWindows create() {
        return new GlobalWindows(new NeverTrigger());
    }
	
    /**
     * Creates a new {@link WindowAssigner} with {@link EndOfStreamTrigger} that assigns all
     * elements to the same {@link GlobalWindow} and the default trigger fires if and only if the
     * input stream reaches EOF.
     *
     * @return The global window policy with {@link EndOfStreamTrigger} as default trigger.
     */
     public static GlobalWindows createWithEndOfStreamTrigger() {
        return new GlobalWindows(new EndOfStreamTrigger());
    }
}


2) Add OperatorAttributesBuilder and OperatorAttributes for operator developers to specify operator attributes that Flink runtime can use to optimize the job performance.

Code Block
languagejava
package org.apache.flink.streaming.api.operators;
 
/** The builder class for {@link OperatorAttributes}. */
@Experimental
public class OperatorAttributesBuilder {
    @Nullable private Boolean outputOnEOF = null;
 
    public OperatorAttributesBuilder() {...}
 	
 	/** Set whether the operator emits results when its input has ended. */
    public OperatorAttributesBuilder setOutputOnEOF(boolean outputOnEOF) {...}
   
    /**
     * If any operator attribute is null, we will log it at DEBUG level and use the following
     * default values.
     * - outputOnEOF defaults to false
     */
     public OperatorAttributes build() {...}
}


Code Block
languagejava
package org.apache.flink.streaming.api.operators;
 
/**
 * OperatorAttributes element provides Job Manager with information that can be
 * Theused builderto classoptimize forthe {@linkjob OperatorAttributes}performance.
 */
@Experimental
public class OperatorAttributesBuilderOperatorAttributes {
    @Nullable private Boolean outputOnEOF = null;
 
   /**
 public OperatorAttributesBuilder() {...}
 
 * Returns true publiciff OperatorAttributesBuilderthe setOutputOnEOF(boolean outputOnEOF) {...}
   
    /**operator can only emit records after inputs have reached EOF.
     *
 If  any operator attribute* is<p>Here null,are wethe willimplications logwhen it atis DEBUGtrue:
 level and use the following*
     * default values.<ul>
     * - outputOnEOF defaults<li> toThe false
results of this operator as */
well as its chained  public OperatorAttributes build() {...}
}
Code Block
languagejava
package org.apache.flink.streaming.api.operators;
 
/**
 * OperatorAttributes element provides Job Manager with information that can be
 * used to optimize the job performance.
 */
@Experimental
public class OperatorAttributes {    
   /**operators have blocking partition type.
     *   <li> This operator as well as its chained operators will be executed in batch mode.
     * </ul>
     */
    public *boolean Returns true iff the operator can only emit records after inputs have reached EOF.isOutputOnEOF() {...}
}


3) Add the getOperatorAttributes() API to the StreamOperator and StreamOperatorFactory interfaces.

Code Block
languagejava
public interface StreamOperator<OUT> extends CheckpointListener, KeyContext, Serializable {
     *
     * <p>Here are the implications when it is true:...
	
     *
     * <ul>/**
     * Get the <li> The results{@link OperatorAttributes} of thisthe operator asthat wellthe asFlink itsruntime chainedcan operatorsuse have blocking partition type.to optimize
     * the job performance.
 <li> This operator as well*
 as its chained operators will* be@return executedOperatorAttributes inof batchthe modeoperator.
     * </ul>
     */@Experimental
    publicdefault booleanOperatorAttributes isOutputOnEOFgetOperatorAttributes() {...}
}

3) Add the getOperatorAttributes() API to the StreamOperator and StreamOperatorFactory interfaces.

Code Block
languagejava

        return new OperatorAttributesBuilder().build();
    }
}
 

public interface StreamOperator<OUT>StreamOperatorFactory<OUT> extends CheckpointListener, KeyContext, Serializable {
    ...

    /**
     * Get the {@link OperatorAttributes} of the operator created by the factory. Flink runtime can
     @Experimental
* use it to defaultoptimize OperatorAttributesthe getOperatorAttributes() {job performance.
     *
   return new OperatorAttributesBuilder().build();
    }
}
 

public interface StreamOperatorFactory<OUT> extends Serializable {
    ...
    * @return OperatorAttributes of the operator created by the factory.
     */
    @Experimental
    default OperatorAttributes getOperatorAttributes() {
        return new OperatorAttributesBuilder().build();
    }
}

...