public static boolean isSortKey(String fieldExpr, TypeInformation<?> type) { TypeInformation<?> sortKeyType; fieldExpr = fieldExpr.trim(); if (SELECT_ALL_CHAR.equals(fieldExpr) || SELECT_ALL_CHAR_SCALA.equals(fieldExpr)) { sortKeyType = type; } else { if (type instanceof CompositeType) { sortKeyType = ((CompositeType<?>) type).getTypeAt(fieldExpr); } else { throw new InvalidProgramException( "Field expression must be equal to '" + SELECT_ALL_CHAR + "' or '" + SELECT_ALL_CHAR_SCALA + "' for atomic types."); } } return sortKeyType.isSortKeyType(); }
private <K> void ensureSortableKey(Keys.SelectorFunctionKeys<T, K> sortKey) { if (!sortKey.getKeyType().isSortKeyType()) { throw new InvalidProgramException("Selected sort key is not a sortable type"); } }
@Override @PublicEvolving public boolean isSortKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isSortKeyType()) { return false; } } return true; }
public <K> SortedGrouping(DataSet<T> set, Keys<T> keys, Keys.SelectorFunctionKeys<T, K> keySelector, Order order) { super(set, keys); if (!(this.keys instanceof Keys.SelectorFunctionKeys)) { throw new InvalidProgramException("Sorting on KeySelector keys only works with KeySelector grouping."); } TypeInformation<?> sortKeyType = keySelector.getKeyType(); if (!sortKeyType.isSortKeyType()) { throw new InvalidProgramException("Key type " + sortKeyType + " is not sortable."); } this.groupSortKeyPositions = keySelector.computeLogicalKeyPositions(); for (int i = 0; i < groupSortKeyPositions.length; i++) { groupSortKeyPositions[i] += this.keys.getNumberOfKeyFields(); } this.groupSortSelectorFunctionKey = keySelector; this.groupSortOrders = new Order[groupSortKeyPositions.length]; Arrays.fill(this.groupSortOrders, order); }
public static boolean isSortKey(int fieldPos, TypeInformation<?> type) { if (!type.isTupleType() || !(type instanceof CompositeType)) { throw new InvalidProgramException("Specifying keys via field positions is only valid " + "for tuple data types. Type: " + type); } if (type.getArity() == 0) { throw new InvalidProgramException("Tuple size must be greater than 0. Size: " + type.getArity()); } if(fieldPos < 0 || fieldPos >= type.getArity()) { throw new IndexOutOfBoundsException("Tuple position is out of range: " + fieldPos); } TypeInformation<?> sortKeyType = ((CompositeType<?>)type).getTypeAt(fieldPos); return sortKeyType.isSortKeyType(); }
public static boolean isSortKey(String fieldExpr, TypeInformation<?> type) { TypeInformation<?> sortKeyType; fieldExpr = fieldExpr.trim(); if (SELECT_ALL_CHAR.equals(fieldExpr) || SELECT_ALL_CHAR_SCALA.equals(fieldExpr)) { sortKeyType = type; } else { if (type instanceof CompositeType) { sortKeyType = ((CompositeType<?>) type).getTypeAt(fieldExpr); } else { throw new InvalidProgramException( "Field expression must be equal to '" + SELECT_ALL_CHAR + "' or '" + SELECT_ALL_CHAR_SCALA + "' for atomic types."); } } return sortKeyType.isSortKeyType(); }
public static boolean isSortKey(String fieldExpr, TypeInformation<?> type) { TypeInformation<?> sortKeyType; fieldExpr = fieldExpr.trim(); if (SELECT_ALL_CHAR.equals(fieldExpr) || SELECT_ALL_CHAR_SCALA.equals(fieldExpr)) { sortKeyType = type; } else { if (type instanceof CompositeType) { sortKeyType = ((CompositeType<?>) type).getTypeAt(fieldExpr); } else { throw new InvalidProgramException( "Field expression must be equal to '" + SELECT_ALL_CHAR + "' or '" + SELECT_ALL_CHAR_SCALA + "' for atomic types."); } } return sortKeyType.isSortKeyType(); }
private <K> void ensureSortableKey(Keys.SelectorFunctionKeys<T, K> sortKey) { if (!sortKey.getKeyType().isSortKeyType()) { throw new InvalidProgramException("Selected sort key is not a sortable type"); } }
private <K> void ensureSortableKey(Keys.SelectorFunctionKeys<T, K> sortKey) { if (!sortKey.getKeyType().isSortKeyType()) { throw new InvalidProgramException("Selected sort key is not a sortable type"); } }
@Override @PublicEvolving public boolean isSortKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isSortKeyType()) { return false; } } return true; }
@Override @PublicEvolving public boolean isSortKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isSortKeyType()) { return false; } } return true; }
public <K> SortedGrouping(DataSet<T> set, Keys<T> keys, Keys.SelectorFunctionKeys<T, K> keySelector, Order order) { super(set, keys); if (!(this.keys instanceof Keys.SelectorFunctionKeys)) { throw new InvalidProgramException("Sorting on KeySelector keys only works with KeySelector grouping."); } TypeInformation<?> sortKeyType = keySelector.getKeyType(); if (!sortKeyType.isSortKeyType()) { throw new InvalidProgramException("Key type " + sortKeyType + " is not sortable."); } this.groupSortKeyPositions = keySelector.computeLogicalKeyPositions(); for (int i = 0; i < groupSortKeyPositions.length; i++) { groupSortKeyPositions[i] += this.keys.getNumberOfKeyFields(); } this.groupSortSelectorFunctionKey = keySelector; this.groupSortOrders = new Order[groupSortKeyPositions.length]; Arrays.fill(this.groupSortOrders, order); }
public <K> SortedGrouping(DataSet<T> set, Keys<T> keys, Keys.SelectorFunctionKeys<T, K> keySelector, Order order) { super(set, keys); if (!(this.keys instanceof Keys.SelectorFunctionKeys)) { throw new InvalidProgramException("Sorting on KeySelector keys only works with KeySelector grouping."); } TypeInformation<?> sortKeyType = keySelector.getKeyType(); if (!sortKeyType.isSortKeyType()) { throw new InvalidProgramException("Key type " + sortKeyType + " is not sortable."); } this.groupSortKeyPositions = keySelector.computeLogicalKeyPositions(); for (int i = 0; i < groupSortKeyPositions.length; i++) { groupSortKeyPositions[i] += this.keys.getNumberOfKeyFields(); } this.groupSortSelectorFunctionKey = keySelector; this.groupSortOrders = new Order[groupSortKeyPositions.length]; Arrays.fill(this.groupSortOrders, order); }
public static boolean isSortKey(int fieldPos, TypeInformation<?> type) { if (!type.isTupleType() || !(type instanceof CompositeType)) { throw new InvalidProgramException("Specifying keys via field positions is only valid " + "for tuple data types. Type: " + type); } if (type.getArity() == 0) { throw new InvalidProgramException("Tuple size must be greater than 0. Size: " + type.getArity()); } if(fieldPos < 0 || fieldPos >= type.getArity()) { throw new IndexOutOfBoundsException("Tuple position is out of range: " + fieldPos); } TypeInformation<?> sortKeyType = ((CompositeType<?>)type).getTypeAt(fieldPos); return sortKeyType.isSortKeyType(); }
public static boolean isSortKey(int fieldPos, TypeInformation<?> type) { if (!type.isTupleType() || !(type instanceof CompositeType)) { throw new InvalidProgramException("Specifying keys via field positions is only valid " + "for tuple data types. Type: " + type); } if (type.getArity() == 0) { throw new InvalidProgramException("Tuple size must be greater than 0. Size: " + type.getArity()); } if(fieldPos < 0 || fieldPos >= type.getArity()) { throw new IndexOutOfBoundsException("Tuple position is out of range: " + fieldPos); } TypeInformation<?> sortKeyType = ((CompositeType<?>)type).getTypeAt(fieldPos); return sortKeyType.isSortKeyType(); }