Java Code Examples for org.apache.flink.api.common.operators.Keys.SelectorFunctionKeys#getInputType()
The following examples show how to use
org.apache.flink.api.common.operators.Keys.SelectorFunctionKeys#getInputType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyFunctions.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public static <T, K> org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> appendKeyRemover( org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> inputWithKey, SelectorFunctionKeys<T, K> key) { TypeInformation<T> inputType = key.getInputType(); TypeInformation<Tuple2<K, T>> typeInfoWithKey = createTypeWithKey(key); MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>> mapper = new MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>>( new KeyRemovingMapper<T, K>(), new UnaryOperatorInformation<>(typeInfoWithKey, inputType), "Key Remover" ); mapper.setInput(inputWithKey); mapper.setParallelism(inputWithKey.getParallelism()); return mapper; }
Example 2
Source File: KeyFunctions.java From flink with Apache License 2.0 | 6 votes |
public static <T, K> org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> appendKeyRemover( org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> inputWithKey, SelectorFunctionKeys<T, K> key) { TypeInformation<T> inputType = key.getInputType(); TypeInformation<Tuple2<K, T>> typeInfoWithKey = createTypeWithKey(key); MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>> mapper = new MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>>( new KeyRemovingMapper<T, K>(), new UnaryOperatorInformation<>(typeInfoWithKey, inputType), "Key Remover" ); mapper.setInput(inputWithKey); mapper.setParallelism(inputWithKey.getParallelism()); return mapper; }
Example 3
Source File: KeyFunctions.java From flink with Apache License 2.0 | 6 votes |
public static <T, K> org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> appendKeyRemover( org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> inputWithKey, SelectorFunctionKeys<T, K> key) { TypeInformation<T> inputType = key.getInputType(); TypeInformation<Tuple2<K, T>> typeInfoWithKey = createTypeWithKey(key); MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>> mapper = new MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>>( new KeyRemovingMapper<T, K>(), new UnaryOperatorInformation<>(typeInfoWithKey, inputType), "Key Remover" ); mapper.setInput(inputWithKey); mapper.setParallelism(inputWithKey.getParallelism()); return mapper; }
Example 4
Source File: KeyFunctions.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T, K> org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> appendKeyExtractor( org.apache.flink.api.common.operators.Operator<T> input, SelectorFunctionKeys<T, K> key) { if (input instanceof Union) { // if input is a union, we apply the key extractors recursively to all inputs org.apache.flink.api.common.operators.Operator<T> firstInput = ((Union) input).getFirstInput(); org.apache.flink.api.common.operators.Operator<T> secondInput = ((Union) input).getSecondInput(); org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> firstInputWithKey = appendKeyExtractor(firstInput, key); org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> secondInputWithKey = appendKeyExtractor(secondInput, key); return new Union(firstInputWithKey, secondInputWithKey, input.getName()); } TypeInformation<T> inputType = key.getInputType(); TypeInformation<Tuple2<K, T>> typeInfoWithKey = createTypeWithKey(key); KeyExtractingMapper<T, K> extractor = new KeyExtractingMapper(key.getKeyExtractor()); MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>> mapper = new MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>>( extractor, new UnaryOperatorInformation(inputType, typeInfoWithKey), "Key Extractor" ); mapper.setInput(input); mapper.setParallelism(input.getParallelism()); return mapper; }
Example 5
Source File: KeyFunctions.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T, K1, K2> org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> appendKeyExtractor( org.apache.flink.api.common.operators.Operator<T> input, SelectorFunctionKeys<T, K1> key1, SelectorFunctionKeys<T, K2> key2) { if (input instanceof Union) { // if input is a union, we apply the key extractors recursively to all inputs org.apache.flink.api.common.operators.Operator<T> firstInput = ((Union) input).getFirstInput(); org.apache.flink.api.common.operators.Operator<T> secondInput = ((Union) input).getSecondInput(); org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> firstInputWithKey = appendKeyExtractor(firstInput, key1, key2); org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> secondInputWithKey = appendKeyExtractor(secondInput, key1, key2); return new Union(firstInputWithKey, secondInputWithKey, input.getName()); } TypeInformation<T> inputType = key1.getInputType(); TypeInformation<Tuple3<K1, K2, T>> typeInfoWithKey = createTypeWithKey(key1, key2); TwoKeyExtractingMapper<T, K1, K2> extractor = new TwoKeyExtractingMapper<>(key1.getKeyExtractor(), key2.getKeyExtractor()); MapOperatorBase<T, Tuple3<K1, K2, T>, MapFunction<T, Tuple3<K1, K2, T>>> mapper = new MapOperatorBase<T, Tuple3<K1, K2, T>, MapFunction<T, Tuple3<K1, K2, T>>>( extractor, new UnaryOperatorInformation<>(inputType, typeInfoWithKey), "Key Extractor" ); mapper.setInput(input); mapper.setParallelism(input.getParallelism()); return mapper; }
Example 6
Source File: KeyFunctions.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T, K> org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> appendKeyExtractor( org.apache.flink.api.common.operators.Operator<T> input, SelectorFunctionKeys<T, K> key) { if (input instanceof Union) { // if input is a union, we apply the key extractors recursively to all inputs org.apache.flink.api.common.operators.Operator<T> firstInput = ((Union) input).getFirstInput(); org.apache.flink.api.common.operators.Operator<T> secondInput = ((Union) input).getSecondInput(); org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> firstInputWithKey = appendKeyExtractor(firstInput, key); org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> secondInputWithKey = appendKeyExtractor(secondInput, key); return new Union(firstInputWithKey, secondInputWithKey, input.getName()); } TypeInformation<T> inputType = key.getInputType(); TypeInformation<Tuple2<K, T>> typeInfoWithKey = createTypeWithKey(key); KeyExtractingMapper<T, K> extractor = new KeyExtractingMapper(key.getKeyExtractor()); MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>> mapper = new MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>>( extractor, new UnaryOperatorInformation(inputType, typeInfoWithKey), "Key Extractor" ); mapper.setInput(input); mapper.setParallelism(input.getParallelism()); return mapper; }
Example 7
Source File: KeyFunctions.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T, K1, K2> org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> appendKeyExtractor( org.apache.flink.api.common.operators.Operator<T> input, SelectorFunctionKeys<T, K1> key1, SelectorFunctionKeys<T, K2> key2) { if (input instanceof Union) { // if input is a union, we apply the key extractors recursively to all inputs org.apache.flink.api.common.operators.Operator<T> firstInput = ((Union) input).getFirstInput(); org.apache.flink.api.common.operators.Operator<T> secondInput = ((Union) input).getSecondInput(); org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> firstInputWithKey = appendKeyExtractor(firstInput, key1, key2); org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> secondInputWithKey = appendKeyExtractor(secondInput, key1, key2); return new Union(firstInputWithKey, secondInputWithKey, input.getName()); } TypeInformation<T> inputType = key1.getInputType(); TypeInformation<Tuple3<K1, K2, T>> typeInfoWithKey = createTypeWithKey(key1, key2); TwoKeyExtractingMapper<T, K1, K2> extractor = new TwoKeyExtractingMapper<>(key1.getKeyExtractor(), key2.getKeyExtractor()); MapOperatorBase<T, Tuple3<K1, K2, T>, MapFunction<T, Tuple3<K1, K2, T>>> mapper = new MapOperatorBase<T, Tuple3<K1, K2, T>, MapFunction<T, Tuple3<K1, K2, T>>>( extractor, new UnaryOperatorInformation<>(inputType, typeInfoWithKey), "Key Extractor" ); mapper.setInput(input); mapper.setParallelism(input.getParallelism()); return mapper; }
Example 8
Source File: KeyFunctions.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T, K> org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> appendKeyExtractor( org.apache.flink.api.common.operators.Operator<T> input, SelectorFunctionKeys<T, K> key) { if (input instanceof Union) { // if input is a union, we apply the key extractors recursively to all inputs org.apache.flink.api.common.operators.Operator<T> firstInput = ((Union) input).getFirstInput(); org.apache.flink.api.common.operators.Operator<T> secondInput = ((Union) input).getSecondInput(); org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> firstInputWithKey = appendKeyExtractor(firstInput, key); org.apache.flink.api.common.operators.Operator<Tuple2<K, T>> secondInputWithKey = appendKeyExtractor(secondInput, key); return new Union(firstInputWithKey, secondInputWithKey, input.getName()); } TypeInformation<T> inputType = key.getInputType(); TypeInformation<Tuple2<K, T>> typeInfoWithKey = createTypeWithKey(key); KeyExtractingMapper<T, K> extractor = new KeyExtractingMapper(key.getKeyExtractor()); MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>> mapper = new MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>>( extractor, new UnaryOperatorInformation(inputType, typeInfoWithKey), "Key Extractor" ); mapper.setInput(input); mapper.setParallelism(input.getParallelism()); return mapper; }
Example 9
Source File: KeyFunctions.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T, K1, K2> org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> appendKeyExtractor( org.apache.flink.api.common.operators.Operator<T> input, SelectorFunctionKeys<T, K1> key1, SelectorFunctionKeys<T, K2> key2) { if (input instanceof Union) { // if input is a union, we apply the key extractors recursively to all inputs org.apache.flink.api.common.operators.Operator<T> firstInput = ((Union) input).getFirstInput(); org.apache.flink.api.common.operators.Operator<T> secondInput = ((Union) input).getSecondInput(); org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> firstInputWithKey = appendKeyExtractor(firstInput, key1, key2); org.apache.flink.api.common.operators.Operator<Tuple3<K1, K2, T>> secondInputWithKey = appendKeyExtractor(secondInput, key1, key2); return new Union(firstInputWithKey, secondInputWithKey, input.getName()); } TypeInformation<T> inputType = key1.getInputType(); TypeInformation<Tuple3<K1, K2, T>> typeInfoWithKey = createTypeWithKey(key1, key2); TwoKeyExtractingMapper<T, K1, K2> extractor = new TwoKeyExtractingMapper<>(key1.getKeyExtractor(), key2.getKeyExtractor()); MapOperatorBase<T, Tuple3<K1, K2, T>, MapFunction<T, Tuple3<K1, K2, T>>> mapper = new MapOperatorBase<T, Tuple3<K1, K2, T>, MapFunction<T, Tuple3<K1, K2, T>>>( extractor, new UnaryOperatorInformation<>(inputType, typeInfoWithKey), "Key Extractor" ); mapper.setInput(input); mapper.setParallelism(input.getParallelism()); return mapper; }
Example 10
Source File: KeyFunctions.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public static <T, K> TypeInformation<Tuple2<K, T>> createTypeWithKey( SelectorFunctionKeys<T, K> key) { return new TupleTypeInfo<>(key.getKeyType(), key.getInputType()); }
Example 11
Source File: KeyFunctions.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public static <T, K1, K2> TypeInformation<Tuple3<K1, K2, T>> createTypeWithKey( SelectorFunctionKeys<T, K1> key1, SelectorFunctionKeys<T, K2> key2) { return new TupleTypeInfo<>(key1.getKeyType(), key2.getKeyType(), key1.getInputType()); }
Example 12
Source File: KeyFunctions.java From flink with Apache License 2.0 | 4 votes |
public static <T, K> TypeInformation<Tuple2<K, T>> createTypeWithKey( SelectorFunctionKeys<T, K> key) { return new TupleTypeInfo<>(key.getKeyType(), key.getInputType()); }
Example 13
Source File: KeyFunctions.java From flink with Apache License 2.0 | 4 votes |
public static <T, K1, K2> TypeInformation<Tuple3<K1, K2, T>> createTypeWithKey( SelectorFunctionKeys<T, K1> key1, SelectorFunctionKeys<T, K2> key2) { return new TupleTypeInfo<>(key1.getKeyType(), key2.getKeyType(), key1.getInputType()); }
Example 14
Source File: KeyFunctions.java From flink with Apache License 2.0 | 4 votes |
public static <T, K> TypeInformation<Tuple2<K, T>> createTypeWithKey( SelectorFunctionKeys<T, K> key) { return new TupleTypeInfo<>(key.getKeyType(), key.getInputType()); }
Example 15
Source File: KeyFunctions.java From flink with Apache License 2.0 | 4 votes |
public static <T, K1, K2> TypeInformation<Tuple3<K1, K2, T>> createTypeWithKey( SelectorFunctionKeys<T, K1> key1, SelectorFunctionKeys<T, K2> key2) { return new TupleTypeInfo<>(key1.getKeyType(), key2.getKeyType(), key1.getInputType()); }