@@ -58,7 +58,7 @@ public class FunctionCompiler {
5858 * @param <O> output type of the transformation
5959 * @return a compiled function
6060 */
61- public <I , O > MapFunction <I , O > compile (TransformationDescriptor <I , O > descriptor ) {
61+ public static <I , O > MapFunction <I , O > compile (TransformationDescriptor <I , O > descriptor ) {
6262 // This is a dummy method but shows the intention of having something compilable in the descriptors.
6363 Function <I , O > function = descriptor .getJavaImplementation ();
6464 return (MapFunction <I , O >) i -> function .apply (i );
@@ -72,7 +72,7 @@ public <I, O> MapFunction<I, O> compile(TransformationDescriptor<I, O> descripto
7272 * @param <O> output type of the transformation
7373 * @return a compiled function
7474 */
75- public <I , O > FlatMapFunction <I , O > compile (FunctionDescriptor .SerializableFunction <I , Iterable <O >> flatMapDescriptor ) {
75+ public static <I , O > FlatMapFunction <I , O > compile (FunctionDescriptor .SerializableFunction <I , Iterable <O >> flatMapDescriptor ) {
7676 return (t , collector ) -> flatMapDescriptor .apply (t ).forEach (collector ::collect );
7777 }
7878
@@ -83,7 +83,7 @@ public <I, O> FlatMapFunction<I, O> compile(FunctionDescriptor.SerializableFunct
8383 * @param <T> input/output type of the transformation
8484 * @return a compiled function
8585 */
86- public <T > ReduceFunction <T > compile (ReduceDescriptor <T > descriptor ) {
86+ public static <T > ReduceFunction <T > compile (ReduceDescriptor <T > descriptor ) {
8787 // This is a dummy method but shows the intention of having something compilable in the descriptors.
8888 BiFunction <T , T , T > reduce_function = descriptor .getJavaImplementation ();
8989 return new ReduceFunction <T >() {
@@ -94,26 +94,26 @@ public T reduce(T t, T t1) throws Exception {
9494 };
9595 }
9696
97- public <T > FilterFunction <T > compile (PredicateDescriptor .SerializablePredicate <T > predicateDescriptor ) {
98- return t -> predicateDescriptor . test ( t ) ;
97+ public static <T > FilterFunction <T > compile (PredicateDescriptor .SerializablePredicate <T > predicateDescriptor ) {
98+ return predicateDescriptor :: test ;
9999 }
100100
101101
102- public <T > OutputFormat <T > compile (ConsumerDescriptor .SerializableConsumer <T > consumerDescriptor ) {
102+ public static <T > OutputFormat <T > compile (ConsumerDescriptor .SerializableConsumer <T > consumerDescriptor ) {
103103 return new OutputFormatConsumer <T >(consumerDescriptor );
104104 }
105105
106106
107- public <T , K > KeySelector <T , K > compileKeySelector (TransformationDescriptor <T , K > descriptor ){
107+ public static <T , K > KeySelector <T , K > compileKeySelector (TransformationDescriptor <T , K > descriptor ){
108108 return new KeySelectorFunction <T , K >(descriptor );
109109 }
110110
111- public <T0 , T1 , O > CoGroupFunction <T0 , T1 , O > compileCoGroup (){
111+ public static <T0 , T1 , O > CoGroupFunction <T0 , T1 , O > compileCoGroup (){
112112 return new FlinkCoGroupFunction <T0 , T1 , O >();
113113 }
114114
115115
116- public <T > TextOutputFormat .TextFormatter <T > compileOutput (TransformationDescriptor <T , String > formattingDescriptor ) {
116+ public static <T > TextOutputFormat .TextFormatter <T > compileOutput (TransformationDescriptor <T , String > formattingDescriptor ) {
117117 Function <T , String > format = formattingDescriptor .getJavaImplementation ();
118118 return new TextOutputFormat .TextFormatter <T >(){
119119
@@ -132,7 +132,7 @@ public String format(T value) {
132132 * @param <O> output type of the transformation
133133 * @return a compiled function
134134 */
135- public <I , O > MapPartitionFunction <I , O > compile (MapPartitionsDescriptor <I , O > descriptor ){
135+ public static <I , O > MapPartitionFunction <I , O > compile (MapPartitionsDescriptor <I , O > descriptor ){
136136 Function <Iterable <I >, Iterable <O >> function = descriptor .getJavaImplementation ();
137137 return new MapPartitionFunction <I , O >() {
138138 @ Override
@@ -146,13 +146,12 @@ public void mapPartition(Iterable<I> iterable, Collector<O> collector) throws Ex
146146 };
147147 }
148148
149- public <T > WayangConvergenceCriterion compile (PredicateDescriptor <Collection <T >> descriptor ){
150- FunctionDescriptor .SerializablePredicate <Collection <T >> predicate = descriptor .getJavaImplementation ();
151- return new WayangConvergenceCriterion (predicate );
149+ public static <T > WayangConvergenceCriterion <T > compile (PredicateDescriptor <Collection <T >> descriptor ){
150+ return new WayangConvergenceCriterion <T >(descriptor .getJavaImplementation ());
152151 }
153152
154153
155- public <I , O > RichFlatMapFunction <I , O > compile (FunctionDescriptor .ExtendedSerializableFunction <I , Iterable <O >> flatMapDescriptor , FlinkExecutionContext exe ) {
154+ public static <I , O > RichFlatMapFunction <I , O > compile (FunctionDescriptor .ExtendedSerializableFunction <I , Iterable <O >> flatMapDescriptor , FlinkExecutionContext exe ) {
156155
157156 return new RichFlatMapFunction <I , O >() {
158157 @ Override
@@ -168,7 +167,7 @@ public void flatMap(I value, Collector<O> out) throws Exception {
168167 }
169168
170169
171- public <I , O > RichMapFunction <I , O > compile (TransformationDescriptor <I , O > mapDescriptor , FlinkExecutionContext fex ) {
170+ public static <I , O > RichMapFunction <I , O > compile (TransformationDescriptor <I , O > mapDescriptor , FlinkExecutionContext fex ) {
172171
173172 FunctionDescriptor .ExtendedSerializableFunction <I , O > map = (FunctionDescriptor .ExtendedSerializableFunction ) mapDescriptor .getJavaImplementation ();
174173 return new RichMapFunction <I , O >() {
@@ -186,7 +185,7 @@ public void open(Configuration parameters) throws Exception {
186185
187186
188187
189- public <I , O > RichMapPartitionFunction <I , O > compile (MapPartitionsDescriptor <I , O > descriptor , FlinkExecutionContext fex ){
188+ public static <I , O > RichMapPartitionFunction <I , O > compile (MapPartitionsDescriptor <I , O > descriptor , FlinkExecutionContext fex ){
190189 FunctionDescriptor .ExtendedSerializableFunction <Iterable <I >, Iterable <O >> function =
191190 (FunctionDescriptor .ExtendedSerializableFunction <Iterable <I >, Iterable <O >>)
192191 descriptor .getJavaImplementation ();
0 commit comments