/** * Checks whether this type can be used as a key for sorting. * The order produced by sorting this type must be meaningful. */ @PublicEvolving public boolean isSortKeyType() { return isKeyType(); }
/** * Constructor which is overwriting the default constructor. * @param type Types of tuple whether to check if given fields are key types. * @param fields Array of integers which are used as key for comparison. The order of indexes * is regarded in the reduce function. First index has highest priority and last index has * least priority. */ public SelectByMinFunction(TupleTypeInfo<T> type, int... fields) { this.fields = fields; // Check correctness of each position for (int field : fields) { // Is field inside array if (field < 0 || field >= type.getArity()) { throw new java.lang.IndexOutOfBoundsException( "MinReduceFunction field position " + field + " is out of range."); } // Check whether type is comparable if (!type.getTypeAt(field).isKeyType()) { throw new java.lang.IllegalArgumentException( "MinReduceFunction supports only key(Comparable) types."); } } }
/** * Constructor which is overwriting the default constructor. * @param type Types of tuple whether to check if given fields are key types. * @param fields Array of integers which are used as key for comparison. The order of indexes * is regarded in the reduce function. First index has highest priority and last index has * least priority. */ public SelectByMaxFunction(TupleTypeInfo<T> type, int... fields) { this.fields = fields; // Check correctness of each position for (int field : fields) { // Is field inside array if (field < 0 || field >= type.getArity()) { throw new IndexOutOfBoundsException( "MinReduceFunction field position " + field + " is out of range."); } // Check whether type is comparable if (!type.getTypeAt(field).isKeyType()) { throw new java.lang.IllegalArgumentException( "MinReduceFunction supports only key(Comparable) types."); } } }
public SelectorFunctionKeys(KeySelector<T, K> keyExtractor, TypeInformation<T> inputType, TypeInformation<K> keyType) { if (keyExtractor == null) { throw new NullPointerException("Key extractor must not be null."); } if (keyType == null) { throw new NullPointerException("Key type must not be null."); } if (!keyType.isKeyType()) { throw new InvalidProgramException("Return type "+keyType+" of KeySelector "+keyExtractor.getClass()+" is not a valid key type"); } this.keyExtractor = keyExtractor; this.inputType = inputType; this.keyType = keyType; this.originalKeyTypes = new TypeInformation[] {keyType}; if (keyType instanceof CompositeType) { this.keyFields = ((CompositeType<T>)keyType).getFlatFields(ExpressionKeys.SELECT_ALL_CHAR); } else { this.keyFields = new ArrayList<>(1); this.keyFields.add(new FlatFieldDescriptor(0, keyType)); } }
@Override @PublicEvolving public boolean isKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isKeyType()) { return false; } } return true; }
if(!ffd.getType().isKeyType()) { throw new InvalidProgramException("This type (" + ffd.getType() + ") cannot be used as key.");
/** * Checks whether this type can be used as a key for sorting. * The order produced by sorting this type must be meaningful. */ @PublicEvolving public boolean isSortKeyType() { return isKeyType(); }
/** * Checks whether this type can be used as a key for sorting. * The order produced by sorting this type must be meaningful. */ @PublicEvolving public boolean isSortKeyType() { return isKeyType(); }
public SelectorFunctionKeys(KeySelector<T, K> keyExtractor, TypeInformation<T> inputType, TypeInformation<K> keyType) { if (keyExtractor == null) { throw new NullPointerException("Key extractor must not be null."); } if (keyType == null) { throw new NullPointerException("Key type must not be null."); } if (!keyType.isKeyType()) { throw new InvalidProgramException("Return type "+keyType+" of KeySelector "+keyExtractor.getClass()+" is not a valid key type"); } this.keyExtractor = keyExtractor; this.inputType = inputType; this.keyType = keyType; this.originalKeyTypes = new TypeInformation[] {keyType}; if (keyType instanceof CompositeType) { this.keyFields = ((CompositeType<T>)keyType).getFlatFields(ExpressionKeys.SELECT_ALL_CHAR); } else { this.keyFields = new ArrayList<>(1); this.keyFields.add(new FlatFieldDescriptor(0, keyType)); } }
/** * Constructor which is overwriting the default constructor. * @param type Types of tuple whether to check if given fields are key types. * @param fields Array of integers which are used as key for comparison. The order of indexes * is regarded in the reduce function. First index has highest priority and last index has * least priority. */ public SelectByMinFunction(TupleTypeInfo<T> type, int... fields) { this.fields = fields; // Check correctness of each position for (int field : fields) { // Is field inside array if (field < 0 || field >= type.getArity()) { throw new java.lang.IndexOutOfBoundsException( "MinReduceFunction field position " + field + " is out of range."); } // Check whether type is comparable if (!type.getTypeAt(field).isKeyType()) { throw new java.lang.IllegalArgumentException( "MinReduceFunction supports only key(Comparable) types."); } } }
/** * Constructor which is overwriting the default constructor. * @param type Types of tuple whether to check if given fields are key types. * @param fields Array of integers which are used as key for comparison. The order of indexes * is regarded in the reduce function. First index has highest priority and last index has * least priority. */ public SelectByMaxFunction(TupleTypeInfo<T> type, int... fields) { this.fields = fields; // Check correctness of each position for (int field : fields) { // Is field inside array if (field < 0 || field >= type.getArity()) { throw new IndexOutOfBoundsException( "MinReduceFunction field position " + field + " is out of range."); } // Check whether type is comparable if (!type.getTypeAt(field).isKeyType()) { throw new java.lang.IllegalArgumentException( "MinReduceFunction supports only key(Comparable) types."); } } }
/** * Constructor which is overwriting the default constructor. * @param type Types of tuple whether to check if given fields are key types. * @param fields Array of integers which are used as key for comparison. The order of indexes * is regarded in the reduce function. First index has highest priority and last index has * least priority. */ public SelectByMinFunction(TupleTypeInfo<T> type, int... fields) { this.fields = fields; // Check correctness of each position for (int field : fields) { // Is field inside array if (field < 0 || field >= type.getArity()) { throw new java.lang.IndexOutOfBoundsException( "MinReduceFunction field position " + field + " is out of range."); } // Check whether type is comparable if (!type.getTypeAt(field).isKeyType()) { throw new java.lang.IllegalArgumentException( "MinReduceFunction supports only key(Comparable) types."); } } }
/** * Constructor which is overwriting the default constructor. * @param type Types of tuple whether to check if given fields are key types. * @param fields Array of integers which are used as key for comparison. The order of indexes * is regarded in the reduce function. First index has highest priority and last index has * least priority. */ public SelectByMaxFunction(TupleTypeInfo<T> type, int... fields) { this.fields = fields; // Check correctness of each position for (int field : fields) { // Is field inside array if (field < 0 || field >= type.getArity()) { throw new IndexOutOfBoundsException( "MinReduceFunction field position " + field + " is out of range."); } // Check whether type is comparable if (!type.getTypeAt(field).isKeyType()) { throw new java.lang.IllegalArgumentException( "MinReduceFunction supports only key(Comparable) types."); } } }
public SelectorFunctionKeys(KeySelector<T, K> keyExtractor, TypeInformation<T> inputType, TypeInformation<K> keyType) { if (keyExtractor == null) { throw new NullPointerException("Key extractor must not be null."); } if (keyType == null) { throw new NullPointerException("Key type must not be null."); } if (!keyType.isKeyType()) { throw new InvalidProgramException("Return type "+keyType+" of KeySelector "+keyExtractor.getClass()+" is not a valid key type"); } this.keyExtractor = keyExtractor; this.inputType = inputType; this.keyType = keyType; this.originalKeyTypes = new TypeInformation[] {keyType}; if (keyType instanceof CompositeType) { this.keyFields = ((CompositeType<T>)keyType).getFlatFields(ExpressionKeys.SELECT_ALL_CHAR); } else { this.keyFields = new ArrayList<>(1); this.keyFields.add(new FlatFieldDescriptor(0, keyType)); } }
@Override @PublicEvolving public boolean isKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isKeyType()) { return false; } } return true; }
@Override @PublicEvolving public boolean isKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isKeyType()) { return false; } } return true; }
if(!ffd.getType().isKeyType()) { throw new InvalidProgramException("This type (" + ffd.getType() + ") cannot be used as key.");
if(!ffd.getType().isKeyType()) { throw new InvalidProgramException("This type (" + ffd.getType() + ") cannot be used as key.");